| author | urbanc |
| Tue, 01 Jan 2008 07:28:20 +0100 | |
| changeset 25751 | a4e69ce247e0 |
| parent 25722 | 0a104ddb72d9 |
| child 26055 | a7a537e0413a |
| permissions | -rw-r--r-- |
| 18269 | 1 |
(* $Id$ *) |
| 18105 | 2 |
|
| 19496 | 3 |
theory Weakening |
| 25722 | 4 |
imports "../Nominal" |
| 18105 | 5 |
begin |
6 |
||
| 25751 | 7 |
section {* Weakening Property in the Simply-Typed Lambda-Calculus *}
|
| 18105 | 8 |
|
9 |
atom_decl name |
|
10 |
||
| 25751 | 11 |
text {* Terms and Types *}
|
|
21052
ec5531061ed6
adapted to Stefan's new inductive package and cleaning up
urbanc
parents:
20955
diff
changeset
|
12 |
nominal_datatype lam = |
|
ec5531061ed6
adapted to Stefan's new inductive package and cleaning up
urbanc
parents:
20955
diff
changeset
|
13 |
Var "name" |
|
ec5531061ed6
adapted to Stefan's new inductive package and cleaning up
urbanc
parents:
20955
diff
changeset
|
14 |
| App "lam" "lam" |
|
ec5531061ed6
adapted to Stefan's new inductive package and cleaning up
urbanc
parents:
20955
diff
changeset
|
15 |
| Lam "\<guillemotleft>name\<guillemotright>lam" ("Lam [_]._" [100,100] 100)
|
| 18105 | 16 |
|
| 18352 | 17 |
nominal_datatype ty = |
|
25137
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
18 |
TVar "string" |
|
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
19 |
| TArr "ty" "ty" ("_ \<rightarrow> _" [100,100] 100)
|
| 18105 | 20 |
|
| 22533 | 21 |
lemma ty_fresh: |
22 |
fixes x::"name" |
|
23 |
and T::"ty" |
|
24 |
shows "x\<sharp>T" |
|
25 |
by (nominal_induct T rule: ty.induct) |
|
|
25137
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
26 |
(auto simp add: fresh_string) |
| 18105 | 27 |
|
|
25137
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
28 |
text {*
|
|
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
29 |
Valid contexts (at the moment we have no type for finite |
| 25722 | 30 |
sets yet; therefore typing-contexts are lists). |
31 |
*} |
|
| 23760 | 32 |
inductive |
| 18105 | 33 |
valid :: "(name\<times>ty) list \<Rightarrow> bool" |
| 21364 | 34 |
where |
35 |
v1[intro]: "valid []" |
|
|
25137
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
36 |
| v2[intro]: "\<lbrakk>valid \<Gamma>;x\<sharp>\<Gamma>\<rbrakk>\<Longrightarrow> valid ((x,T)#\<Gamma>)" |
| 18105 | 37 |
|
| 22533 | 38 |
equivariance valid |
|
22231
f76f187c91f9
added an infrastructure that allows the user to declare lemmas to be equivariance lemmas; the intention is to use these lemmas in automated tools but also can be employed by the user
urbanc
parents:
21488
diff
changeset
|
39 |
|
|
25137
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
40 |
text{* Typing judgements *}
|
| 23760 | 41 |
inductive |
|
22650
0c5b22076fb3
tuned the proof of lemma pt_list_set_fresh (as suggested by Randy Pollack) and tuned the syntax for sub_contexts
urbanc
parents:
22533
diff
changeset
|
42 |
typing :: "(name\<times>ty) list\<Rightarrow>lam\<Rightarrow>ty\<Rightarrow>bool" ("_ \<turnstile> _ : _" [60,60,60] 60)
|
| 21364 | 43 |
where |
|
22650
0c5b22076fb3
tuned the proof of lemma pt_list_set_fresh (as suggested by Randy Pollack) and tuned the syntax for sub_contexts
urbanc
parents:
22533
diff
changeset
|
44 |
t_Var[intro]: "\<lbrakk>valid \<Gamma>; (x,T)\<in>set \<Gamma>\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> Var x : T" |
|
0c5b22076fb3
tuned the proof of lemma pt_list_set_fresh (as suggested by Randy Pollack) and tuned the syntax for sub_contexts
urbanc
parents:
22533
diff
changeset
|
45 |
| t_App[intro]: "\<lbrakk>\<Gamma> \<turnstile> t1 : T1\<rightarrow>T2; \<Gamma> \<turnstile> t2 : T1\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> App t1 t2 : T2" |
|
25137
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
46 |
| t_Lam[intro]: "\<lbrakk>x\<sharp>\<Gamma>;(x,T1)#\<Gamma> \<turnstile> t : T2\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> Lam [x].t : T1\<rightarrow>T2" |
|
21052
ec5531061ed6
adapted to Stefan's new inductive package and cleaning up
urbanc
parents:
20955
diff
changeset
|
47 |
|
|
25137
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
48 |
text {*
|
| 25722 | 49 |
We derive the strong induction principle for the typing |
50 |
relation (this induction principle has the variable convention |
|
| 25751 | 51 |
already built-in). |
| 25722 | 52 |
*} |
|
22730
8bcc8809ed3b
nominal_inductive no longer proves equivariance.
berghofe
parents:
22650
diff
changeset
|
53 |
equivariance typing |
| 22533 | 54 |
nominal_inductive typing |
55 |
by (simp_all add: abs_fresh ty_fresh) |
|
| 18105 | 56 |
|
|
25137
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
57 |
text {* Abbreviation for the notion of subcontexts. *}
|
|
21052
ec5531061ed6
adapted to Stefan's new inductive package and cleaning up
urbanc
parents:
20955
diff
changeset
|
58 |
abbreviation |
|
22650
0c5b22076fb3
tuned the proof of lemma pt_list_set_fresh (as suggested by Randy Pollack) and tuned the syntax for sub_contexts
urbanc
parents:
22533
diff
changeset
|
59 |
"sub_context" :: "(name\<times>ty) list \<Rightarrow> (name\<times>ty) list \<Rightarrow> bool" ("_ \<subseteq> _" [60,60] 60)
|
| 22533 | 60 |
where |
|
22650
0c5b22076fb3
tuned the proof of lemma pt_list_set_fresh (as suggested by Randy Pollack) and tuned the syntax for sub_contexts
urbanc
parents:
22533
diff
changeset
|
61 |
"\<Gamma>1 \<subseteq> \<Gamma>2 \<equiv> \<forall>x T. (x,T)\<in>set \<Gamma>1 \<longrightarrow> (x,T)\<in>set \<Gamma>2" |
|
21052
ec5531061ed6
adapted to Stefan's new inductive package and cleaning up
urbanc
parents:
20955
diff
changeset
|
62 |
|
| 22533 | 63 |
text {* Now it comes: The Weakening Lemma *}
|
| 18105 | 64 |
|
|
25137
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
65 |
text {*
|
|
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
66 |
The first version is, after setting up the induction, |
| 25722 | 67 |
completely automatic except for use of atomize. |
68 |
*} |
|
|
18311
b83b00cbaecf
changed "fresh:" to "avoiding:" and cleaned up the weakening example
urbanc
parents:
18296
diff
changeset
|
69 |
lemma weakening_version1: |
|
25137
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
70 |
fixes \<Gamma>1 \<Gamma>2::"(name\<times>ty) list" |
|
22418
49e2d9744ae1
major update of the nominal package; there is now an infrastructure
urbanc
parents:
22231
diff
changeset
|
71 |
assumes a: "\<Gamma>1 \<turnstile> t : T" |
|
18311
b83b00cbaecf
changed "fresh:" to "avoiding:" and cleaned up the weakening example
urbanc
parents:
18296
diff
changeset
|
72 |
and b: "valid \<Gamma>2" |
|
22650
0c5b22076fb3
tuned the proof of lemma pt_list_set_fresh (as suggested by Randy Pollack) and tuned the syntax for sub_contexts
urbanc
parents:
22533
diff
changeset
|
73 |
and c: "\<Gamma>1 \<subseteq> \<Gamma>2" |
|
22418
49e2d9744ae1
major update of the nominal package; there is now an infrastructure
urbanc
parents:
22231
diff
changeset
|
74 |
shows "\<Gamma>2 \<turnstile> t : T" |
|
18311
b83b00cbaecf
changed "fresh:" to "avoiding:" and cleaned up the weakening example
urbanc
parents:
18296
diff
changeset
|
75 |
using a b c |
| 22533 | 76 |
by (nominal_induct \<Gamma>1 t T avoiding: \<Gamma>2 rule: typing.strong_induct) |
|
22418
49e2d9744ae1
major update of the nominal package; there is now an infrastructure
urbanc
parents:
22231
diff
changeset
|
77 |
(auto | atomize)+ |
| 18105 | 78 |
|
|
25137
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
79 |
text {*
|
|
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
80 |
The second version gives all details for the variable |
| 25722 | 81 |
and lambda case. |
82 |
*} |
|
|
18311
b83b00cbaecf
changed "fresh:" to "avoiding:" and cleaned up the weakening example
urbanc
parents:
18296
diff
changeset
|
83 |
lemma weakening_version2: |
|
25137
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
84 |
fixes \<Gamma>1 \<Gamma>2::"(name\<times>ty) list" |
| 18105 | 85 |
and t ::"lam" |
86 |
and \<tau> ::"ty" |
|
|
22650
0c5b22076fb3
tuned the proof of lemma pt_list_set_fresh (as suggested by Randy Pollack) and tuned the syntax for sub_contexts
urbanc
parents:
22533
diff
changeset
|
87 |
assumes a: "\<Gamma>1 \<turnstile> t : T" |
|
18311
b83b00cbaecf
changed "fresh:" to "avoiding:" and cleaned up the weakening example
urbanc
parents:
18296
diff
changeset
|
88 |
and b: "valid \<Gamma>2" |
|
22650
0c5b22076fb3
tuned the proof of lemma pt_list_set_fresh (as suggested by Randy Pollack) and tuned the syntax for sub_contexts
urbanc
parents:
22533
diff
changeset
|
89 |
and c: "\<Gamma>1 \<subseteq> \<Gamma>2" |
|
0c5b22076fb3
tuned the proof of lemma pt_list_set_fresh (as suggested by Randy Pollack) and tuned the syntax for sub_contexts
urbanc
parents:
22533
diff
changeset
|
90 |
shows "\<Gamma>2 \<turnstile> t : T" |
|
18311
b83b00cbaecf
changed "fresh:" to "avoiding:" and cleaned up the weakening example
urbanc
parents:
18296
diff
changeset
|
91 |
using a b c |
| 22533 | 92 |
proof (nominal_induct \<Gamma>1 t T avoiding: \<Gamma>2 rule: typing.strong_induct) |
93 |
case (t_Var \<Gamma>1 x T) (* variable case *) |
|
|
22650
0c5b22076fb3
tuned the proof of lemma pt_list_set_fresh (as suggested by Randy Pollack) and tuned the syntax for sub_contexts
urbanc
parents:
22533
diff
changeset
|
94 |
have "\<Gamma>1 \<subseteq> \<Gamma>2" by fact |
|
21052
ec5531061ed6
adapted to Stefan's new inductive package and cleaning up
urbanc
parents:
20955
diff
changeset
|
95 |
moreover |
|
ec5531061ed6
adapted to Stefan's new inductive package and cleaning up
urbanc
parents:
20955
diff
changeset
|
96 |
have "valid \<Gamma>2" by fact |
|
ec5531061ed6
adapted to Stefan's new inductive package and cleaning up
urbanc
parents:
20955
diff
changeset
|
97 |
moreover |
| 22533 | 98 |
have "(x,T)\<in> set \<Gamma>1" by fact |
99 |
ultimately show "\<Gamma>2 \<turnstile> Var x : T" by auto |
|
| 18105 | 100 |
next |
| 22533 | 101 |
case (t_Lam x \<Gamma>1 T1 t T2) (* lambda case *) |
102 |
have vc: "x\<sharp>\<Gamma>2" by fact (* variable convention *) |
|
|
25137
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
103 |
have ih: "\<lbrakk>valid ((x,T1)#\<Gamma>2); (x,T1)#\<Gamma>1 \<subseteq> (x,T1)#\<Gamma>2\<rbrakk> \<Longrightarrow> (x,T1)#\<Gamma>2 \<turnstile> t:T2" by fact |
|
22650
0c5b22076fb3
tuned the proof of lemma pt_list_set_fresh (as suggested by Randy Pollack) and tuned the syntax for sub_contexts
urbanc
parents:
22533
diff
changeset
|
104 |
have "\<Gamma>1 \<subseteq> \<Gamma>2" by fact |
|
0c5b22076fb3
tuned the proof of lemma pt_list_set_fresh (as suggested by Randy Pollack) and tuned the syntax for sub_contexts
urbanc
parents:
22533
diff
changeset
|
105 |
then have "(x,T1)#\<Gamma>1 \<subseteq> (x,T1)#\<Gamma>2" by simp |
| 18105 | 106 |
moreover |
|
21052
ec5531061ed6
adapted to Stefan's new inductive package and cleaning up
urbanc
parents:
20955
diff
changeset
|
107 |
have "valid \<Gamma>2" by fact |
| 22533 | 108 |
then have "valid ((x,T1)#\<Gamma>2)" using vc by (simp add: v2) |
|
22650
0c5b22076fb3
tuned the proof of lemma pt_list_set_fresh (as suggested by Randy Pollack) and tuned the syntax for sub_contexts
urbanc
parents:
22533
diff
changeset
|
109 |
ultimately have "(x,T1)#\<Gamma>2 \<turnstile> t : T2" using ih by simp |
|
0c5b22076fb3
tuned the proof of lemma pt_list_set_fresh (as suggested by Randy Pollack) and tuned the syntax for sub_contexts
urbanc
parents:
22533
diff
changeset
|
110 |
with vc show "\<Gamma>2 \<turnstile> Lam [x].t : T1\<rightarrow>T2" by auto |
| 21488 | 111 |
qed (auto) (* app case *) |
| 18105 | 112 |
|
|
25137
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
113 |
text{*
|
|
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
114 |
The original induction principle for the typing relation |
|
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
115 |
is not strong enough - even this simple lemma fails to be |
| 25722 | 116 |
simple ;o) |
117 |
*} |
|
|
25137
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
118 |
lemma weakening_not_straigh_forward: |
|
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
119 |
fixes \<Gamma>1 \<Gamma>2::"(name\<times>ty) list" |
|
22418
49e2d9744ae1
major update of the nominal package; there is now an infrastructure
urbanc
parents:
22231
diff
changeset
|
120 |
assumes a: "\<Gamma>1 \<turnstile> t : T" |
|
18311
b83b00cbaecf
changed "fresh:" to "avoiding:" and cleaned up the weakening example
urbanc
parents:
18296
diff
changeset
|
121 |
and b: "valid \<Gamma>2" |
|
22650
0c5b22076fb3
tuned the proof of lemma pt_list_set_fresh (as suggested by Randy Pollack) and tuned the syntax for sub_contexts
urbanc
parents:
22533
diff
changeset
|
122 |
and c: "\<Gamma>1 \<subseteq> \<Gamma>2" |
|
22418
49e2d9744ae1
major update of the nominal package; there is now an infrastructure
urbanc
parents:
22231
diff
changeset
|
123 |
shows "\<Gamma>2 \<turnstile> t : T" |
|
18311
b83b00cbaecf
changed "fresh:" to "avoiding:" and cleaned up the weakening example
urbanc
parents:
18296
diff
changeset
|
124 |
using a b c |
| 20503 | 125 |
proof (induct arbitrary: \<Gamma>2) |
|
25137
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
126 |
case (t_Var \<Gamma>1 x T) (* variable case still works *) |
|
22650
0c5b22076fb3
tuned the proof of lemma pt_list_set_fresh (as suggested by Randy Pollack) and tuned the syntax for sub_contexts
urbanc
parents:
22533
diff
changeset
|
127 |
have "\<Gamma>1 \<subseteq> \<Gamma>2" by fact |
|
21052
ec5531061ed6
adapted to Stefan's new inductive package and cleaning up
urbanc
parents:
20955
diff
changeset
|
128 |
moreover |
|
ec5531061ed6
adapted to Stefan's new inductive package and cleaning up
urbanc
parents:
20955
diff
changeset
|
129 |
have "valid \<Gamma>2" by fact |
|
ec5531061ed6
adapted to Stefan's new inductive package and cleaning up
urbanc
parents:
20955
diff
changeset
|
130 |
moreover |
| 22533 | 131 |
have "(x,T) \<in> (set \<Gamma>1)" by fact |
132 |
ultimately show "\<Gamma>2 \<turnstile> Var x : T" by auto |
|
| 18105 | 133 |
next |
| 22533 | 134 |
case (t_Lam x \<Gamma>1 T1 t T2) (* lambda case *) |
|
25137
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
135 |
(* These are all assumptions available in this case*) |
| 22533 | 136 |
have a0: "x\<sharp>\<Gamma>1" by fact |
|
22650
0c5b22076fb3
tuned the proof of lemma pt_list_set_fresh (as suggested by Randy Pollack) and tuned the syntax for sub_contexts
urbanc
parents:
22533
diff
changeset
|
137 |
have a1: "(x,T1)#\<Gamma>1 \<turnstile> t : T2" by fact |
|
0c5b22076fb3
tuned the proof of lemma pt_list_set_fresh (as suggested by Randy Pollack) and tuned the syntax for sub_contexts
urbanc
parents:
22533
diff
changeset
|
138 |
have a2: "\<Gamma>1 \<subseteq> \<Gamma>2" by fact |
|
18311
b83b00cbaecf
changed "fresh:" to "avoiding:" and cleaned up the weakening example
urbanc
parents:
18296
diff
changeset
|
139 |
have a3: "valid \<Gamma>2" by fact |
|
25137
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
140 |
have ih: "\<And>\<Gamma>3. \<lbrakk>valid \<Gamma>3; (x,T1)#\<Gamma>1 \<subseteq> \<Gamma>3\<rbrakk> \<Longrightarrow> \<Gamma>3 \<turnstile> t : T2" by fact |
|
22650
0c5b22076fb3
tuned the proof of lemma pt_list_set_fresh (as suggested by Randy Pollack) and tuned the syntax for sub_contexts
urbanc
parents:
22533
diff
changeset
|
141 |
have "(x,T1)#\<Gamma>1 \<subseteq> (x,T1)#\<Gamma>2" using a2 by simp |
| 18105 | 142 |
moreover |
| 22533 | 143 |
have "valid ((x,T1)#\<Gamma>2)" using v2 (* fails *) |
| 19496 | 144 |
oops |
|
25137
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
145 |
|
| 25722 | 146 |
text{* The complete proof without using the variable convention. *}
|
| 25751 | 147 |
|
|
25137
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
148 |
lemma weakening_with_explicit_renaming: |
|
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
149 |
fixes \<Gamma>1 \<Gamma>2::"(name\<times>ty) list" |
|
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
150 |
assumes a: "\<Gamma>1 \<turnstile> t : T" |
|
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
151 |
and b: "valid \<Gamma>2" |
|
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
152 |
and c: "\<Gamma>1 \<subseteq> \<Gamma>2" |
|
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
153 |
shows "\<Gamma>2 \<turnstile> t : T" |
|
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
154 |
using a b c |
|
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
155 |
proof (induct arbitrary: \<Gamma>2) |
|
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
156 |
case (t_Lam x \<Gamma>1 T1 t T2) (* lambda case *) |
|
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
157 |
have fc0: "x\<sharp>\<Gamma>1" by fact |
|
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
158 |
have ih: "\<And>\<Gamma>3. \<lbrakk>valid \<Gamma>3; (x,T1)#\<Gamma>1 \<subseteq> \<Gamma>3\<rbrakk> \<Longrightarrow> \<Gamma>3 \<turnstile> t : T2" by fact |
|
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
159 |
obtain c::"name" where fc1: "c\<sharp>(x,t,\<Gamma>1,\<Gamma>2)" (* we obtain a fresh name *) |
|
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
160 |
by (rule exists_fresh) (auto simp add: fs_name1) |
| 25138 | 161 |
have "Lam [c].([(c,x)]\<bullet>t) = Lam [x].t" using fc1 (* we then alpha-rename the lambda-abstraction *) |
|
25137
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
162 |
by (auto simp add: lam.inject alpha fresh_prod fresh_atm) |
|
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
163 |
moreover |
|
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
164 |
have "\<Gamma>2 \<turnstile> Lam [c].([(c,x)]\<bullet>t) : T1 \<rightarrow> T2" (* we can then alpha-rename our original goal *) |
|
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
165 |
proof - |
|
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
166 |
(* we establish (x,T1)#\<Gamma>1 \<subseteq> (x,T1)#([(c,x)]\<bullet>\<Gamma>2) and valid ((x,T1)#([(c,x)]\<bullet>\<Gamma>2)) *) |
|
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
167 |
have "(x,T1)#\<Gamma>1 \<subseteq> (x,T1)#([(c,x)]\<bullet>\<Gamma>2)" |
|
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
168 |
proof - |
|
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
169 |
have "\<Gamma>1 \<subseteq> \<Gamma>2" by fact |
|
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
170 |
then have "[(c,x)]\<bullet>((x,T1)#\<Gamma>1 \<subseteq> (x,T1)#([(c,x)]\<bullet>\<Gamma>2))" using fc0 fc1 |
|
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
171 |
by (perm_simp add: eqvts calc_atm perm_fresh_fresh ty_fresh) |
|
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
172 |
then show "(x,T1)#\<Gamma>1 \<subseteq> (x,T1)#([(c,x)]\<bullet>\<Gamma>2)" by (rule perm_boolE) |
|
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
173 |
qed |
|
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
174 |
moreover |
|
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
175 |
have "valid ((x,T1)#([(c,x)]\<bullet>\<Gamma>2))" |
|
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
176 |
proof - |
|
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
177 |
have "valid \<Gamma>2" by fact |
|
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
178 |
then show "valid ((x,T1)#([(c,x)]\<bullet>\<Gamma>2))" using fc1 |
|
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
179 |
by (auto intro!: v2 simp add: fresh_left calc_atm eqvts) |
|
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
180 |
qed |
|
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
181 |
(* these two facts give us by induction hypothesis the following *) |
|
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
182 |
ultimately have "(x,T1)#([(c,x)]\<bullet>\<Gamma>2) \<turnstile> t : T2" using ih by simp |
| 25138 | 183 |
(* we now apply renamings to get to our goal *) |
|
25137
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
184 |
then have "[(c,x)]\<bullet>((x,T1)#([(c,x)]\<bullet>\<Gamma>2) \<turnstile> t : T2)" by (rule perm_boolI) |
|
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
185 |
then have "(c,T1)#\<Gamma>2 \<turnstile> ([(c,x)]\<bullet>t) : T2" using fc1 |
|
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
186 |
by (perm_simp add: eqvts calc_atm perm_fresh_fresh ty_fresh) |
|
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
187 |
then show "\<Gamma>2 \<turnstile> Lam [c].([(c,x)]\<bullet>t) : T1 \<rightarrow> T2" using fc1 by auto |
|
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
188 |
qed |
|
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
189 |
ultimately show "\<Gamma>2 \<turnstile> Lam [x].t : T1 \<rightarrow> T2" by simp |
|
0835ac64834a
polished the proofs and added a version of the weakening lemma that does not use the variable convention
urbanc
parents:
24231
diff
changeset
|
190 |
qed (auto) |
| 18105 | 191 |
|
| 25138 | 192 |
text {*
|
| 25751 | 193 |
Moral: compare the proof with explicit renamings to version1 and version2, |
194 |
and imagine you are proving something more substantial than the weakening |
|
195 |
lemma. |
|
| 25722 | 196 |
*} |
| 25138 | 197 |
|
| 19496 | 198 |
end |