author | Christian Urban <urbanc@in.tum.de> |
Fri, 27 Aug 2010 03:37:17 +0800 | |
changeset 2440 | 0a36825b16c1 |
parent 2436 | 3885dc2669f9 |
child 2442 | 1f9360daf6e1 |
permissions | -rw-r--r-- |
1797
fddb470720f1
renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
Christian Urban <urbanc@in.tum.de>
parents:
1773
diff
changeset
|
1 |
theory Lambda |
2424
621ebd8b13c4
changed parser so that the binding mode is indicated as "bind (list)", "bind (set)" or "bind (res)"; if only "bind" is given, then bind (list) is assumed as default
Christian Urban <urbanc@in.tum.de>
parents:
2311
diff
changeset
|
2 |
imports "../NewParser" |
1594 | 3 |
begin |
4 |
||
5 |
atom_decl name |
|
2440
0a36825b16c1
"isabelle make test" makes all major examples....they work up to supp theorems (excluding)
Christian Urban <urbanc@in.tum.de>
parents:
2436
diff
changeset
|
6 |
declare [[STEPS = 100]] |
1594 | 7 |
|
2436
3885dc2669f9
cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents:
2434
diff
changeset
|
8 |
nominal_datatype lam = |
1800
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
9 |
Var "name" |
2436
3885dc2669f9
cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents:
2434
diff
changeset
|
10 |
| App "lam" "lam" |
3885dc2669f9
cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents:
2434
diff
changeset
|
11 |
| Lam x::"name" l::"lam" bind x in l |
2431
331873ebc5cd
can now deal with type variables in nominal datatype definitions
Christian Urban <urbanc@in.tum.de>
parents:
2425
diff
changeset
|
12 |
|
2436
3885dc2669f9
cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents:
2434
diff
changeset
|
13 |
thm lam.distinct |
3885dc2669f9
cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents:
2434
diff
changeset
|
14 |
thm lam.induct |
3885dc2669f9
cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents:
2434
diff
changeset
|
15 |
thm lam.exhaust |
3885dc2669f9
cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents:
2434
diff
changeset
|
16 |
thm lam.fv_defs |
3885dc2669f9
cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents:
2434
diff
changeset
|
17 |
thm lam.bn_defs |
3885dc2669f9
cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents:
2434
diff
changeset
|
18 |
thm lam.perm_simps |
3885dc2669f9
cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents:
2434
diff
changeset
|
19 |
thm lam.eq_iff |
3885dc2669f9
cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents:
2434
diff
changeset
|
20 |
thm lam.fv_bn_eqvt |
3885dc2669f9
cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents:
2434
diff
changeset
|
21 |
thm lam.size_eqvt |
2431
331873ebc5cd
can now deal with type variables in nominal datatype definitions
Christian Urban <urbanc@in.tum.de>
parents:
2425
diff
changeset
|
22 |
|
2424
621ebd8b13c4
changed parser so that the binding mode is indicated as "bind (list)", "bind (set)" or "bind (res)"; if only "bind" is given, then bind (list) is assumed as default
Christian Urban <urbanc@in.tum.de>
parents:
2311
diff
changeset
|
23 |
|
2082
0854af516f14
cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
parents:
2041
diff
changeset
|
24 |
|
1800
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
25 |
section {* Strong Induction Principles*} |
1594 | 26 |
|
2041
3842464ee03b
Move 2 more to NewParser
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1954
diff
changeset
|
27 |
(* |
1797
fddb470720f1
renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
Christian Urban <urbanc@in.tum.de>
parents:
1773
diff
changeset
|
28 |
Old way of establishing strong induction |
fddb470720f1
renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
Christian Urban <urbanc@in.tum.de>
parents:
1773
diff
changeset
|
29 |
principles by chosing a fresh name. |
fddb470720f1
renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
Christian Urban <urbanc@in.tum.de>
parents:
1773
diff
changeset
|
30 |
*) |
2436
3885dc2669f9
cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents:
2434
diff
changeset
|
31 |
(* |
1594 | 32 |
lemma |
33 |
fixes c::"'a::fs" |
|
1800
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
34 |
assumes a1: "\<And>name c. P c (Var name)" |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
35 |
and a2: "\<And>lam1 lam2 c. \<lbrakk>\<And>d. P d lam1; \<And>d. P d lam2\<rbrakk> \<Longrightarrow> P c (App lam1 lam2)" |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
36 |
and a3: "\<And>name lam c. \<lbrakk>atom name \<sharp> c; \<And>d. P d lam\<rbrakk> \<Longrightarrow> P c (Lam name lam)" |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
37 |
shows "P c lam" |
1594 | 38 |
proof - |
1800
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
39 |
have "\<And>p. P c (p \<bullet> lam)" |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
40 |
apply(induct lam arbitrary: c rule: lam.induct) |
1805 | 41 |
apply(perm_simp) |
1594 | 42 |
apply(rule a1) |
1805 | 43 |
apply(perm_simp) |
1594 | 44 |
apply(rule a2) |
1797
fddb470720f1
renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
Christian Urban <urbanc@in.tum.de>
parents:
1773
diff
changeset
|
45 |
apply(assumption) |
1594 | 46 |
apply(assumption) |
1800
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
47 |
apply(subgoal_tac "\<exists>new::name. (atom new) \<sharp> (c, Lam (p \<bullet> name) (p \<bullet> lam))") |
1594 | 48 |
defer |
49 |
apply(simp add: fresh_def) |
|
1800
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
50 |
apply(rule_tac X="supp (c, Lam (p \<bullet> name) (p \<bullet> lam))" in obtain_at_base) |
1594 | 51 |
apply(simp add: supp_Pair finite_supp) |
52 |
apply(blast) |
|
53 |
apply(erule exE) |
|
1800
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
54 |
apply(rule_tac t="p \<bullet> Lam name lam" and |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
55 |
s="(((p \<bullet> name) \<leftrightarrow> new) + p) \<bullet> Lam name lam" in subst) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
56 |
apply(simp del: lam.perm) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
57 |
apply(subst lam.perm) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
58 |
apply(subst (2) lam.perm) |
1594 | 59 |
apply(rule flip_fresh_fresh) |
60 |
apply(simp add: fresh_def) |
|
61 |
apply(simp only: supp_fn') |
|
62 |
apply(simp) |
|
63 |
apply(simp add: fresh_Pair) |
|
64 |
apply(simp) |
|
65 |
apply(rule a3) |
|
66 |
apply(simp add: fresh_Pair) |
|
67 |
apply(drule_tac x="((p \<bullet> name) \<leftrightarrow> new) + p" in meta_spec) |
|
68 |
apply(simp) |
|
69 |
done |
|
1800
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
70 |
then have "P c (0 \<bullet> lam)" by blast |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
71 |
then show "P c lam" by simp |
1594 | 72 |
qed |
2436
3885dc2669f9
cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents:
2434
diff
changeset
|
73 |
*) |
1797
fddb470720f1
renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
Christian Urban <urbanc@in.tum.de>
parents:
1773
diff
changeset
|
74 |
(* |
fddb470720f1
renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
Christian Urban <urbanc@in.tum.de>
parents:
1773
diff
changeset
|
75 |
New way of establishing strong induction |
fddb470720f1
renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
Christian Urban <urbanc@in.tum.de>
parents:
1773
diff
changeset
|
76 |
principles by using a appropriate permutation. |
fddb470720f1
renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
Christian Urban <urbanc@in.tum.de>
parents:
1773
diff
changeset
|
77 |
*) |
2436
3885dc2669f9
cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents:
2434
diff
changeset
|
78 |
(* |
1594 | 79 |
lemma |
80 |
fixes c::"'a::fs" |
|
1800
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
81 |
assumes a1: "\<And>name c. P c (Var name)" |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
82 |
and a2: "\<And>lam1 lam2 c. \<lbrakk>\<And>d. P d lam1; \<And>d. P d lam2\<rbrakk> \<Longrightarrow> P c (App lam1 lam2)" |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
83 |
and a3: "\<And>name lam c. \<lbrakk>atom name \<sharp> c; \<And>d. P d lam\<rbrakk> \<Longrightarrow> P c (Lam name lam)" |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
84 |
shows "P c lam" |
1594 | 85 |
proof - |
1800
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
86 |
have "\<And>p. P c (p \<bullet> lam)" |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
87 |
apply(induct lam arbitrary: c rule: lam.induct) |
1805 | 88 |
apply(perm_simp) |
1594 | 89 |
apply(rule a1) |
1805 | 90 |
apply(perm_simp) |
1594 | 91 |
apply(rule a2) |
92 |
apply(assumption) |
|
1797
fddb470720f1
renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
Christian Urban <urbanc@in.tum.de>
parents:
1773
diff
changeset
|
93 |
apply(assumption) |
1800
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
94 |
apply(subgoal_tac "\<exists>q. (q \<bullet> {p \<bullet> atom name}) \<sharp>* c \<and> supp (p \<bullet> Lam name lam) \<sharp>* q") |
1594 | 95 |
apply(erule exE) |
1800
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
96 |
apply(rule_tac t="p \<bullet> Lam name lam" and |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
97 |
s="q \<bullet> p \<bullet> Lam name lam" in subst) |
1594 | 98 |
defer |
1805 | 99 |
apply(simp) |
1594 | 100 |
apply(rule a3) |
101 |
apply(simp add: eqvts fresh_star_def) |
|
102 |
apply(drule_tac x="q + p" in meta_spec) |
|
103 |
apply(simp) |
|
1797
fddb470720f1
renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
Christian Urban <urbanc@in.tum.de>
parents:
1773
diff
changeset
|
104 |
apply(rule at_set_avoiding2) |
fddb470720f1
renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
Christian Urban <urbanc@in.tum.de>
parents:
1773
diff
changeset
|
105 |
apply(simp add: finite_supp) |
fddb470720f1
renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
Christian Urban <urbanc@in.tum.de>
parents:
1773
diff
changeset
|
106 |
apply(simp add: finite_supp) |
fddb470720f1
renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
Christian Urban <urbanc@in.tum.de>
parents:
1773
diff
changeset
|
107 |
apply(simp add: finite_supp) |
1805 | 108 |
apply(perm_simp) |
1797
fddb470720f1
renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
Christian Urban <urbanc@in.tum.de>
parents:
1773
diff
changeset
|
109 |
apply(simp add: fresh_star_def fresh_def supp_fn') |
fddb470720f1
renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
Christian Urban <urbanc@in.tum.de>
parents:
1773
diff
changeset
|
110 |
apply(rule supp_perm_eq) |
fddb470720f1
renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
Christian Urban <urbanc@in.tum.de>
parents:
1773
diff
changeset
|
111 |
apply(simp) |
fddb470720f1
renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
Christian Urban <urbanc@in.tum.de>
parents:
1773
diff
changeset
|
112 |
done |
1800
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
113 |
then have "P c (0 \<bullet> lam)" by blast |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
114 |
then show "P c lam" by simp |
1594 | 115 |
qed |
2436
3885dc2669f9
cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents:
2434
diff
changeset
|
116 |
*) |
1594 | 117 |
|
1805 | 118 |
section {* Typing *} |
119 |
||
120 |
nominal_datatype ty = |
|
121 |
TVar string |
|
1810
894930834ca8
fixed bug in thmdecls with destructing Trueprop; some initial infrastructure for eqvt-theorems of the form _ ==> _
Christian Urban <urbanc@in.tum.de>
parents:
1805
diff
changeset
|
122 |
| TFun ty ty |
894930834ca8
fixed bug in thmdecls with destructing Trueprop; some initial infrastructure for eqvt-theorems of the form _ ==> _
Christian Urban <urbanc@in.tum.de>
parents:
1805
diff
changeset
|
123 |
|
894930834ca8
fixed bug in thmdecls with destructing Trueprop; some initial infrastructure for eqvt-theorems of the form _ ==> _
Christian Urban <urbanc@in.tum.de>
parents:
1805
diff
changeset
|
124 |
notation |
894930834ca8
fixed bug in thmdecls with destructing Trueprop; some initial infrastructure for eqvt-theorems of the form _ ==> _
Christian Urban <urbanc@in.tum.de>
parents:
1805
diff
changeset
|
125 |
TFun ("_ \<rightarrow> _") |
894930834ca8
fixed bug in thmdecls with destructing Trueprop; some initial infrastructure for eqvt-theorems of the form _ ==> _
Christian Urban <urbanc@in.tum.de>
parents:
1805
diff
changeset
|
126 |
|
2436
3885dc2669f9
cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents:
2434
diff
changeset
|
127 |
(* |
1810
894930834ca8
fixed bug in thmdecls with destructing Trueprop; some initial infrastructure for eqvt-theorems of the form _ ==> _
Christian Urban <urbanc@in.tum.de>
parents:
1805
diff
changeset
|
128 |
declare ty.perm[eqvt] |
1805 | 129 |
|
130 |
inductive |
|
131 |
valid :: "(name \<times> ty) list \<Rightarrow> bool" |
|
132 |
where |
|
133 |
"valid []" |
|
134 |
| "\<lbrakk>atom x \<sharp> Gamma; valid Gamma\<rbrakk> \<Longrightarrow> valid ((x, T)#Gamma)" |
|
135 |
||
1828 | 136 |
inductive |
137 |
typing :: "(name\<times>ty) list \<Rightarrow> lam \<Rightarrow> ty \<Rightarrow> bool" ("_ \<turnstile> _ : _" [60,60,60] 60) |
|
138 |
where |
|
139 |
t_Var[intro]: "\<lbrakk>valid \<Gamma>; (x, T) \<in> set \<Gamma>\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> Var x : T" |
|
1947 | 140 |
| t_App[intro]: "\<lbrakk>\<Gamma> \<turnstile> t1 : T1 \<rightarrow> T2; \<Gamma> \<turnstile> t2 : T1\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> App t1 t2 : T2" |
1828 | 141 |
| t_Lam[intro]: "\<lbrakk>atom x \<sharp> \<Gamma>; (x, T1) # \<Gamma> \<turnstile> t : T2\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> Lam x t : T1 \<rightarrow> T2" |
142 |
||
1831
16653e702d89
first working version of the automatic equivariance procedure
Christian Urban <urbanc@in.tum.de>
parents:
1828
diff
changeset
|
143 |
equivariance valid |
16653e702d89
first working version of the automatic equivariance procedure
Christian Urban <urbanc@in.tum.de>
parents:
1828
diff
changeset
|
144 |
equivariance typing |
1816
56cebe7f8e24
some small tunings (incompleted work in Lambda.thy)
Christian Urban <urbanc@in.tum.de>
parents:
1814
diff
changeset
|
145 |
|
1831
16653e702d89
first working version of the automatic equivariance procedure
Christian Urban <urbanc@in.tum.de>
parents:
1828
diff
changeset
|
146 |
thm valid.eqvt |
16653e702d89
first working version of the automatic equivariance procedure
Christian Urban <urbanc@in.tum.de>
parents:
1828
diff
changeset
|
147 |
thm typing.eqvt |
1811
ae176476b525
implemented in thmdecls the case where eqvt-lemmas are of the form _ ==> _
Christian Urban <urbanc@in.tum.de>
parents:
1810
diff
changeset
|
148 |
thm eqvts |
ae176476b525
implemented in thmdecls the case where eqvt-lemmas are of the form _ ==> _
Christian Urban <urbanc@in.tum.de>
parents:
1810
diff
changeset
|
149 |
thm eqvts_raw |
ae176476b525
implemented in thmdecls the case where eqvt-lemmas are of the form _ ==> _
Christian Urban <urbanc@in.tum.de>
parents:
1810
diff
changeset
|
150 |
|
1949
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
151 |
thm typing.induct[of "\<Gamma>" "t" "T", no_vars] |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
152 |
|
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
153 |
lemma |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
154 |
fixes c::"'a::fs" |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
155 |
assumes a: "\<Gamma> \<turnstile> t : T" |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
156 |
and a1: "\<And>\<Gamma> x T c. \<lbrakk>valid \<Gamma>; (x, T) \<in> set \<Gamma>\<rbrakk> \<Longrightarrow> P c \<Gamma> (Var x) T" |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
157 |
and a2: "\<And>\<Gamma> t1 T1 T2 t2 c. \<lbrakk>\<Gamma> \<turnstile> t1 : T1 \<rightarrow> T2; \<And>d. P d \<Gamma> t1 T1 \<rightarrow> T2; \<Gamma> \<turnstile> t2 : T1; \<And>d. P d \<Gamma> t2 T1\<rbrakk> |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
158 |
\<Longrightarrow> P c \<Gamma> (App t1 t2) T2" |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
159 |
and a3: "\<And>x \<Gamma> T1 t T2 c. \<lbrakk>atom x \<sharp> c; atom x \<sharp> \<Gamma>; (x, T1) # \<Gamma> \<turnstile> t : T2; \<And>d. P d ((x, T1) # \<Gamma>) t T2\<rbrakk> |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
160 |
\<Longrightarrow> P c \<Gamma> (Lam x t) T1 \<rightarrow> T2" |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
161 |
shows "P c \<Gamma> t T" |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
162 |
proof - |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
163 |
from a have "\<And>p c. P c (p \<bullet> \<Gamma>) (p \<bullet> t) (p \<bullet> T)" |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
164 |
proof (induct) |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
165 |
case (t_Var \<Gamma> x T p c) |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
166 |
then show ?case |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
167 |
apply - |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
168 |
apply(perm_strict_simp) |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
169 |
apply(rule a1) |
1954
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
170 |
apply(drule_tac p="p" in permute_boolI) |
1949
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
171 |
apply(perm_strict_simp add: permute_minus_cancel) |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
172 |
apply(assumption) |
1954
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
173 |
apply(rotate_tac 1) |
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
174 |
apply(drule_tac p="p" in permute_boolI) |
1949
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
175 |
apply(perm_strict_simp add: permute_minus_cancel) |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
176 |
apply(assumption) |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
177 |
done |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
178 |
next |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
179 |
case (t_App \<Gamma> t1 T1 T2 t2 p c) |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
180 |
then show ?case |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
181 |
apply - |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
182 |
apply(perm_strict_simp) |
1954
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
183 |
apply(rule a2) |
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
184 |
apply(drule_tac p="p" in permute_boolI) |
1949
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
185 |
apply(perm_strict_simp add: permute_minus_cancel) |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
186 |
apply(assumption) |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
187 |
apply(assumption) |
1954
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
188 |
apply(rotate_tac 2) |
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
189 |
apply(drule_tac p="p" in permute_boolI) |
1949
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
190 |
apply(perm_strict_simp add: permute_minus_cancel) |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
191 |
apply(assumption) |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
192 |
apply(assumption) |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
193 |
done |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
194 |
next |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
195 |
case (t_Lam x \<Gamma> T1 t T2 p c) |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
196 |
then show ?case |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
197 |
apply - |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
198 |
apply(subgoal_tac "\<exists>q. (q \<bullet> {p \<bullet> atom x}) \<sharp>* c \<and> |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
199 |
supp (p \<bullet> \<Gamma>, p \<bullet> Lam x t, p \<bullet> (T1 \<rightarrow> T2)) \<sharp>* q") |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
200 |
apply(erule exE) |
1954
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
201 |
apply(rule_tac t="p \<bullet> \<Gamma>" and s="(q + p) \<bullet> \<Gamma>" in subst) |
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
202 |
apply(simp only: permute_plus) |
1949
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
203 |
apply(rule supp_perm_eq) |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
204 |
apply(simp add: supp_Pair fresh_star_union) |
1954
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
205 |
apply(rule_tac t="p \<bullet> Lam x t" and s="(q + p) \<bullet> Lam x t" in subst) |
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
206 |
apply(simp only: permute_plus) |
1949
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
207 |
apply(rule supp_perm_eq) |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
208 |
apply(simp add: supp_Pair fresh_star_union) |
1954
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
209 |
apply(rule_tac t="p \<bullet> (T1 \<rightarrow> T2)" and s="(q + p) \<bullet> (T1 \<rightarrow> T2)" in subst) |
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
210 |
apply(simp only: permute_plus) |
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
211 |
apply(rule supp_perm_eq) |
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
212 |
apply(simp add: supp_Pair fresh_star_union) |
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
213 |
apply(simp (no_asm) only: eqvts) |
1949
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
214 |
apply(rule a3) |
1954
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
215 |
apply(simp only: eqvts permute_plus) |
1949
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
216 |
apply(simp add: fresh_star_def) |
1954
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
217 |
apply(drule_tac p="q + p" in permute_boolI) |
1949
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
218 |
apply(perm_strict_simp add: permute_minus_cancel) |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
219 |
apply(assumption) |
1954
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
220 |
apply(rotate_tac 1) |
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
221 |
apply(drule_tac p="q + p" in permute_boolI) |
1949
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
222 |
apply(perm_strict_simp add: permute_minus_cancel) |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
223 |
apply(assumption) |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
224 |
apply(drule_tac x="d" in meta_spec) |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
225 |
apply(drule_tac x="q + p" in meta_spec) |
1954
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
226 |
apply(perm_strict_simp add: permute_minus_cancel) |
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
227 |
apply(assumption) |
1949
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
228 |
apply(rule at_set_avoiding2) |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
229 |
apply(simp add: finite_supp) |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
230 |
apply(simp add: finite_supp) |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
231 |
apply(simp add: finite_supp) |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
232 |
apply(rule_tac p="-p" in permute_boolE) |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
233 |
apply(perm_strict_simp add: permute_minus_cancel) |
2436
3885dc2669f9
cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents:
2434
diff
changeset
|
234 |
--"supplied by the user" |
1949
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
235 |
apply(simp add: fresh_star_prod) |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
236 |
apply(simp add: fresh_star_def) |
1954
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
237 |
sorry |
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
238 |
qed |
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
239 |
then have "P c (0 \<bullet> \<Gamma>) (0 \<bullet> t) (0 \<bullet> T)" . |
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
240 |
then show "P c \<Gamma> t T" by simp |
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
241 |
qed |
1949
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
242 |
|
1833
2050b5723c04
added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
1831
diff
changeset
|
243 |
*) |
2050b5723c04
added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
1831
diff
changeset
|
244 |
|
1810
894930834ca8
fixed bug in thmdecls with destructing Trueprop; some initial infrastructure for eqvt-theorems of the form _ ==> _
Christian Urban <urbanc@in.tum.de>
parents:
1805
diff
changeset
|
245 |
|
1800
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
246 |
section {* Matching *} |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
247 |
|
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
248 |
definition |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
249 |
MATCH :: "('c::pt \<Rightarrow> (bool * 'a::pt * 'b::pt)) \<Rightarrow> 'b \<Rightarrow> 'a \<Rightarrow> 'b" |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
250 |
where |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
251 |
"MATCH M d x \<equiv> if (\<exists>!r. \<exists>q. M q = (True, x, r)) then (THE r. \<exists>q. M q = (True, x, r)) else d" |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
252 |
|
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
253 |
(* |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
254 |
lemma MATCH_eqvt: |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
255 |
shows "p \<bullet> (MATCH M d x) = MATCH (p \<bullet> M) (p \<bullet> d) (p \<bullet> x)" |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
256 |
unfolding MATCH_def |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
257 |
apply(perm_simp the_eqvt) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
258 |
apply (tactic {* Nominal_Permeq.eqvt_tac @{context} 1 *}) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
259 |
apply(simp) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
260 |
thm eqvts_raw |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
261 |
apply(subst if_eqvt) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
262 |
apply(subst ex1_eqvt) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
263 |
apply(subst permute_fun_def) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
264 |
apply(subst ex_eqvt) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
265 |
apply(subst permute_fun_def) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
266 |
apply(subst eq_eqvt) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
267 |
apply(subst permute_fun_app_eq[where f="M"]) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
268 |
apply(simp only: permute_minus_cancel) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
269 |
apply(subst permute_prod.simps) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
270 |
apply(subst permute_prod.simps) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
271 |
apply(simp only: permute_minus_cancel) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
272 |
apply(simp only: permute_bool_def) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
273 |
apply(simp) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
274 |
apply(subst ex1_eqvt) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
275 |
apply(subst permute_fun_def) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
276 |
apply(subst ex_eqvt) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
277 |
apply(subst permute_fun_def) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
278 |
apply(subst eq_eqvt) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
279 |
|
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
280 |
apply(simp only: eqvts) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
281 |
apply(simp) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
282 |
apply(subgoal_tac "(p \<bullet> (\<exists>!r. \<exists>q. M q = (True, x, r))) = (\<exists>!r. \<exists>q. (p \<bullet> M) q = (True, p \<bullet> x, r))") |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
283 |
apply(drule sym) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
284 |
apply(simp) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
285 |
apply(rule impI) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
286 |
apply(simp add: perm_bool) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
287 |
apply(rule trans) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
288 |
apply(rule pt_the_eqvt[OF pta at]) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
289 |
apply(assumption) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
290 |
apply(simp add: pt_ex_eqvt[OF pt at]) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
291 |
apply(simp add: pt_eq_eqvt[OF ptb at]) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
292 |
apply(rule cheat) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
293 |
apply(rule trans) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
294 |
apply(rule pt_ex1_eqvt) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
295 |
apply(rule pta) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
296 |
apply(rule at) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
297 |
apply(simp add: pt_ex_eqvt[OF pt at]) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
298 |
apply(simp add: pt_eq_eqvt[OF ptb at]) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
299 |
apply(subst pt_pi_rev[OF pta at]) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
300 |
apply(subst pt_fun_app_eq[OF pt at]) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
301 |
apply(subst pt_pi_rev[OF pt at]) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
302 |
apply(simp) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
303 |
done |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
304 |
|
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
305 |
lemma MATCH_cng: |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
306 |
assumes a: "M1 = M2" "d1 = d2" |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
307 |
shows "MATCH M1 d1 x = MATCH M2 d2 x" |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
308 |
using a by simp |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
309 |
|
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
310 |
lemma MATCH_eq: |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
311 |
assumes a: "t = l x" "G x" "\<And>x'. t = l x' \<Longrightarrow> G x' \<Longrightarrow> r x' = r x" |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
312 |
shows "MATCH (\<lambda>x. (G x, l x, r x)) d t = r x" |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
313 |
using a |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
314 |
unfolding MATCH_def |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
315 |
apply(subst if_P) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
316 |
apply(rule_tac a="r x" in ex1I) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
317 |
apply(rule_tac x="x" in exI) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
318 |
apply(blast) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
319 |
apply(erule exE) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
320 |
apply(drule_tac x="q" in meta_spec) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
321 |
apply(auto)[1] |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
322 |
apply(rule the_equality) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
323 |
apply(blast) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
324 |
apply(erule exE) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
325 |
apply(drule_tac x="q" in meta_spec) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
326 |
apply(auto)[1] |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
327 |
done |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
328 |
|
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
329 |
lemma MATCH_eq2: |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
330 |
assumes a: "t = l x1 x2" "G x1 x2" "\<And>x1' x2'. t = l x1' x2' \<Longrightarrow> G x1' x2' \<Longrightarrow> r x1' x2' = r x1 x2" |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
331 |
shows "MATCH (\<lambda>(x1,x2). (G x1 x2, l x1 x2, r x1 x2)) d t = r x1 x2" |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
332 |
sorry |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
333 |
|
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
334 |
lemma MATCH_neq: |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
335 |
assumes a: "\<And>x. t = l x \<Longrightarrow> G x \<Longrightarrow> False" |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
336 |
shows "MATCH (\<lambda>x. (G x, l x, r x)) d t = d" |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
337 |
using a |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
338 |
unfolding MATCH_def |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
339 |
apply(subst if_not_P) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
340 |
apply(blast) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
341 |
apply(rule refl) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
342 |
done |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
343 |
|
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
344 |
lemma MATCH_neq2: |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
345 |
assumes a: "\<And>x1 x2. t = l x1 x2 \<Longrightarrow> G x1 x2 \<Longrightarrow> False" |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
346 |
shows "MATCH (\<lambda>(x1,x2). (G x1 x2, l x1 x2, r x1 x2)) d t = d" |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
347 |
using a |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
348 |
unfolding MATCH_def |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
349 |
apply(subst if_not_P) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
350 |
apply(auto) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
351 |
done |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
352 |
*) |
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
353 |
|
1954
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
354 |
ML {* |
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
355 |
fun mk_avoids ctxt params name set = |
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
356 |
let |
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
357 |
val (_, ctxt') = ProofContext.add_fixes |
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
358 |
(map (fn (s, T) => (Binding.name s, SOME T, NoSyn)) params) ctxt; |
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
359 |
fun mk s = |
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
360 |
let |
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
361 |
val t = Syntax.read_term ctxt' s; |
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
362 |
val t' = list_abs_free (params, t) |> |
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
363 |
funpow (length params) (fn Abs (_, _, t) => t) |
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
364 |
in (t', HOLogic.dest_setT (fastype_of t)) end |
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
365 |
handle TERM _ => |
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
366 |
error ("Expression " ^ quote s ^ " to be avoided in case " ^ |
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
367 |
quote name ^ " is not a set type"); |
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
368 |
fun add_set p [] = [p] |
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
369 |
| add_set (t, T) ((u, U) :: ps) = |
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
370 |
if T = U then |
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
371 |
let val S = HOLogic.mk_setT T |
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
372 |
in (Const (@{const_name sup}, S --> S --> S) $ u $ t, T) :: ps |
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
373 |
end |
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
374 |
else (u, U) :: add_set (t, T) ps |
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
375 |
in |
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
376 |
(mk #> add_set) set |
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
377 |
end; |
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
378 |
*} |
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
379 |
|
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
380 |
|
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
381 |
ML {* |
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
382 |
writeln (commas (map (Syntax.string_of_term @{context} o fst) |
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
383 |
(mk_avoids @{context} [] "t_Var" "{x}" []))) |
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
384 |
*} |
23480003f9c5
some changes to the paper
Christian Urban <urbanc@in.tum.de>
parents:
1950
diff
changeset
|
385 |
|
1947 | 386 |
|
1949
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
387 |
ML {* |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
388 |
|
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
389 |
fun prove_strong_ind (pred_name, avoids) ctxt = |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
390 |
Proof.theorem NONE (K I) [] ctxt |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
391 |
|
2169 | 392 |
local structure P = Parse and K = Keyword in |
1949
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
393 |
|
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
394 |
val _ = |
2169 | 395 |
Outer_Syntax.local_theory_to_proof "nominal_inductive" |
1949
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
396 |
"proves strong induction theorem for inductive predicate involving nominal datatypes" K.thy_goal |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
397 |
(P.xname -- (Scan.optional (P.$$$ "avoids" |-- P.enum1 "|" (P.name -- |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
398 |
(P.$$$ ":" |-- P.and_list1 P.term))) []) >> prove_strong_ind) |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
399 |
|
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
400 |
end; |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
401 |
|
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
402 |
*} |
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
403 |
|
1950
7de54c9f81ac
eliminated command so that all compiles
Christian Urban <urbanc@in.tum.de>
parents:
1949
diff
changeset
|
404 |
(* |
1949
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
405 |
nominal_inductive typing |
1950
7de54c9f81ac
eliminated command so that all compiles
Christian Urban <urbanc@in.tum.de>
parents:
1949
diff
changeset
|
406 |
*) |
1949
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
1947
diff
changeset
|
407 |
|
2157 | 408 |
(* Substitution *) |
2159
ce00205e07ab
Single variable substitution
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2158
diff
changeset
|
409 |
|
2165 | 410 |
primrec match_Var_raw where |
411 |
"match_Var_raw (Var_raw x) = Some x" |
|
412 |
| "match_Var_raw (App_raw x y) = None" |
|
413 |
| "match_Var_raw (Lam_raw n t) = None" |
|
414 |
||
415 |
quotient_definition |
|
416 |
"match_Var :: lam \<Rightarrow> name option" |
|
417 |
is match_Var_raw |
|
418 |
||
419 |
lemma [quot_respect]: "(alpha_lam_raw ===> op =) match_Var_raw match_Var_raw" |
|
420 |
apply rule |
|
421 |
apply (induct_tac a b rule: alpha_lam_raw.induct) |
|
422 |
apply simp_all |
|
423 |
done |
|
424 |
||
425 |
lemmas match_Var_simps = match_Var_raw.simps[quot_lifted] |
|
426 |
||
427 |
primrec match_App_raw where |
|
428 |
"match_App_raw (Var_raw x) = None" |
|
429 |
| "match_App_raw (App_raw x y) = Some (x, y)" |
|
430 |
| "match_App_raw (Lam_raw n t) = None" |
|
431 |
||
2436
3885dc2669f9
cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents:
2434
diff
changeset
|
432 |
(* |
2165 | 433 |
quotient_definition |
434 |
"match_App :: lam \<Rightarrow> (lam \<times> lam) option" |
|
435 |
is match_App_raw |
|
436 |
||
437 |
lemma [quot_respect]: |
|
438 |
"(alpha_lam_raw ===> option_rel (prod_rel alpha_lam_raw alpha_lam_raw)) match_App_raw match_App_raw" |
|
439 |
apply (intro fun_relI) |
|
440 |
apply (induct_tac a b rule: alpha_lam_raw.induct) |
|
441 |
apply simp_all |
|
442 |
done |
|
443 |
||
444 |
lemmas match_App_simps = match_App_raw.simps[quot_lifted] |
|
445 |
||
2173
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
446 |
definition new where |
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
447 |
"new (s :: 'a :: fs) = (THE x. \<forall>a \<in> supp s. atom x \<noteq> a)" |
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
448 |
|
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
449 |
definition |
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
450 |
"match_Lam (S :: 'a :: fs) t = (if (\<exists>n s. (t = Lam n s)) then |
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
451 |
(let z = new (S, t) in Some (z, THE s. t = Lam z s)) else None)" |
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
452 |
|
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
453 |
lemma lam_half_inj: "(Lam z s = Lam z sa) = (s = sa)" |
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
454 |
apply auto |
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
455 |
apply (simp only: lam.eq_iff alphas) |
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
456 |
apply clarify |
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
457 |
apply (simp add: eqvts) |
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
458 |
sorry |
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
459 |
|
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
460 |
lemma match_Lam_simps: |
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
461 |
"match_Lam S (Var n) = None" |
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
462 |
"match_Lam S (App l r) = None" |
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
463 |
"z = new (S, (Lam z s)) \<Longrightarrow> match_Lam S (Lam z s) = Some (z, s)" |
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
464 |
apply (simp_all add: match_Lam_def) |
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
465 |
apply (simp add: lam_half_inj) |
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
466 |
apply auto |
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
467 |
done |
2436
3885dc2669f9
cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents:
2434
diff
changeset
|
468 |
*) |
2173
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
469 |
(* |
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
470 |
lemma match_Lam_simps2: |
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
471 |
"atom n \<sharp> ((S :: 'a :: fs), Lam n s) \<Longrightarrow> match_Lam S (Lam n s) = Some (n, s)" |
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
472 |
apply (rule_tac t="Lam n s" |
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
473 |
and s="Lam (new (S, (Lam n s))) ((n \<leftrightarrow> (new (S, (Lam n s)))) \<bullet> s)" in subst) |
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
474 |
defer |
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
475 |
apply (subst match_Lam_simps(3)) |
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
476 |
defer |
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
477 |
apply simp |
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
478 |
*) |
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
479 |
|
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
480 |
(*primrec match_Lam_raw where |
2165 | 481 |
"match_Lam_raw (S :: atom set) (Var_raw x) = None" |
482 |
| "match_Lam_raw S (App_raw x y) = None" |
|
483 |
| "match_Lam_raw S (Lam_raw n t) = (let z = new (S \<union> (fv_lam_raw t - {atom n})) in Some (z, (n \<leftrightarrow> z) \<bullet> t))" |
|
484 |
||
485 |
quotient_definition |
|
486 |
"match_Lam :: (atom set) \<Rightarrow> lam \<Rightarrow> (name \<times> lam) option" |
|
487 |
is match_Lam_raw |
|
488 |
||
2172
fd5eec72c3f5
More on Function-defined subst.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2170
diff
changeset
|
489 |
lemma swap_fresh: |
fd5eec72c3f5
More on Function-defined subst.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2170
diff
changeset
|
490 |
assumes a: "fv_lam_raw t \<sharp>* p" |
fd5eec72c3f5
More on Function-defined subst.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2170
diff
changeset
|
491 |
shows "alpha_lam_raw (p \<bullet> t) t" |
fd5eec72c3f5
More on Function-defined subst.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2170
diff
changeset
|
492 |
using a apply (induct t) |
fd5eec72c3f5
More on Function-defined subst.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2170
diff
changeset
|
493 |
apply (simp add: supp_at_base fresh_star_def) |
fd5eec72c3f5
More on Function-defined subst.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2170
diff
changeset
|
494 |
apply (rule alpha_lam_raw.intros) |
fd5eec72c3f5
More on Function-defined subst.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2170
diff
changeset
|
495 |
apply (metis Rep_name_inverse atom_eqvt atom_name_def fresh_perm) |
fd5eec72c3f5
More on Function-defined subst.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2170
diff
changeset
|
496 |
apply (simp) |
fd5eec72c3f5
More on Function-defined subst.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2170
diff
changeset
|
497 |
apply (simp only: fresh_star_union) |
fd5eec72c3f5
More on Function-defined subst.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2170
diff
changeset
|
498 |
apply clarify |
fd5eec72c3f5
More on Function-defined subst.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2170
diff
changeset
|
499 |
apply (rule alpha_lam_raw.intros) |
fd5eec72c3f5
More on Function-defined subst.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2170
diff
changeset
|
500 |
apply simp |
fd5eec72c3f5
More on Function-defined subst.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2170
diff
changeset
|
501 |
apply simp |
fd5eec72c3f5
More on Function-defined subst.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2170
diff
changeset
|
502 |
apply simp |
fd5eec72c3f5
More on Function-defined subst.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2170
diff
changeset
|
503 |
apply (rule alpha_lam_raw.intros) |
fd5eec72c3f5
More on Function-defined subst.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2170
diff
changeset
|
504 |
sorry |
fd5eec72c3f5
More on Function-defined subst.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2170
diff
changeset
|
505 |
|
2165 | 506 |
lemma [quot_respect]: |
507 |
"(op = ===> alpha_lam_raw ===> option_rel (prod_rel op = alpha_lam_raw)) match_Lam_raw match_Lam_raw" |
|
508 |
proof (intro fun_relI, clarify) |
|
509 |
fix S t s |
|
510 |
assume a: "alpha_lam_raw t s" |
|
511 |
show "option_rel (prod_rel op = alpha_lam_raw) (match_Lam_raw S t) (match_Lam_raw S s)" |
|
512 |
using a proof (induct t s rule: alpha_lam_raw.induct) |
|
513 |
case goal1 show ?case by simp |
|
514 |
next |
|
515 |
case goal2 show ?case by simp |
|
516 |
next |
|
517 |
case (goal3 x t y s) |
|
518 |
then obtain p where "({atom x}, t) \<approx>gen (\<lambda>x1 x2. alpha_lam_raw x1 x2 \<and> |
|
519 |
option_rel (prod_rel op = alpha_lam_raw) (match_Lam_raw S x1) |
|
520 |
(match_Lam_raw S x2)) fv_lam_raw p ({atom y}, s)" .. |
|
521 |
then have |
|
522 |
c: "fv_lam_raw t - {atom x} = fv_lam_raw s - {atom y}" and |
|
523 |
d: "(fv_lam_raw t - {atom x}) \<sharp>* p" and |
|
524 |
e: "alpha_lam_raw (p \<bullet> t) s" and |
|
525 |
f: "option_rel (prod_rel op = alpha_lam_raw) (match_Lam_raw S (p \<bullet> t)) (match_Lam_raw S s)" and |
|
526 |
g: "p \<bullet> {atom x} = {atom y}" unfolding alphas(1) by - (elim conjE, assumption)+ |
|
527 |
let ?z = "new (S \<union> (fv_lam_raw t - {atom x}))" |
|
528 |
have h: "?z = new (S \<union> (fv_lam_raw s - {atom y}))" using c by simp |
|
529 |
show ?case |
|
530 |
unfolding match_Lam_raw.simps Let_def option_rel.simps prod_rel.simps split_conv |
|
531 |
proof |
|
532 |
show "?z = new (S \<union> (fv_lam_raw s - {atom y}))" by (fact h) |
|
533 |
next |
|
534 |
have "atom y \<sharp> p" sorry |
|
535 |
have "fv_lam_raw t \<sharp>* ((x \<leftrightarrow> y) \<bullet> p)" sorry |
|
2172
fd5eec72c3f5
More on Function-defined subst.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2170
diff
changeset
|
536 |
then have "alpha_lam_raw (((x \<leftrightarrow> y) \<bullet> p) \<bullet> t) t" using swap_fresh by auto |
fd5eec72c3f5
More on Function-defined subst.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2170
diff
changeset
|
537 |
then have "alpha_lam_raw (p \<bullet> t) ((x \<leftrightarrow> y) \<bullet> t)" sorry |
2165 | 538 |
have "alpha_lam_raw t ((x \<leftrightarrow> y) \<bullet> s)" sorry |
539 |
then have "alpha_lam_raw ((x \<leftrightarrow> ?z) \<bullet> t) ((y \<leftrightarrow> ?z) \<bullet> s)" using eqvts(15) sorry |
|
540 |
then show "alpha_lam_raw ((x \<leftrightarrow> new (S \<union> (fv_lam_raw t - {atom x}))) \<bullet> t) |
|
541 |
((y \<leftrightarrow> new (S \<union> (fv_lam_raw s - {atom y}))) \<bullet> s)" unfolding h . |
|
542 |
qed |
|
543 |
qed |
|
544 |
qed |
|
545 |
||
546 |
lemmas match_Lam_simps = match_Lam_raw.simps[quot_lifted] |
|
2173
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
547 |
*) |
2436
3885dc2669f9
cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents:
2434
diff
changeset
|
548 |
(* |
2165 | 549 |
lemma app_some: "match_App x = Some (a, b) \<Longrightarrow> x = App a b" |
550 |
by (induct x rule: lam.induct) (simp_all add: match_App_simps) |
|
551 |
||
552 |
lemma lam_some: "match_Lam S x = Some (z, s) \<Longrightarrow> x = Lam z s \<and> atom z \<sharp> S" |
|
553 |
apply (induct x rule: lam.induct) |
|
554 |
apply (simp_all add: match_Lam_simps) |
|
2173
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
555 |
apply (thin_tac "match_Lam S lam = Some (z, s) \<Longrightarrow> lam = Lam z s \<and> atom z \<sharp> S") |
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
556 |
apply (simp add: match_Lam_def) |
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
557 |
apply (subgoal_tac "\<exists>n s. Lam name lam = Lam n s") |
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
558 |
prefer 2 |
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
559 |
apply auto[1] |
2165 | 560 |
apply (simp add: Let_def) |
2173
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
561 |
apply (thin_tac "\<exists>n s. Lam name lam = Lam n s") |
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
562 |
apply clarify |
2165 | 563 |
apply (rule conjI) |
2173
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
564 |
apply (rule_tac t="THE s. Lam name lam = Lam (new (S, Lam name lam)) s" and |
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
565 |
s="(name \<leftrightarrow> (new (S, Lam name lam))) \<bullet> lam" in subst) |
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
566 |
defer |
2165 | 567 |
apply (simp add: lam.eq_iff) |
2173
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
568 |
apply (rule_tac x="(name \<leftrightarrow> (new (S, Lam name lam)))" in exI) |
2165 | 569 |
apply (simp add: alphas) |
570 |
apply (simp add: eqvts) |
|
2173
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
571 |
apply (rule conjI) |
2172
fd5eec72c3f5
More on Function-defined subst.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2170
diff
changeset
|
572 |
sorry |
2165 | 573 |
|
574 |
function subst where |
|
575 |
"subst v s t = ( |
|
576 |
case match_Var t of Some n \<Rightarrow> if n = v then s else Var n | None \<Rightarrow> |
|
577 |
case match_App t of Some (l, r) \<Rightarrow> App (subst v s l) (subst v s r) | None \<Rightarrow> |
|
2173
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
578 |
case match_Lam (v,s) t of Some (n, t) \<Rightarrow> Lam n (subst v s t) | None \<Rightarrow> undefined)" |
2165 | 579 |
by pat_completeness auto |
580 |
||
581 |
termination apply (relation "measure (\<lambda>(_, _, t). size t)") |
|
2172
fd5eec72c3f5
More on Function-defined subst.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2170
diff
changeset
|
582 |
apply auto[1] |
fd5eec72c3f5
More on Function-defined subst.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2170
diff
changeset
|
583 |
apply (case_tac a) apply simp |
fd5eec72c3f5
More on Function-defined subst.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2170
diff
changeset
|
584 |
apply (frule lam_some) apply simp |
fd5eec72c3f5
More on Function-defined subst.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2170
diff
changeset
|
585 |
apply (case_tac a) apply simp |
fd5eec72c3f5
More on Function-defined subst.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2170
diff
changeset
|
586 |
apply (frule app_some) apply simp |
fd5eec72c3f5
More on Function-defined subst.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2170
diff
changeset
|
587 |
apply (case_tac a) apply simp |
fd5eec72c3f5
More on Function-defined subst.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2170
diff
changeset
|
588 |
apply (frule app_some) apply simp |
2165 | 589 |
done |
590 |
||
591 |
lemmas lam_exhaust = lam_raw.exhaust[quot_lifted] |
|
592 |
||
593 |
lemma subst_eqvt: |
|
594 |
"p \<bullet> (subst v s t) = subst (p \<bullet> v) (p \<bullet> s) (p \<bullet> t)" |
|
595 |
proof (induct v s t rule: subst.induct) |
|
596 |
case (1 v s t) |
|
597 |
show ?case proof (cases t rule: lam_exhaust) |
|
598 |
fix n |
|
599 |
assume "t = Var n" |
|
600 |
then show ?thesis by (simp add: match_Var_simps) |
|
601 |
next |
|
602 |
fix l r |
|
603 |
assume "t = App l r" |
|
604 |
then show ?thesis |
|
605 |
apply (simp only:) |
|
606 |
apply (subst subst.simps) |
|
607 |
apply (subst match_Var_simps) |
|
608 |
apply (simp only: option.cases) |
|
609 |
apply (subst match_App_simps) |
|
610 |
apply (simp only: option.cases) |
|
611 |
apply (simp only: prod.cases) |
|
612 |
apply (simp only: lam.perm) |
|
613 |
apply (subst (3) subst.simps) |
|
614 |
apply (subst match_Var_simps) |
|
2173
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
615 |
apply (simp only: option.cases) |
2165 | 616 |
apply (subst match_App_simps) |
617 |
apply (simp only: option.cases) |
|
618 |
apply (simp only: prod.cases) |
|
619 |
apply (subst 1(2)[of "(l, r)" "l" "r"]) |
|
620 |
apply (simp add: match_Var_simps) |
|
621 |
apply (simp add: match_App_simps) |
|
622 |
apply (rule refl) |
|
623 |
apply (subst 1(3)[of "(l, r)" "l" "r"]) |
|
624 |
apply (simp add: match_Var_simps) |
|
625 |
apply (simp add: match_App_simps) |
|
626 |
apply (rule refl) |
|
627 |
apply (rule refl) |
|
628 |
done |
|
629 |
next |
|
630 |
fix n t' |
|
631 |
assume "t = Lam n t'" |
|
632 |
then show ?thesis |
|
633 |
apply (simp only: ) |
|
634 |
apply (simp only: lam.perm) |
|
635 |
apply (subst subst.simps) |
|
636 |
apply (subst match_Var_simps) |
|
637 |
apply (simp only: option.cases) |
|
638 |
apply (subst match_App_simps) |
|
639 |
apply (simp only: option.cases) |
|
2173
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
640 |
apply (rule_tac t="Lam n t'" and s="Lam (new ((v, s), Lam n t')) ((n \<leftrightarrow> new ((v, s), Lam n t')) \<bullet> t')" in subst) |
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
641 |
defer |
2165 | 642 |
apply (subst match_Lam_simps) |
2173
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
643 |
defer |
2165 | 644 |
apply (simp only: option.cases) |
645 |
apply (simp only: prod.cases) |
|
646 |
apply (subst (2) subst.simps) |
|
647 |
apply (subst match_Var_simps) |
|
648 |
apply (simp only: option.cases) |
|
649 |
apply (subst match_App_simps) |
|
650 |
apply (simp only: option.cases) |
|
2173
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
651 |
apply (rule_tac t="Lam (p \<bullet> n) (p \<bullet> t')" and s="Lam (new ((p \<bullet> v, p \<bullet> s), Lam (p \<bullet> n) (p \<bullet> t'))) (((p \<bullet> n) \<leftrightarrow> new ((p \<bullet> v, p \<bullet> s), Lam (p \<bullet> n) (p \<bullet> t'))) \<bullet> t')" in subst) |
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
652 |
defer |
2165 | 653 |
apply (subst match_Lam_simps) |
2173
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
654 |
defer |
2165 | 655 |
apply (simp only: option.cases) |
656 |
apply (simp only: prod.cases) |
|
657 |
apply (simp only: lam.perm) |
|
2173
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
658 |
thm 1(1) |
2165 | 659 |
sorry |
660 |
qed |
|
661 |
qed |
|
662 |
||
2172
fd5eec72c3f5
More on Function-defined subst.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2170
diff
changeset
|
663 |
lemma subst_proper_eqs: |
fd5eec72c3f5
More on Function-defined subst.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2170
diff
changeset
|
664 |
"subst y s (Var x) = (if x = y then s else (Var x))" |
fd5eec72c3f5
More on Function-defined subst.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2170
diff
changeset
|
665 |
"subst y s (App l r) = App (subst y s l) (subst y s r)" |
fd5eec72c3f5
More on Function-defined subst.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2170
diff
changeset
|
666 |
"atom x \<sharp> (t, s) \<Longrightarrow> subst y s (Lam x t) = Lam x (subst y s t)" |
fd5eec72c3f5
More on Function-defined subst.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2170
diff
changeset
|
667 |
apply (subst subst.simps) |
fd5eec72c3f5
More on Function-defined subst.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2170
diff
changeset
|
668 |
apply (simp only: match_Var_simps) |
fd5eec72c3f5
More on Function-defined subst.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2170
diff
changeset
|
669 |
apply (simp only: option.simps) |
fd5eec72c3f5
More on Function-defined subst.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2170
diff
changeset
|
670 |
apply (subst subst.simps) |
fd5eec72c3f5
More on Function-defined subst.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2170
diff
changeset
|
671 |
apply (simp only: match_App_simps) |
fd5eec72c3f5
More on Function-defined subst.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2170
diff
changeset
|
672 |
apply (simp only: option.simps) |
fd5eec72c3f5
More on Function-defined subst.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2170
diff
changeset
|
673 |
apply (simp only: prod.simps) |
fd5eec72c3f5
More on Function-defined subst.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2170
diff
changeset
|
674 |
apply (simp only: match_Var_simps) |
fd5eec72c3f5
More on Function-defined subst.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2170
diff
changeset
|
675 |
apply (simp only: option.simps) |
fd5eec72c3f5
More on Function-defined subst.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2170
diff
changeset
|
676 |
apply (subst subst.simps) |
fd5eec72c3f5
More on Function-defined subst.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2170
diff
changeset
|
677 |
apply (simp only: match_Var_simps) |
2173
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
678 |
apply (simp only: option.simps) |
2172
fd5eec72c3f5
More on Function-defined subst.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2170
diff
changeset
|
679 |
apply (simp only: match_App_simps) |
fd5eec72c3f5
More on Function-defined subst.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2170
diff
changeset
|
680 |
apply (simp only: option.simps) |
2173
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
681 |
apply (rule_tac t="Lam x t" and s="Lam (new ((y, s), Lam x t)) ((x \<leftrightarrow> new ((y, s), Lam x t)) \<bullet> t)" in subst) |
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
682 |
defer |
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
683 |
apply (subst match_Lam_simps) |
477293d841e8
Match_Lam defined on Quotient Level.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2172
diff
changeset
|
684 |
defer |
2172
fd5eec72c3f5
More on Function-defined subst.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2170
diff
changeset
|
685 |
apply (simp only: option.simps) |
fd5eec72c3f5
More on Function-defined subst.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2170
diff
changeset
|
686 |
apply (simp only: prod.simps) |
2157 | 687 |
sorry |
2436
3885dc2669f9
cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents:
2434
diff
changeset
|
688 |
*) |
1594 | 689 |
end |
690 |
||
691 |
||
692 |