SLIDE 1
HO in Coq Guillaume Ambal, Sergue Lenglet and Alan Schmitt - - PowerPoint PPT Presentation
HO in Coq Guillaume Ambal, Sergue Lenglet and Alan Schmitt - - PowerPoint PPT Presentation
HO in Coq Guillaume Ambal, Sergue Lenglet and Alan Schmitt Higher-Order -calculus Model of concurrent and communicating systems First-order: inert data (channel names, . . . ) Higher-order: executable processes
SLIDE 2
SLIDE 3
Higher-Order π-calculus
Communication channel names a, b, c, . . . Process variables X, Y , Z, . . . P, Q ::=
SLIDE 4
Higher-Order π-calculus
Communication channel names a, b, c, . . . Process variables X, Y , Z, . . . P, Q ::= ⊘ nil process
SLIDE 5
Higher-Order π-calculus
Communication channel names a, b, c, . . . Process variables X, Y , Z, . . . P, Q ::= ⊘ nil process | P Q parallel composition
SLIDE 6
Higher-Order π-calculus
Communication channel names a, b, c, . . . Process variables X, Y , Z, . . . P, Q ::= ⊘ nil process | P Q parallel composition | X variable | a(X).P process input a(X).X
SLIDE 7
Higher-Order π-calculus
Communication channel names a, b, c, . . . Process variables X, Y , Z, . . . P, Q ::= ⊘ nil process | P Q parallel composition | X variable | a(X).P process input a(X).(X b(Y ).Y)
SLIDE 8
Higher-Order π-calculus
Communication channel names a, b, c, . . . Process variables X, Y , Z, . . . P, Q ::= ⊘ nil process | P Q parallel composition | X variable | a(X).P process input | aP.Q process output a(X).(X b(Y ).Y b⊘. ⊘ )
SLIDE 9
Higher-Order π-calculus
Communication channel names a, b, c, . . . Process variables X, Y , Z, . . . P, Q ::= ⊘ nil process | P Q parallel composition | X variable | a(X).P process input | aP.Q process output a(X).(X b(Y ).Y b⊘. ⊘ ) abc(Z).Z.⊘⊘
SLIDE 10
Higher-Order π-calculus
Communication channel names a, b, c, . . . Process variables X, Y , Z, . . . P, Q ::= ⊘ nil process | P Q parallel composition | X variable | a(X).P process input | aP.Q process output a(X).(X b(Y ).Y b⊘. ⊘ ) abc(Z).Z.⊘⊘
SLIDE 11
Higher-Order π-calculus
Communication channel names a, b, c, . . . Process variables X, Y , Z, . . . P, Q ::= ⊘ nil process | P Q parallel composition | X variable | a(X).P process input | aP.Q process output Communication: a(X).P aR.Q − → P{R/X} Q a(X).(X b(Y ).Y b⊘. ⊘ ) abc(Z).Z.⊘⊘
SLIDE 12
Higher-Order π-calculus
Communication channel names a, b, c, . . . Process variables X, Y , Z, . . . P, Q ::= ⊘ nil process | P Q parallel composition | X variable | a(X).P process input | aP.Q process output Communication: a(X).P aR.Q − → P{R/X} Q a(X).(X b(Y ).Y b⊘. ⊘ ) abc(Z).Z.⊘⊘ − → bc(Z).Z.⊘ b(Y ).Y b⊘.⊘ ⊘
SLIDE 13
Higher-Order π-calculus
Communication channel names a, b, c, . . . Process variables X, Y , Z, . . . P, Q ::= ⊘ nil process | P Q parallel composition | X variable | a(X).P process input | aP.Q process output Communication: a(X).P aR.Q − → P{R/X} Q a(X).(X b(Y ).Y b⊘. ⊘ ) abc(Z).Z.⊘⊘ − → bc(Z).Z.⊘ b(Y ).Y b⊘.⊘ ⊘
SLIDE 14
Higher-Order π-calculus
Communication channel names a, b, c, . . . Process variables X, Y , Z, . . . P, Q ::= ⊘ nil process | P Q parallel composition | X variable | a(X).P process input | aP.Q process output Communication: a(X).P aR.Q − → P{R/X} Q a(X).(X b(Y ).Y b⊘. ⊘ ) abc(Z).Z.⊘⊘ − → bc(Z).Z.⊘ b(Y ).Y b⊘.⊘ ⊘ − → ⊘ c(Z).Z b⊘.⊘ ⊘
SLIDE 15
Higher-Order π-calculus
Communication channel names a, b, c, . . . Process variables X, Y , Z, . . . P, Q ::= ⊘ nil process | P Q parallel composition | X variable | a(X).P process input | aP.Q process output | νa.P name restriction Communication: a(X).P aR.Q − → P{R/X} Q
SLIDE 16
Name restriction
Syntax: P, Q ::= ⊘ | P Q | X | a(X).P | aP.Q | νa.P νab.(ab⊘.⊘.P a(X).dX.Q)
SLIDE 17
Name restriction
Syntax: P, Q ::= ⊘ | P Q | X | a(X).P | aP.Q | νa.P νab.(ab⊘.⊘.P a(X).dX.Q) a(X).X
SLIDE 18
Name restriction
Syntax: P, Q ::= ⊘ | P Q | X | a(X).P | aP.Q | νa.P νab.(ab⊘.⊘.P a(X).dX.Q)
SLIDE 19
Name restriction
Syntax: P, Q ::= ⊘ | P Q | X | a(X).P | aP.Q | νa.P νab.(ab⊘.⊘.P a(X).dX.Q) − → νab.(P db⊘.⊘.Q)
SLIDE 20
Name restriction
Syntax: P, Q ::= ⊘ | P Q | X | a(X).P | aP.Q | νa.P νab.(ab⊘.⊘.P a(X).dX.Q) − → νab.(P db⊘.⊘.Q) d(Y ).(Y R)
SLIDE 21
Name restriction
Syntax: P, Q ::= ⊘ | P Q | X | a(X).P | aP.Q | νa.P νab.(ab⊘.⊘.P a(X).dX.Q) − → νab.(P db⊘.⊘.Q) d(Y ).(Y R) − →νab.(P Q) b⊘.⊘ R
SLIDE 22
Name restriction
Syntax: P, Q ::= ⊘ | P Q | X | a(X).P | aP.Q | νa.P νab.(ab⊘.⊘.P a(X).dX.Q) − → νab.(P db⊘.⊘.Q) d(Y ).(Y R) ≃ νba.(P db⊘.⊘.Q) d(Y ).(Y R)
SLIDE 23
Name restriction
Syntax: P, Q ::= ⊘ | P Q | X | a(X).P | aP.Q | νa.P νab.(ab⊘.⊘.P a(X).dX.Q) − → νab.(P db⊘.⊘.Q) d(Y ).(Y R) ≃ νba.(P db⊘.⊘.Q) d(Y ).(Y R) ≃ νb.(νa.(P db⊘.⊘.Q) d(Y ).(Y R))
SLIDE 24
Name restriction
Syntax: P, Q ::= ⊘ | P Q | X | a(X).P | aP.Q | νa.P νab.(ab⊘.⊘.P a(X).dX.Q) − → νab.(P db⊘.⊘.Q) d(Y ).(Y R) ≃ νba.(P db⊘.⊘.Q) d(Y ).(Y R) ≃ νb.(νa.(P db⊘.⊘.Q) d(Y ).(Y R)) − → νb.(νa.(P Q) b⊘.⊘ R)
SLIDE 25
Name restriction
Syntax: P, Q ::= ⊘ | P Q | X | a(X).P | aP.Q | νa.P νab.(ab⊘.⊘.P a(X).dX.Q) − → νab.(P db⊘.⊘.Q) d(Y ).(Y R) ≃ νba.(P db⊘.⊘.Q) d(Y ).(Y R) ≃ νb.(νa.(P db⊘.⊘.Q) d(Y ).(Y R)) − → νb.(νa.(P Q) b⊘.⊘ R) Input: P
a
− → (X)R Output: Q
a
− → ν b.ST
SLIDE 26
Name restriction
Syntax: P, Q ::= ⊘ | P Q | X | a(X).P | aP.Q | νa.P νab.(ab⊘.⊘.P a(X).dX.Q) − → νab.(P db⊘.⊘.Q) d(Y ).(Y R) ≃ νba.(P db⊘.⊘.Q) d(Y ).(Y R) ≃ νb.(νa.(P db⊘.⊘.Q) d(Y ).(Y R)) − → νb.(νa.(P Q) b⊘.⊘ R) Input: P
a
− → (X)R Output: Q
a
− → ν b.ST P
a
− → (X)R Q
a
− → ν b.ST P Q − → ν b.(R{S/X} T)
- b ∩ fn(R) = ∅
SLIDE 27
What we formalize
◮ Bisimilarity: if P
∼ α
- Q
P′ then P
α
- ∼
Q
α
- P′
∼
Q′ ◮ Congruence: if P ∼ Q then P R ∼ Q R, νa.P ∼ νa.Q, . . . ◮ Howe’s method [CONCUR 15]
SLIDE 28
SLIDE 29
Binders
Process input a(X).P: binds process variables X ◮ Static scope ◮ Process variables are substituted (by processes) ◮ Forbids computation Name restriction νa.P, ν a.PQ: binds names a ◮ Dynamic scope ◮ No substitution ◮ Allows computation
SLIDE 30
Binders
Process input a(X).P: binds process variables X ◮ Static scope ◮ Process variables are substituted (by processes) ◮ Forbids computation Similar to λ-abstraction: any representation Name restriction νa.P, ν a.PQ: binds names a ◮ Dynamic scope ◮ No substitution ◮ Allows computation
SLIDE 31
Binders
Process input a(X).P: binds process variables X ◮ Static scope ◮ Process variables are substituted (by processes) ◮ Forbids computation Similar to λ-abstraction: any representation Name restriction νa.P, ν a.PQ: binds names a ◮ Dynamic scope ◮ No substitution ◮ Allows computation Locally nameless (CPP 18) and Nominal
SLIDE 32
Locally Nameless
SLIDE 33
Locally nameless
Bound names are de Bruijn indices νba.(ab⊘.⊘.⊘ a(X).dX.⊘) d(Y ).Y ν.ν.(01⊘.⊘.⊘ 0(X).dX.⊘) d(Y ).Y Invalid terms ν.1⊘.⊘ ⇒ well-formedness predicate
SLIDE 34
Locally nameless
Bound names are de Bruijn indices νba.(ab⊘.⊘.⊘ a(X).dX.⊘) d(Y ).Y ν.ν.(01⊘.⊘.⊘ 0(X).dX.⊘) d(Y ).Y Invalid terms ν.1⊘.⊘ ⇒ well-formedness predicate Message output R
a
− → ν b.PQ νnPQ Scope extrusion
SLIDE 35
Scope extrusion in locally nameless
Bind c then d in νba.PabdQabcd ν ν 0 1 d . 0 1 c d
SLIDE 36
Scope extrusion in locally nameless
Bind c then d in νba.Pabdνc.Qabcd ν ν 0 1 d . 0 1 c d
SLIDE 37
Scope extrusion in locally nameless
Bind c then d in νba.Pabdνc.Qabcd ν ν 0 1 d . 0 1 c d ν ν 0 1 d . ν 0 1 ? d
SLIDE 38
Scope extrusion in locally nameless
Bind c then d in νba.Pabdνc.Qabcd ν ν 0 1 d . 0 1 c d ν ν 0 1 d . ν 1 2 0 d
SLIDE 39
Scope extrusion in locally nameless
Bind c then d in νdba.Pabdνc.Qabcd ν ν 0 1 d . 0 1 c d ν ν 0 1 d . ν 1 2 0 d ν ν ν 0 1 2 . ν 1 2 0 3
SLIDE 40
Computing under binders
P − → P′ νa.P − → νa.P′ {K → a}P replaces K with a in P ∀a / ∈ fn(P) ∪ fn(P′) {0 → a}P − → {0 → a}P′ ν.P − → ν.P′
Lemma (Renaming)
If P holds for {K → a}P, it holds for {K → b}P if . . .
SLIDE 41
Nominal
SLIDE 42
Nominal
As on paper: names and α-equivalence νa.P =α νb.(P{b/a}) if b / ∈ fn(P) Swapping instead of renaming [a ↔ b](νc.Q) ∆ = ν([a ↔ b]c).[a ↔ b]Q
SLIDE 43
Nominal
As on paper: names and α-equivalence νa.P =α νb.(P{b/a}) if b / ∈ fn(P) Swapping instead of renaming [a ↔ b](νc.Q) ∆ = ν([a ↔ b]c).[a ↔ b]Q
Lemma
◮ [b ↔ c](P{Q/X}) =α ([b ↔ c]P){([b ↔ c]Q)/X}; ◮ if P =α P′ and Q =α Q′ then P{Q/X} =α P′{Q′/X}
SLIDE 44
Nominal
As on paper: names and α-equivalence νa.P =α νb.(P{b/a}) if b / ∈ fn(P) Swapping instead of renaming [a ↔ b](νc.Q) ∆ = ν([a ↔ b]c).[a ↔ b]Q
Lemma
◮ [b ↔ c](P{Q/X}) =α ([b ↔ c]P){([b ↔ c]Q)/X}; ◮ if P =α P′ and Q =α Q′ then P{Q/X} =α P′{Q′/X} Working modulo α-equivalence Swapping lemmas: much simpler than renaming lemmas
SLIDE 45
Representing outputs
R
a
− → ν b.PQ: list b1, . . . , bn, P, and Q New binding structure Redo what we did for processes Manipulation of lists
SLIDE 46
Evaluation
Nominal Locally nameless
SLIDE 47
Evaluation
Nominal Locally nameless intrinsic α-equivalence < wf predicate name > de Bruijn indices
SLIDE 48
Evaluation
Nominal Locally nameless intrinsic α-equivalence < wf predicate name > de Bruijn indices
- utputs
list of names < 1 number specific α-equivalence ≪ ∅
SLIDE 49
Evaluation
Nominal Locally nameless intrinsic α-equivalence < wf predicate name > de Bruijn indices
- utputs
list of names < 1 number specific α-equivalence ≪ ∅ renaming swapping ≫ renaming
SLIDE 50
Evaluation
Nominal Locally nameless intrinsic α-equivalence < wf predicate name > de Bruijn indices
- utputs
list of names < 1 number specific α-equivalence ≪ ∅ renaming swapping ≫ renaming total 4k lines ≫ 5k lines
SLIDE 51
New challenger incoming pure deBruijn indices
SLIDE 52
Evaluation (bis)
Nominal de Bruijn Locally nameless
SLIDE 53
Evaluation (bis)
Nominal de Bruijn Locally nameless intrinsic α-equivalence ∅ wf predicate name dB indices dB indices
SLIDE 54
Evaluation (bis)
Nominal de Bruijn Locally nameless intrinsic α-equivalence ∅ wf predicate name dB indices dB indices
- utputs
list of names 1 number 1 number specific α-equivalence ∅ ∅
SLIDE 55
Evaluation (bis)
Nominal de Bruijn Locally nameless intrinsic α-equivalence ∅ wf predicate name dB indices dB indices
- utputs
list of names 1 number 1 number specific α-equivalence ∅ ∅ renaming [a ↔ b]P map f P {0 → a}P f : N → N
SLIDE 56
Evaluation (bis)
Nominal de Bruijn Locally nameless intrinsic α-equivalence ∅ wf predicate name dB indices dB indices
- utputs
list of names 1 number 1 number specific α-equivalence ∅ ∅ renaming [a ↔ b]P map f P {0 → a}P f : N → N total 4k lines 3k lines 5k lines
SLIDE 57