The Nominal Datatype Package in Isabelle/HOL
Christian Urban University of Munich joint work with Stefan Berghofer, Markus Wenzel, Alexander Krauss. . .
Not tingham, 18. April 2006 – p.1 (1/1)
The Nominal Datatype Package in Isabelle/HOL Christian Urban - - PowerPoint PPT Presentation
The Nominal Datatype Package in Isabelle/HOL Christian Urban University of Munich joint work with Stefan Berghofer, Markus Wenzel, Alexander Krauss. . . Not tingham, 18. April 2006 p.1 (1/1) The POPLmark-Challenge How close are we
Not tingham, 18. April 2006 – p.1 (1/1)
Obviously we aren’t there yet: for binders reasonable powerful tools are available: de-Bruijn indices (in Coq, Isabelle,. . . ) or HOAS (mainly in Twelf) but apart from some theorem-proving experts, nobody seems to use them; non-experts are still routinely do their proofs on paper, only
Not tingham, 18. April 2006 – p.2 (1/2)
Obviously we aren’t there yet: for binders reasonable powerful tools are available: de-Bruijn indices (in Coq, Isabelle,. . . ) or HOAS (mainly in Twelf) but apart from some theorem-proving experts, nobody seems to use them; non-experts are still routinely do their proofs on paper, only
Not tingham, 18. April 2006 – p.2 (2/2)
Substitution Lemma: If
x 6 y and x 62 F V (L), then M [x := N ℄[y := L℄Proof: By induction on the structure of
M. Case 1: M is a variable.Case 1.1.
MCase 1.2.
Mimplies
L[x := : : :℄Case 1.3.
Mthat
z 6 x; y and z is not free in N ;tion hypothesis.
Not tingham, 18. April 2006 – p.3 (1/8)
Substitution Lemma: If
x 6 y and x 62 F V (L), then M [x := N ℄[y := L℄Proof: By induction on the structure of
M. Case 1: M is a variable.Case 1.1.
MCase 1.2.
Mimplies
L[x := : : :℄Case 1.3.
Mthat
z 6 x; y and z is not free in N ;tion hypothesis.
tingham, 18. April 2006 – p.3 (2/8)
Substitution Lemma: If
x 6 y and x 62 F V (L), then M [x := N ℄[y := L℄Proof: By induction on the structure of
M. Case 1: M is a variable.Case 1.1.
MCase 1.2.
Mimplies
L[x := : : :℄Case 1.3.
Mthat
z 6 x; y and z is not free in N ;tion hypothesis.
tingham, 18. April 2006 – p.3 (3/8)
Substitution Lemma: If
x 6 y and x 62 F V (L), then M [x := N ℄[y := L℄Proof: By induction on the structure of
M. Case 1: M is a variable.Case 1.1.
MCase 1.2.
Mimplies
L[x := : : :℄Case 1.3.
Mthat
z 6 x; y and z is not free in N ;tion hypothesis.
tingham, 18. April 2006 – p.3 (4/8)
Substitution Lemma: If
x 6 y and x 62 F V (L), then M [x := N ℄[y := L℄Proof: By induction on the structure of
M. Case 1: M is a variable.Case 1.1.
MCase 1.2.
Mimplies
L[x := : : :℄Case 1.3.
Mthat
z 6 x; y and z is not free in N ;tion hypothesis.
tingham, 18. April 2006 – p.3 (5/8)
Substitution Lemma: If
x 6 y and x 62 F V (L), then M [x := N ℄[y := L℄Proof: By induction on the structure of
M. Case 1: M is a variable.Case 1.1.
MCase 1.2.
Mimplies
L[x := : : :℄Case 1.3.
Mthat
z 6 x; y and z is not free in N ;tion hypothesis.
tingham, 18. April 2006 – p.3 (6/8)
Substitution Lemma: If
x 6 y and x 62 F V (L), then M [x := N ℄[y := L℄Proof: By induction on the structure of
M. Case 1: M is a variable.Case 1.1.
MCase 1.2.
Mimplies
L[x := : : :℄Case 1.3.
Mthat
z 6 x; y and z is not free in N ;tion hypothesis.
IH
Not tingham, 18. April 2006 – p.3 (7/8)
Substitution Lemma: If
x 6 y and x 62 F V (L), then M [x := N ℄[y := L℄Proof: By induction on the structure of
M. Case 1: M is a variable.Case 1.1.
MCase 1.2.
Mimplies
L[x := : : :℄Case 1.3.
Mthat
z 6 x; y and z is not free in N ;tion hypothesis.
tingham, 18. April 2006 – p.3 (8/8)
lemma forget: assumes a: ”
x # L”shows ”
L[x ::= P ℄ = L”using a by (nominal induct
L avoiding: x P rule: lam.induct)(auto simp add: abs fresh fresh atm) lemma fresh fact: fixes
z :: ”name”assumes a: ”
z # N” and b: ” z # L”shows ”
z # N [y ::= L℄”using a b by (nominal induct
N avoiding: z y L rule: lam.induct)(auto simp add: abs fresh fresh atm) lemma subst lemma: assumes a: ”
x 6= y” and b: ” x # L”shows ”
M [x ::= N ℄[y ::= L℄ = M [y ::= L℄[x ::= N [y ::= L℄℄”using a b by (nominal induct
M avoiding: x y N L rule: lam.induct)(auto simp add: forget fresh fact)
Not tingham, 18. April 2006 – p.4 (1/3)
lemma forget: assumes a: ”
x # L”shows ”
L[x ::= P ℄ = L”using a by (nominal induct
L avoiding: x P rule: lam.induct)(auto simp add: abs fresh fresh atm) lemma fresh fact: fixes
z :: ”name”assumes a: ”
z # N” and b: ” z # L”shows ”
z # N [y ::= L℄”using a b by (nominal induct
N avoiding: z y L rule: lam.induct)(auto simp add: abs fresh fresh atm) lemma subst lemma: assumes a: ”
x 6= y” and b: ” x # L”shows ”
M [x ::= N ℄[y ::= L℄ = M [y ::= L℄[x ::= N [y ::= L℄℄”using a b by (nominal induct
M avoiding: x y N L rule: lam.induct)(auto simp add: forget fresh fact)
stands for
x 62 F V (L)reads as “x fresh for
L”is a polymorphic construction from the Nominal Logic Work by Pitts
Not tingham, 18. April 2006 – p.4 (2/3)
lemma forget: assumes a: ”
x # L”shows ”
L[x ::= P ℄ = L”using a by (nominal induct
L avoiding: x P rule: lam.induct)(auto simp add: abs fresh fresh atm) lemma fresh fact: fixes
z :: ”name”assumes a: ”
z # N” and b: ” z # L”shows ”
z # N [y ::= L℄”using a b by (nominal induct
N avoiding: z y L rule: lam.induct)(auto simp add: abs fresh fresh atm) lemma subst lemma: assumes a: ”
x 6= y” and b: ” x # L”shows ”
M [x ::= N ℄[y ::= L℄ = M [y ::= L℄[x ::= N [y ::= L℄℄”using a b by (nominal induct
M avoiding: x y N L rule: lam.induct)(auto simp add: forget fresh fact)
Not tingham, 18. April 2006 – p.4 (3/3)
The nominal datatype package generates the
atom decl name nominal datatype lam =
j Var “name” j App “lam” ”lam” j Lam “ h hname i ilam” (“Lam [ ℄. ” [100,100℄ 100)The type lam is defined so that we have equations Lam
[a℄:(Var a) = Lam [b℄:(Var b)which do not hold for “normal” datatypes.
Not tingham, 18. April 2006 – p.5 (1/1)
Then automatically generated is a structural induction principle that has Barendregt’s convention already build in:
8a x: P x (Var a) 8t 1 t 2 x: (8z : P z t 1 ) ^ (8z : P z t 2 ) ) P x (App t 1 t 2 ) 8a t x: a # x ^ (8z : P z t) ) P x (Lam [a℄:t) P x tNot tingham, 18. April 2006 – p.6 (1/7)
Then automatically generated is a structural induction principle that has Barendregt’s convention already build in:
8a x: P x (Var a) 8t 1 t 2 x: (8z : P z t 1 ) ^ (8z : P z t 2 ) ) P x (App t 1 t 2 ) 8a t x: a # x ^ (8z : P z t) ) P x (Lam [a℄:t) P x tthe variable over which the induction proceeds: “. . . By induction over the structure of
Not tingham, 18. April 2006 – p.6 (2/7)
Then automatically generated is a structural induction principle that has Barendregt’s convention already build in:
8a x: P x (Var a) 8t 1 t 2 x: (8z : P z t 1 ) ^ (8z : P z t 2 ) ) P x (App t 1 t 2 ) 8a t x: a # x ^ (8z : P z t) ) P x (Lam [a℄:t) P x tthe context of the induction; for which the binder should be fresh
) (x; y ; N ; L):“. . . By the variable convention we can assume
z 6 x; y and z not free in N,Not tingham, 18. April 2006 – p.6 (3/7)
Then automatically generated is a structural induction principle that has Barendregt’s convention already build in:
8a x: P x (Var a) 8t 1 t 2 x: (8z : P z t 1 ) ^ (8z : P z t 2 ) ) P x (App t 1 t 2 ) 8a t x: a # x ^ (8z : P z t) ) P x (Lam [a℄:t) P x tthe property to be proved by induction:
(x;y ;N ;L): M : x 6= y ^ x # L ) M [x ::= N ℄[y ::= L℄ = M [y ::= L℄[x ::= N [y ::= L℄℄Not tingham, 18. April 2006 – p.6 (4/7)
Then automatically generated is a structural induction principle that has Barendregt’s convention already build in:
8a x: P x (Var a) 8t 1 t 2 x: (8z : P z t 1 ) ^ (8z : P z t 2 ) ) P x (App t 1 t 2 ) 8a t x: a # x ^ (8z : P z t) ) P x (Lam [a℄:t) P x tOne only has to write (more in the talk of Markus Wenzel): by (nominal induct
M avoiding: x y N L rule: lam.induct)Not tingham, 18. April 2006 – p.6 (5/7)
Then automatically generated is a structural induction principle that has Barendregt’s convention already build in:
8a x: P x (Var a) 8t 1 t 2 x: (8z : P z t 1 ) ^ (8z : P z t 2 ) ) P x (App t 1 t 2 ) 8a t x: a # x ^ (8z : P z t) ) P x (Lam [a℄:t) P x tThe lambda-case amounts to:
z # (x; y ; N ; L) !! 8xy N L: x 6= y ^ x # L ) M [x ::= N ℄[y ::= L℄ = M [y ::= L℄[x ::= N [y ::= L℄℄ x 6= y ; x # L (Lam [z ℄:M )[x ::= N ℄[y ::= L℄ = (Lam [z ℄:M )[y ::= L℄[x ::= N [y ::= L℄℄Not tingham, 18. April 2006 – p.6 (6/7)
Then automatically generated is a structural induction principle that has Barendregt’s convention already build in:
8a x: P x (Var a) 8t 1 t 2 x: (8z : P z t 1 ) ^ (8z : P z t 2 ) ) P x (App t 1 t 2 ) 8a t x: a # x ^ (8z : P z t) ) P x (Lam [a℄:t) P x tBy the way: There is a condition for when Barendregt’s variable convention is applicable—it is almost always satisfied, but not always:
x needs to be finitely supported (is not allowed to mentionall names as free)
Not tingham, 18. April 2006 – p.6 (7/7)
nominal-isabelle@mailbroy.informatik.tu-muenchen.de http://isabelle.in.tum.de/nominal/
Not tingham, 18. April 2006 – p.7 (1/1)