201
+ − 1
theory LamEx
600
+ − 2
imports Nominal "../QuotList"
201
+ − 3
begin
+ − 4
+ − 5
atom_decl name
+ − 6
243
+ − 7
thm abs_fresh(1)
+ − 8
201
+ − 9
nominal_datatype rlam =
+ − 10
rVar "name"
+ − 11
| rApp "rlam" "rlam"
+ − 12
| rLam "name" "rlam"
+ − 13
259
+ − 14
print_theorems
201
+ − 15
243
+ − 16
function
+ − 17
rfv :: "rlam \<Rightarrow> name set"
+ − 18
where
+ − 19
rfv_var: "rfv (rVar a) = {a}"
+ − 20
| rfv_app: "rfv (rApp t1 t2) = (rfv t1) \<union> (rfv t2)"
+ − 21
| rfv_lam: "rfv (rLam a t) = (rfv t) - {a}"
+ − 22
sorry
+ − 23
247
+ − 24
termination rfv sorry
243
+ − 25
271
+ − 26
inductive
246
+ − 27
alpha :: "rlam \<Rightarrow> rlam \<Rightarrow> bool" ("_ \<approx> _" [100, 100] 100)
+ − 28
where
+ − 29
a1: "a = b \<Longrightarrow> (rVar a) \<approx> (rVar b)"
+ − 30
| a2: "\<lbrakk>t1 \<approx> t2; s1 \<approx> s2\<rbrakk> \<Longrightarrow> rApp t1 s1 \<approx> rApp t2 s2"
+ − 31
| a3: "\<lbrakk>t \<approx> ([(a,b)]\<bullet>s); a \<notin> rfv (rLam b t)\<rbrakk> \<Longrightarrow> rLam a t \<approx> rLam b s"
+ − 32
259
+ − 33
print_theorems
+ − 34
271
+ − 35
lemma alpha_refl:
286
+ − 36
fixes t::"rlam"
+ − 37
shows "t \<approx> t"
+ − 38
apply(induct t rule: rlam.induct)
+ − 39
apply(simp add: a1)
+ − 40
apply(simp add: a2)
+ − 41
apply(rule a3)
+ − 42
apply(subst pt_swap_bij'')
+ − 43
apply(rule pt_name_inst)
+ − 44
apply(rule at_name_inst)
+ − 45
apply(simp)
+ − 46
apply(simp)
+ − 47
done
+ − 48
534
+ − 49
lemma alpha_equivp:
+ − 50
shows "equivp alpha"
271
+ − 51
sorry
+ − 52
201
+ − 53
quotient lam = rlam / alpha
534
+ − 54
apply(rule alpha_equivp)
286
+ − 55
done
201
+ − 56
203
+ − 57
print_quotients
+ − 58
663
0dd10a900cae
Different syntax for definitions that allows overloading and retrieving of definitions by matching whole constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 59
quotient_def
0dd10a900cae
Different syntax for definitions that allows overloading and retrieving of definitions by matching whole constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 60
Var :: "Var :: name \<Rightarrow> lam"
229
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 61
where
663
0dd10a900cae
Different syntax for definitions that allows overloading and retrieving of definitions by matching whole constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 62
"rVar"
229
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 63
663
0dd10a900cae
Different syntax for definitions that allows overloading and retrieving of definitions by matching whole constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 64
quotient_def
0dd10a900cae
Different syntax for definitions that allows overloading and retrieving of definitions by matching whole constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 65
App :: "App :: lam \<Rightarrow> lam \<Rightarrow> lam"
229
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 66
where
663
0dd10a900cae
Different syntax for definitions that allows overloading and retrieving of definitions by matching whole constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 67
"rApp"
229
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 68
663
0dd10a900cae
Different syntax for definitions that allows overloading and retrieving of definitions by matching whole constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 69
quotient_def
0dd10a900cae
Different syntax for definitions that allows overloading and retrieving of definitions by matching whole constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 70
Lam :: "Lam :: name \<Rightarrow> lam \<Rightarrow> lam"
229
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 71
where
663
0dd10a900cae
Different syntax for definitions that allows overloading and retrieving of definitions by matching whole constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 72
"rLam"
201
+ − 73
218
+ − 74
thm Var_def
+ − 75
thm App_def
+ − 76
thm Lam_def
+ − 77
663
0dd10a900cae
Different syntax for definitions that allows overloading and retrieving of definitions by matching whole constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 78
quotient_def
0dd10a900cae
Different syntax for definitions that allows overloading and retrieving of definitions by matching whole constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 79
fv :: "fv :: lam \<Rightarrow> name set"
243
+ − 80
where
663
0dd10a900cae
Different syntax for definitions that allows overloading and retrieving of definitions by matching whole constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 81
"rfv"
243
+ − 82
+ − 83
thm fv_def
+ − 84
229
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 85
(* definition of overloaded permutation function *)
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 86
(* for the lifted type lam *)
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 87
overloading
268
4d58c02289ca
simplified the quotient_def code; type of the defined constant must now be given; for-part eliminated
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 88
perm_lam \<equiv> "perm :: 'x prm \<Rightarrow> lam \<Rightarrow> lam" (unchecked)
229
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 89
begin
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 90
663
0dd10a900cae
Different syntax for definitions that allows overloading and retrieving of definitions by matching whole constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 91
quotient_def
0dd10a900cae
Different syntax for definitions that allows overloading and retrieving of definitions by matching whole constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 92
perm_lam :: "perm_lam :: 'x prm \<Rightarrow> lam \<Rightarrow> lam"
229
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 93
where
663
0dd10a900cae
Different syntax for definitions that allows overloading and retrieving of definitions by matching whole constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 94
"perm::'x prm \<Rightarrow> rlam \<Rightarrow> rlam"
229
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 95
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 96
end
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 97
238
+ − 98
(*quotient_def (for lam)
+ − 99
abs_fun_lam :: "'x prm \<Rightarrow> lam \<Rightarrow> lam"
+ − 100
where
+ − 101
"perm_lam \<equiv> (perm::'x prm \<Rightarrow> rlam \<Rightarrow> rlam)"*)
+ − 102
+ − 103
229
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 104
thm perm_lam_def
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 105
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 106
(* lemmas that need to lift *)
234
+ − 107
lemma pi_var_com:
229
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 108
fixes pi::"'x prm"
234
+ − 109
shows "(pi\<bullet>rVar a) \<approx> rVar (pi\<bullet>a)"
229
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 110
sorry
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 111
234
+ − 112
lemma pi_app_com:
229
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 113
fixes pi::"'x prm"
234
+ − 114
shows "(pi\<bullet>rApp t1 t2) \<approx> rApp (pi\<bullet>t1) (pi\<bullet>t2)"
229
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 115
sorry
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 116
234
+ − 117
lemma pi_lam_com:
229
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 118
fixes pi::"'x prm"
234
+ − 119
shows "(pi\<bullet>rLam a t) \<approx> rLam (pi\<bullet>a) (pi\<bullet>t)"
229
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 120
sorry
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 121
451
586e3dc4afdb
Added 'TRY' to refl in clean_tac to get as far as possible. Removed unnecessary [quot_rsp] in FSet. Added necessary [quot_rsp] and one lifted thm in LamEx.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 122
586e3dc4afdb
Added 'TRY' to refl in clean_tac to get as far as possible. Removed unnecessary [quot_rsp] in FSet. Added necessary [quot_rsp] and one lifted thm in LamEx.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 123
201
+ − 124
lemma real_alpha:
451
586e3dc4afdb
Added 'TRY' to refl in clean_tac to get as far as possible. Removed unnecessary [quot_rsp] in FSet. Added necessary [quot_rsp] and one lifted thm in LamEx.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 125
assumes a: "t = [(a,b)]\<bullet>s" "a\<sharp>[b].s"
201
+ − 126
shows "Lam a t = Lam b s"
451
586e3dc4afdb
Added 'TRY' to refl in clean_tac to get as far as possible. Removed unnecessary [quot_rsp] in FSet. Added necessary [quot_rsp] and one lifted thm in LamEx.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 127
using a
586e3dc4afdb
Added 'TRY' to refl in clean_tac to get as far as possible. Removed unnecessary [quot_rsp] in FSet. Added necessary [quot_rsp] and one lifted thm in LamEx.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 128
unfolding fresh_def supp_def
217
+ − 129
sorry
+ − 130
636
+ − 131
lemma perm_rsp[quot_respect]:
286
+ − 132
"(op = ===> alpha ===> alpha) op \<bullet> op \<bullet>"
229
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 133
apply(auto)
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 134
(* this is propably true if some type conditions are imposed ;o) *)
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 135
sorry
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 136
451
586e3dc4afdb
Added 'TRY' to refl in clean_tac to get as far as possible. Removed unnecessary [quot_rsp] in FSet. Added necessary [quot_rsp] and one lifted thm in LamEx.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 137
lemma fresh_rsp:
586e3dc4afdb
Added 'TRY' to refl in clean_tac to get as far as possible. Removed unnecessary [quot_rsp] in FSet. Added necessary [quot_rsp] and one lifted thm in LamEx.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 138
"(op = ===> alpha ===> op =) fresh fresh"
229
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 139
apply(auto)
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 140
(* this is probably only true if some type conditions are imposed *)
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 141
sorry
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 142
636
+ − 143
lemma rVar_rsp[quot_respect]:
451
586e3dc4afdb
Added 'TRY' to refl in clean_tac to get as far as possible. Removed unnecessary [quot_rsp] in FSet. Added necessary [quot_rsp] and one lifted thm in LamEx.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 144
"(op = ===> alpha) rVar rVar"
586e3dc4afdb
Added 'TRY' to refl in clean_tac to get as far as possible. Removed unnecessary [quot_rsp] in FSet. Added necessary [quot_rsp] and one lifted thm in LamEx.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 145
by (auto intro:a1)
234
+ − 146
636
+ − 147
lemma rApp_rsp[quot_respect]: "(alpha ===> alpha ===> alpha) rApp rApp"
451
586e3dc4afdb
Added 'TRY' to refl in clean_tac to get as far as possible. Removed unnecessary [quot_rsp] in FSet. Added necessary [quot_rsp] and one lifted thm in LamEx.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 148
by (auto intro:a2)
234
+ − 149
636
+ − 150
lemma rLam_rsp[quot_respect]: "(op = ===> alpha ===> alpha) rLam rLam"
229
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 151
apply(auto)
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 152
apply(rule a3)
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 153
apply(rule_tac t="[(x,x)]\<bullet>y" and s="y" in subst)
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 154
apply(rule sym)
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 155
apply(rule trans)
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 156
apply(rule pt_name3)
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 157
apply(rule at_ds1[OF at_name_inst])
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 158
apply(simp add: pt_name1)
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 159
apply(assumption)
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 160
apply(simp add: abs_fresh)
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 161
done
217
+ − 162
636
+ − 163
lemma rfv_rsp[quot_respect]: "(alpha ===> op =) rfv rfv"
247
+ − 164
sorry
217
+ − 165
285
+ − 166
lemma rvar_inject: "rVar a \<approx> rVar b = (a = b)"
+ − 167
apply (auto)
+ − 168
apply (erule alpha.cases)
+ − 169
apply (simp_all add: rlam.inject alpha_refl)
+ − 170
done
+ − 171
237
+ − 172
376
+ − 173
lemma pi_var: "(pi\<Colon>('x \<times> 'x) list) \<bullet> Var a = Var (pi \<bullet> a)"
610
2bee5ca44ef5
removed "global" data and lookup functions; had to move a tactic out from the inj_repabs_match tactic since apply_rsp interferes with a trans2 rule for ===>
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 174
apply (tactic {* lift_tac @{context} @{thm pi_var_com} 1 *})
370
+ − 175
done
+ − 176
376
+ − 177
lemma pi_app: "(pi\<Colon>('x \<times> 'x) list) \<bullet> App (x\<Colon>lam) (xa\<Colon>lam) = App (pi \<bullet> x) (pi \<bullet> xa)"
610
2bee5ca44ef5
removed "global" data and lookup functions; had to move a tactic out from the inj_repabs_match tactic since apply_rsp interferes with a trans2 rule for ===>
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 178
apply (tactic {* lift_tac @{context} @{thm pi_app_com} 1 *})
370
+ − 179
done
376
+ − 180
+ − 181
lemma pi_lam: "(pi\<Colon>('x \<times> 'x) list) \<bullet> Lam (a\<Colon>name) (x\<Colon>lam) = Lam (pi \<bullet> a) (pi \<bullet> x)"
610
2bee5ca44ef5
removed "global" data and lookup functions; had to move a tactic out from the inj_repabs_match tactic since apply_rsp interferes with a trans2 rule for ===>
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 182
apply (tactic {* lift_tac @{context} @{thm pi_lam_com} 1 *})
370
+ − 183
done
249
+ − 184
376
+ − 185
lemma fv_var: "fv (Var (a\<Colon>name)) = {a}"
610
2bee5ca44ef5
removed "global" data and lookup functions; had to move a tactic out from the inj_repabs_match tactic since apply_rsp interferes with a trans2 rule for ===>
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 186
apply (tactic {* lift_tac @{context} @{thm rfv_var} 1 *})
370
+ − 187
done
376
+ − 188
+ − 189
lemma fv_app: "fv (App (x\<Colon>lam) (xa\<Colon>lam)) = fv x \<union> fv xa"
610
2bee5ca44ef5
removed "global" data and lookup functions; had to move a tactic out from the inj_repabs_match tactic since apply_rsp interferes with a trans2 rule for ===>
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 190
apply (tactic {* lift_tac @{context} @{thm rfv_app} 1 *})
376
+ − 191
done
249
+ − 192
376
+ − 193
lemma fv_lam: "fv (Lam (a\<Colon>name) (x\<Colon>lam)) = fv x - {a}"
610
2bee5ca44ef5
removed "global" data and lookup functions; had to move a tactic out from the inj_repabs_match tactic since apply_rsp interferes with a trans2 rule for ===>
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 194
apply (tactic {* lift_tac @{context} @{thm rfv_lam} 1 *})
376
+ − 195
done
+ − 196
+ − 197
lemma a1: "(a\<Colon>name) = (b\<Colon>name) \<Longrightarrow> Var a = Var b"
610
2bee5ca44ef5
removed "global" data and lookup functions; had to move a tactic out from the inj_repabs_match tactic since apply_rsp interferes with a trans2 rule for ===>
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 198
apply (tactic {* lift_tac @{context} @{thm a1} 1 *})
370
+ − 199
done
376
+ − 200
+ − 201
lemma a2: "\<lbrakk>(x\<Colon>lam) = (xa\<Colon>lam); (xb\<Colon>lam) = (xc\<Colon>lam)\<rbrakk> \<Longrightarrow> App x xb = App xa xc"
610
2bee5ca44ef5
removed "global" data and lookup functions; had to move a tactic out from the inj_repabs_match tactic since apply_rsp interferes with a trans2 rule for ===>
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 202
apply (tactic {* lift_tac @{context} @{thm a2} 1 *})
370
+ − 203
done
376
+ − 204
+ − 205
lemma a3: "\<lbrakk>(x\<Colon>lam) = [(a\<Colon>name, b\<Colon>name)] \<bullet> (xa\<Colon>lam); a \<notin> fv (Lam b x)\<rbrakk> \<Longrightarrow> Lam a x = Lam b xa"
610
2bee5ca44ef5
removed "global" data and lookup functions; had to move a tactic out from the inj_repabs_match tactic since apply_rsp interferes with a trans2 rule for ===>
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 206
apply (tactic {* lift_tac @{context} @{thm a3} 1 *})
376
+ − 207
done
286
+ − 208
378
+ − 209
lemma alpha_cases: "\<lbrakk>a1 = a2; \<And>a b. \<lbrakk>a1 = Var a; a2 = Var b; a = b\<rbrakk> \<Longrightarrow> P;
+ − 210
\<And>x xa xb xc. \<lbrakk>a1 = App x xb; a2 = App xa xc; x = xa; xb = xc\<rbrakk> \<Longrightarrow> P;
+ − 211
\<And>x a b xa. \<lbrakk>a1 = Lam a x; a2 = Lam b xa; x = [(a, b)] \<bullet> xa; a \<notin> fv (Lam b x)\<rbrakk> \<Longrightarrow> P\<rbrakk>
370
+ − 212
\<Longrightarrow> P"
610
2bee5ca44ef5
removed "global" data and lookup functions; had to move a tactic out from the inj_repabs_match tactic since apply_rsp interferes with a trans2 rule for ===>
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 213
apply (tactic {* lift_tac @{context} @{thm alpha.cases} 1 *})
378
+ − 214
done
+ − 215
+ − 216
lemma alpha_induct: "\<lbrakk>(qx\<Colon>lam) = (qxa\<Colon>lam); \<And>(a\<Colon>name) b\<Colon>name. a = b \<Longrightarrow> (qxb\<Colon>lam \<Rightarrow> lam \<Rightarrow> bool) (Var a) (Var b);
370
+ − 217
\<And>(x\<Colon>lam) (xa\<Colon>lam) (xb\<Colon>lam) xc\<Colon>lam. \<lbrakk>x = xa; qxb x xa; xb = xc; qxb xb xc\<rbrakk> \<Longrightarrow> qxb (App x xb) (App xa xc);
+ − 218
\<And>(x\<Colon>lam) (a\<Colon>name) (b\<Colon>name) xa\<Colon>lam.
+ − 219
\<lbrakk>x = [(a, b)] \<bullet> xa; qxb x ([(a, b)] \<bullet> xa); a \<notin> fv (Lam b x)\<rbrakk> \<Longrightarrow> qxb (Lam a x) (Lam b xa)\<rbrakk>
+ − 220
\<Longrightarrow> qxb qx qxa"
610
2bee5ca44ef5
removed "global" data and lookup functions; had to move a tactic out from the inj_repabs_match tactic since apply_rsp interferes with a trans2 rule for ===>
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 221
apply (tactic {* lift_tac @{context} @{thm alpha.induct} 1 *})
378
+ − 222
done
252
e30997c88050
Regularize for equalities and a better tactic. "alpha.cases" now lifts.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 223
376
+ − 224
lemma var_inject: "(Var a = Var b) = (a = b)"
610
2bee5ca44ef5
removed "global" data and lookup functions; had to move a tactic out from the inj_repabs_match tactic since apply_rsp interferes with a trans2 rule for ===>
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 225
apply (tactic {* lift_tac @{context} @{thm rvar_inject} 1 *})
370
+ − 226
done
285
+ − 227
451
586e3dc4afdb
Added 'TRY' to refl in clean_tac to get as far as possible. Removed unnecessary [quot_rsp] in FSet. Added necessary [quot_rsp] and one lifted thm in LamEx.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 228
lemma lam_induct:" \<lbrakk>\<And>name. P (Var name); \<And>lam1 lam2. \<lbrakk>P lam1; P lam2\<rbrakk> \<Longrightarrow> P (App lam1 lam2);
586e3dc4afdb
Added 'TRY' to refl in clean_tac to get as far as possible. Removed unnecessary [quot_rsp] in FSet. Added necessary [quot_rsp] and one lifted thm in LamEx.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 229
\<And>name lam. P lam \<Longrightarrow> P (Lam name lam)\<rbrakk> \<Longrightarrow> P lam"
610
2bee5ca44ef5
removed "global" data and lookup functions; had to move a tactic out from the inj_repabs_match tactic since apply_rsp interferes with a trans2 rule for ===>
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 230
apply (tactic {* lift_tac @{context} @{thm rlam.induct} 1 *})
451
586e3dc4afdb
Added 'TRY' to refl in clean_tac to get as far as possible. Removed unnecessary [quot_rsp] in FSet. Added necessary [quot_rsp] and one lifted thm in LamEx.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 231
done
586e3dc4afdb
Added 'TRY' to refl in clean_tac to get as far as possible. Removed unnecessary [quot_rsp] in FSet. Added necessary [quot_rsp] and one lifted thm in LamEx.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 232
249
+ − 233
lemma var_supp:
+ − 234
shows "supp (Var a) = ((supp a)::name set)"
+ − 235
apply(simp add: supp_def)
+ − 236
apply(simp add: pi_var)
+ − 237
apply(simp add: var_inject)
+ − 238
done
+ − 239
+ − 240
lemma var_fresh:
+ − 241
fixes a::"name"
+ − 242
shows "(a\<sharp>(Var b)) = (a\<sharp>b)"
+ − 243
apply(simp add: fresh_def)
+ − 244
apply(simp add: var_supp)
+ − 245
done
247
+ − 246
663
0dd10a900cae
Different syntax for definitions that allows overloading and retrieving of definitions by matching whole constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 247
end