Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

アーベル論理でセッション型

395 views

Published on

PPL2013で使ったスライド。

Published in: Technology
  • Be the first to comment

アーベル論理でセッション型

  1. 1. Session Types in Abelian Logic Yoichi Hirai (Univ. Tokyo, JSPS Fellow) 2013-03-06 会津東山 content to be presented in PLACES ’13
  2. 2. 同期通信のプリミティブ 交換 cliparts
  3. 3. 右をブラックボックス化 input: output: cliparts
  4. 4. 左をブラックボックス化input:output: cliparts
  5. 5. 両方ブラックボックス化input: input:output: output:
  6. 6. 型付きλ に 交換子(静)├c: α→β ├c: β→α
  7. 7. 矛盾├c: unit→ ├(): unit ├c():  
  8. 8. そうだ、Linearにしようc: α⊸βとc: β⊸αを一回ずつ使う
  9. 9. Linearにしよう(静)Γ├ t: φ Δ├ s: ψ Γ, y: φ, z: ψ├ t: θ Γ, Δ├ t⊗s: φ⊗ψ Γ, x: φ⊗ψ├ let x be y⊗z in t: θ…IMALLのadditive unit抜き断片… に追加├c⊗c: (α⊸β)⊗ (β⊸α)調べたらAbelian logicというのの演繹体系(健全且完全)
  10. 10. Linearにしよう(動)交換したい。 t⇓v ┃ s⇓w ct⇓w ┃ cs⇓v残りはAbramsky (1994)から拾う。 t⇓v ┃ s⇓w 等 t⊗s⇓v⊗w
  11. 11. Linearにしよう(静)操作的意味論と形を合わせる。Γ├ t:α ┃Δ├ s:βΓ├ ct:β┃ Δ├cs:αConjunctive hypersequentと呼ぶ。Abelian logicに健全で完全なまま。(同じ論理の乗法的断片を白旗が研究している)
  12. 12. nacy states that if t ⇓ v and t ⇓ w hold, then v and w are identversion. anis given to possibly same time, it is derivable. prove a is ea ultiple termsderivablemultiple terms thethe samealso derivable evaluate a at the the result is also easier to Especially, erivable hypersequent, hypersequent, at result is time, it n 決定性と型保存 our com Determinacy derivable hypersequent, is used, the calculu can(General Determinacy of the Amida also deri evaluate a3.4 version. the result isneral communicatingcommunicating the communicatingcommunerthat, whenever a term is used, term aws that, whenever a communicating term is Since the and t ⇓ w hold, then v and w are identical. used, term cordingshown in if t ⇓Sync rule the Sync rule occurrence iden nacy states the the Amida tin occurrence introducing the types to that the shown ⇓ w hold, then v and w are intr types v and erminacy of calculus) Ifm 2.3.4 (General Determinacy of· the Amida vating仮定 to 0at v0 term. t1 time, rule calculus)multiple termspossibly multiple termsis · the same time, it is eaaccording to tthe the same ⇓ v1initthe·easiertto ⇓ occurrence ⇓ types shown Sync n prove an 有導出on is given at cating term. t1 ⇓(Type Preservation ⇓ calculus) If terms t 決定性1 2.3.1 v Preservation ·of·0the 0n∼ t1n of 1 ·t ⇓ ⇓ v v the Amida calculus) tneral version.かかる vtAmidaは他に無い。 n ⇓ vn , . . . , If ter ··· t 0 nmϕ0persequent(General tDeterminacy nthe Amida evaluation se : 型保存 · · of: ∼ n :に型がつくt ofϕthe Amida calculus)I 2.3.1 ·(Typethe Amida calculus) and sequence t0 ⇓terminacy t ⇓ w t0 ϕ0 Preservation of : n If an calculus) ϕn · and an evaluation ·· m 2.3.4 0 0 t1 ⇓ w 1 ··· tn ⇓ wn ypersequent t0 : ϕ then · · ·vable, ⇓ vn derivable, 0 tn then tn : ϕn and an evaluati t1 ⇓ w 1 ·t·0· ⇓ w0 n ⇓twn w1 t 1 ⇓ ··· tn ⇓ wn h vitt1n ⇓ identical·0to vtn∼ t1n⇓ v1 v derivable, i .⇓ · ·t ⇓ w is⇓v1n ならば、0thenv にも同じ型がつく。 ··· tn ⇓ vn v 0 ··· n each 0v:iϕis identicalv0 : ϕvn.: ϕn · · to wi0 · vn : ϕn w. i duction on the height ϕ ··· v0 :of0evaluation derivation. Each vn : ϕnivable.By induction on tthe height tof ⇓ w1ght tof ⇓ w1 1 · ·0 ⇓ w0 n ⇓ wnevaluation· derivation.nthe com t 1 ·· evaluation· derivation. Each component wtn ⇓ in Eacherivable. oneone applicable rule. Also, the order ofof deco s onlyonly applicable rule. Also, the order decomp n hasy evaluation using the propositions below. We classify theWe induction on evaluation using the propositions below.
  13. 13. 送受信 c: α⊸unitとc: unit⊸αを 一回ずつ使う セッション型[Takeuchi, Honda, Kubo94]では•cはαを送信用 c: !α end• cはαを受信用 c: ?α end
  14. 14. are modification from Wadler’s translations and descriptions チャネルのセッション型をマクロに The notation here is different from the original notation by Kubo [131]. (cf. Wadler, Caires&Pfenning) !ϕ ψ ≡ ϕ ψ output a val ?ϕ ψ ≡ ϕ ⊗ ψ input a val ⊕{li : ϕi }i∈I ≡ ϕ0 & · · · & ϕn , I = {0, . . . , n} se2.4.2 Processes as Abbreviations &{li : ϕi }i∈I ≡ ϕ0 ⊕ · · · ⊕ ϕn , I = {0, . . . , n} offerWe define the≡sending and receiving constructs of end 1 プロセスをマクロに like { where I is a finite downward-closed set of natural numbers x u . t ≡ t[(xu)/x] send u throug notes, the encoding looks opposite of what some would expe explains, ≡ let x be y channelstinstead of processes. x(y). t we are typing ⊗ x in receive y through The grammar
  15. 15. rules in the next proposition.he next proposition. セッション型つけマクロm Theorem 2.4.1 (Process Typing Rules: receivers)and receivers) 2.4.1 (Process Typing Rules: senders and senders These rules aree.admissible. O y : ψ, x : χ t : : ψ, x : χ yϕ t:ϕ O Γ, x : χ tO :ϕ Γ, x :u : ψ t : ϕ ∆ χ recv send send x : ?ψ χ x(y).?ψϕ O x: t: χ x(y). t : ϕ O Γ, ∆, x : !ψ O χ x Γ, ∆, ϕ : !ψ χ u . t: x O Γ t:ϕ O Γ t:ϕ end : end 0:1 Γ, x ign x in t : ϕ 0:1 O Γ, x : end ign x in t : ϕ esenting the proof, we note that the types of variable x change in the rules. Before presenting the proof, we note that the types of variable x chang cts the intuition of session types: the session type of a channel changes after This reflects the intuition of session types: the session type of a channel munication occurs through the channel. some communication occurs through the channel. fter expanding abbreviations, the first rule is actually one of the original Proof After expanding abbreviations, the first rule is actually one o rules: O y : ψ, x : χ t:ϕ ⊗L .
  16. 16. for convergence of the Amida calculus. カットあると Nested Channel Pairs 評価できず困る Consider a typed term: 1R ∗:1 Ax ⊕R x:1 x:1 inl(∗) : 1 ⊕ 1 Merge x:1 x:1 inl(∗) : 1 ⊕ 1型はつくのに Sync x : 1 cx : 1 ⊕ 1 c(inl(∗)) : 1 ¯ Cut c(¯(inl(∗))) : 1 ⊕ 1 c with no evaluation. When we think about why this process does not hav評価できない。 this process is deadlocked. one explanation is In order to evaluate t we can add the following eval-subst rule:でも cの出力 = eval-subst cの入力 E t⇓v = inl(*) ? u[v/x] ⇓ w E u[t/x] ⇓ w so that the following evaluation is possible
  17. 17. s process is deadlocked. In order to eva 無理に評価する為の規則ng eval-subst rule: E t⇓v u[v/x] ⇓ w eval-subst E u[t/x] ⇓ wvaluation is possible • 型保存の証明、場合分けに圧倒され未完: ∗⇓∗ 手書きよりも形式化した方がらくかも? ∗⇓∗ inl(∗) ⇓ inl(∗) .
  18. 18. 線形λに交換子を追加したら• セッション型の表現力(チャネル渡しもできる)• 無矛盾。Abelian logicになる。• 次の目標:型がついたら必ず実行できる&型保存の両立• カットは取れない 博士論文1章: 歴史, 2章: この話, 3章: 無待機計算(ゲーデル論理),4章: 無待機計算(MTL), 5章: 3章をHaskellに
  19. 19. IMLL Essential Nets (Murawski and Ong) 時間があれば for (X− `+ Y+ ) ⊗+ (Y− `+ X+ ). X − + Y Y − X + + + Not a correct one. ` ` 1 any leaf is connected to a + unique peer (with the dual ⊗ label) 2 acyclic 3 every path from the root to a “dashed-child” goes through the parent node.
  20. 20. Amida Nets for Ablian Logic (Multiplicative) for (X− `+ Y+ ) ⊗+ (Y− `+ X+ ). X − + Y Y − X + A correct one: + + ` ` 1 any leaf is connected to a unique peer (with the dual ⊗+ label) 2 acyclic 3 every path from the root to a “dashed-child” goes through the parent node. Thm. A multiplicative formula is provable in Abelian logic iff a correct Amida net exists for the formula.
  21. 21. +Amida Edge Elimination ⊗ (for soundness) ϕ ψ χ ϕ ψχ + 1 + ⊗ + ⊗ + ⊗ ϕ ψ⊗χ ϕ⊗1 ψ⊗χ
  22. 22. +Amida Edge Elimination ` (for soundness) ϕ+ ψ − `− ⊥− 1+ 1+ ϕ + ψ− χ+ χ+ ⊗+ `+ ⊗+ ⊥− ψ− ϕ+ ψ − `+ χ+ `+ `+ ⊥− `+ (ϕ+ ⊗+ 1+ ) ψ − `+ χ+ •

×