author | Christian Urban <christian dot urban at kcl dot ac dot uk> |
Tue, 19 Feb 2013 06:58:14 +0000 | |
branch | Nominal2-Isabelle2013 |
changeset 3208 | da575186d492 |
parent 3197 | 25d11b449e92 |
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 |
2950
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
parents:
2948
diff
changeset
|
2 |
imports |
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
parents:
2948
diff
changeset
|
3 |
"../Nominal2" |
1594 | 4 |
begin |
5 |
||
2885
1264f2a21ea9
some rudimentary infrastructure for storing data about nominal datatypes
Christian Urban <urbanc@in.tum.de>
parents:
2868
diff
changeset
|
6 |
|
1594 | 7 |
atom_decl name |
8 |
||
2436
3885dc2669f9
cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents:
2434
diff
changeset
|
9 |
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
|
10 |
Var "name" |
2436
3885dc2669f9
cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents:
2434
diff
changeset
|
11 |
| App "lam" "lam" |
2950
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
parents:
2948
diff
changeset
|
12 |
| Lam x::"name" l::"lam" binds x in l ("Lam [_]. _" [100, 100] 100) |
2431
331873ebc5cd
can now deal with type variables in nominal datatype definitions
Christian Urban <urbanc@in.tum.de>
parents:
2425
diff
changeset
|
13 |
|
2951
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
14 |
section {* Simple examples from Norrish 2004 *} |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
15 |
|
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
16 |
nominal_primrec |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
17 |
is_app :: "lam \<Rightarrow> bool" |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
18 |
where |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
19 |
"is_app (Var x) = False" |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
20 |
| "is_app (App t1 t2) = True" |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
21 |
| "is_app (Lam [x]. t) = False" |
3197
25d11b449e92
definition of an auxiliary graph in nominal-primrec definitions
Christian Urban <urbanc@in.tum.de>
parents:
3192
diff
changeset
|
22 |
apply(simp add: eqvt_def is_app_graph_aux_def) |
2951
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
23 |
apply(rule TrueI) |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
24 |
apply(rule_tac y="x" in lam.exhaust) |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
25 |
apply(auto)[3] |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
26 |
apply(all_trivials) |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
27 |
done |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
28 |
|
2973
d1038e67923a
added a flag (eqvt) to termination proofs arising fron nominal_primrecs
Christian Urban <urbanc@in.tum.de>
parents:
2972
diff
changeset
|
29 |
termination (eqvt) by lexicographic_order |
d1038e67923a
added a flag (eqvt) to termination proofs arising fron nominal_primrecs
Christian Urban <urbanc@in.tum.de>
parents:
2972
diff
changeset
|
30 |
|
2974
b95a2065aa10
generated the partial eqvt-theorem for functions
Christian Urban <urbanc@in.tum.de>
parents:
2973
diff
changeset
|
31 |
thm is_app_def |
2975
c62e26830420
preliminary version of automatically generation the eqvt-lemmas for functions defined with nominal_primrec
Christian Urban <urbanc@in.tum.de>
parents:
2974
diff
changeset
|
32 |
thm is_app.eqvt |
c62e26830420
preliminary version of automatically generation the eqvt-lemmas for functions defined with nominal_primrec
Christian Urban <urbanc@in.tum.de>
parents:
2974
diff
changeset
|
33 |
thm eqvts |
2951
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
34 |
|
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
35 |
nominal_primrec |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
36 |
rator :: "lam \<Rightarrow> lam option" |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
37 |
where |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
38 |
"rator (Var x) = None" |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
39 |
| "rator (App t1 t2) = Some t1" |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
40 |
| "rator (Lam [x]. t) = None" |
3197
25d11b449e92
definition of an auxiliary graph in nominal-primrec definitions
Christian Urban <urbanc@in.tum.de>
parents:
3192
diff
changeset
|
41 |
apply(simp add: eqvt_def rator_graph_aux_def) |
2951
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
42 |
apply(rule TrueI) |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
43 |
apply(rule_tac y="x" in lam.exhaust) |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
44 |
apply(auto)[3] |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
45 |
apply(simp_all) |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
46 |
done |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
47 |
|
2973
d1038e67923a
added a flag (eqvt) to termination proofs arising fron nominal_primrecs
Christian Urban <urbanc@in.tum.de>
parents:
2972
diff
changeset
|
48 |
termination (eqvt) by lexicographic_order |
2951
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
49 |
|
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
50 |
nominal_primrec |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
51 |
rand :: "lam \<Rightarrow> lam option" |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
52 |
where |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
53 |
"rand (Var x) = None" |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
54 |
| "rand (App t1 t2) = Some t2" |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
55 |
| "rand (Lam [x]. t) = None" |
3197
25d11b449e92
definition of an auxiliary graph in nominal-primrec definitions
Christian Urban <urbanc@in.tum.de>
parents:
3192
diff
changeset
|
56 |
apply(simp add: eqvt_def rand_graph_aux_def) |
2951
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
57 |
apply(rule TrueI) |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
58 |
apply(rule_tac y="x" in lam.exhaust) |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
59 |
apply(auto)[3] |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
60 |
apply(simp_all) |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
61 |
done |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
62 |
|
2973
d1038e67923a
added a flag (eqvt) to termination proofs arising fron nominal_primrecs
Christian Urban <urbanc@in.tum.de>
parents:
2972
diff
changeset
|
63 |
termination (eqvt) by lexicographic_order |
2951
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
64 |
|
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
65 |
nominal_primrec |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
66 |
is_eta_nf :: "lam \<Rightarrow> bool" |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
67 |
where |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
68 |
"is_eta_nf (Var x) = True" |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
69 |
| "is_eta_nf (App t1 t2) = (is_eta_nf t1 \<and> is_eta_nf t2)" |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
70 |
| "is_eta_nf (Lam [x]. t) = (is_eta_nf t \<and> |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
71 |
((is_app t \<and> rand t = Some (Var x)) \<longrightarrow> atom x \<in> supp (rator t)))" |
3197
25d11b449e92
definition of an auxiliary graph in nominal-primrec definitions
Christian Urban <urbanc@in.tum.de>
parents:
3192
diff
changeset
|
72 |
apply(simp add: eqvt_def is_eta_nf_graph_aux_def) |
2951
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
73 |
apply(rule TrueI) |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
74 |
apply(rule_tac y="x" in lam.exhaust) |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
75 |
apply(auto)[3] |
3192
14c7d7e29c44
added a simproc for alpha-equivalence to the simplifier
Christian Urban <urbanc@in.tum.de>
parents:
3191
diff
changeset
|
76 |
using [[simproc del: alpha_lst]] |
2951
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
77 |
apply(simp_all) |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
78 |
apply(erule_tac c="()" in Abs_lst1_fcb2') |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
79 |
apply(simp_all add: pure_fresh fresh_star_def)[3] |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
80 |
apply(simp add: eqvt_at_def conj_eqvt) |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
81 |
apply(simp add: eqvt_at_def conj_eqvt) |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
82 |
done |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
83 |
|
2973
d1038e67923a
added a flag (eqvt) to termination proofs arising fron nominal_primrecs
Christian Urban <urbanc@in.tum.de>
parents:
2972
diff
changeset
|
84 |
termination (eqvt) by lexicographic_order |
2951
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
85 |
|
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
86 |
nominal_datatype path = Left | Right | In |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
87 |
|
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
88 |
section {* Paths to a free variables *} |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
89 |
|
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
90 |
instance path :: pure |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
91 |
apply(default) |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
92 |
apply(induct_tac "x::path" rule: path.induct) |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
93 |
apply(simp_all) |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
94 |
done |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
95 |
|
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
96 |
nominal_primrec |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
97 |
var_pos :: "name \<Rightarrow> lam \<Rightarrow> (path list) set" |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
98 |
where |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
99 |
"var_pos y (Var x) = (if y = x then {[]} else {})" |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
100 |
| "var_pos y (App t1 t2) = (Cons Left ` (var_pos y t1)) \<union> (Cons Right ` (var_pos y t2))" |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
101 |
| "atom x \<sharp> y \<Longrightarrow> var_pos y (Lam [x]. t) = (Cons In ` (var_pos y t))" |
3197
25d11b449e92
definition of an auxiliary graph in nominal-primrec definitions
Christian Urban <urbanc@in.tum.de>
parents:
3192
diff
changeset
|
102 |
apply(simp add: eqvt_def var_pos_graph_aux_def) |
2951
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
103 |
apply(rule TrueI) |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
104 |
apply(case_tac x) |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
105 |
apply(rule_tac y="b" and c="a" in lam.strong_exhaust) |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
106 |
apply(auto simp add: fresh_star_def)[3] |
3192
14c7d7e29c44
added a simproc for alpha-equivalence to the simplifier
Christian Urban <urbanc@in.tum.de>
parents:
3191
diff
changeset
|
107 |
using [[simproc del: alpha_lst]] |
2951
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
108 |
apply(simp_all) |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
109 |
apply(erule conjE)+ |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
110 |
apply(erule_tac Abs_lst1_fcb2) |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
111 |
apply(simp add: pure_fresh) |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
112 |
apply(simp add: fresh_star_def) |
3183
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3181
diff
changeset
|
113 |
apply(simp only: eqvt_at_def) |
2951
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
114 |
apply(perm_simp) |
3183
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3181
diff
changeset
|
115 |
apply(simp) |
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3181
diff
changeset
|
116 |
apply(simp add: perm_supp_eq) |
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3181
diff
changeset
|
117 |
apply(simp only: eqvt_at_def) |
2951
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
118 |
apply(perm_simp) |
3183
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3181
diff
changeset
|
119 |
apply(simp) |
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3181
diff
changeset
|
120 |
apply(simp add: perm_supp_eq) |
2951
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
121 |
done |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
122 |
|
2973
d1038e67923a
added a flag (eqvt) to termination proofs arising fron nominal_primrecs
Christian Urban <urbanc@in.tum.de>
parents:
2972
diff
changeset
|
123 |
termination (eqvt) by lexicographic_order |
2951
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
124 |
|
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
125 |
lemma var_pos1: |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
126 |
assumes "atom y \<notin> supp t" |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
127 |
shows "var_pos y t = {}" |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
128 |
using assms |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
129 |
apply(induct t rule: var_pos.induct) |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
130 |
apply(simp_all add: lam.supp supp_at_base fresh_at_base) |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
131 |
done |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
132 |
|
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
133 |
lemma var_pos2: |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
134 |
shows "var_pos y (Lam [y].t) = {}" |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
135 |
apply(rule var_pos1) |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
136 |
apply(simp add: lam.supp) |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
137 |
done |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
138 |
|
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
139 |
|
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
140 |
text {* strange substitution operation *} |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
141 |
|
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
142 |
nominal_primrec |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
143 |
subst' :: "lam \<Rightarrow> name \<Rightarrow> lam \<Rightarrow> lam" ("_ [_ ::== _]" [90, 90, 90] 90) |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
144 |
where |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
145 |
"(Var x)[y ::== s] = (if x = y then s else (Var x))" |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
146 |
| "(App t1 t2)[y ::== s] = App (t1[y ::== s]) (t2[y ::== s])" |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
147 |
| "atom x \<sharp> (y, s) \<Longrightarrow> (Lam [x]. t)[y ::== s] = Lam [x].(t[y ::== (App (Var y) s)])" |
3197
25d11b449e92
definition of an auxiliary graph in nominal-primrec definitions
Christian Urban <urbanc@in.tum.de>
parents:
3192
diff
changeset
|
148 |
apply(simp add: eqvt_def subst'_graph_aux_def) |
2951
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
149 |
apply(rule TrueI) |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
150 |
apply(case_tac x) |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
151 |
apply(rule_tac y="a" and c="(b, c)" in lam.strong_exhaust) |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
152 |
apply(auto simp add: fresh_star_def)[3] |
3192
14c7d7e29c44
added a simproc for alpha-equivalence to the simplifier
Christian Urban <urbanc@in.tum.de>
parents:
3191
diff
changeset
|
153 |
using [[simproc del: alpha_lst]] |
2951
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
154 |
apply(simp_all) |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
155 |
apply(erule conjE)+ |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
156 |
apply (erule_tac c="(ya,sa)" in Abs_lst1_fcb2) |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
157 |
apply(simp_all add: Abs_fresh_iff) |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
158 |
apply(simp add: fresh_star_def fresh_Pair) |
3183
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3181
diff
changeset
|
159 |
apply(simp only: eqvt_at_def) |
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3181
diff
changeset
|
160 |
apply(perm_simp) |
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3181
diff
changeset
|
161 |
apply(simp) |
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3181
diff
changeset
|
162 |
apply(simp add: fresh_star_Pair perm_supp_eq) |
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3181
diff
changeset
|
163 |
apply(simp only: eqvt_at_def) |
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3181
diff
changeset
|
164 |
apply(perm_simp) |
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3181
diff
changeset
|
165 |
apply(simp) |
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3181
diff
changeset
|
166 |
apply(simp add: fresh_star_Pair perm_supp_eq) |
2951
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
167 |
done |
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
168 |
|
2973
d1038e67923a
added a flag (eqvt) to termination proofs arising fron nominal_primrecs
Christian Urban <urbanc@in.tum.de>
parents:
2972
diff
changeset
|
169 |
termination (eqvt) by lexicographic_order |
2951
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
170 |
|
d75b3d8529e7
added some relatively simple examples from paper by Norrish
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
171 |
|
2868
2b8e387d2dfc
got rid of the boolean flag in the raw_equivariance function
Christian Urban <urbanc@in.tum.de>
parents:
2860
diff
changeset
|
172 |
section {* free name function *} |
2858
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
parents:
2852
diff
changeset
|
173 |
|
2860
25a7f421a3ba
added a test that every function must be of pt-sort
Christian Urban <urbanc@in.tum.de>
parents:
2858
diff
changeset
|
174 |
text {* first returns an atom list *} |
2858
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
parents:
2852
diff
changeset
|
175 |
|
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
parents:
2852
diff
changeset
|
176 |
nominal_primrec |
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
parents:
2852
diff
changeset
|
177 |
frees_lst :: "lam \<Rightarrow> atom list" |
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
parents:
2852
diff
changeset
|
178 |
where |
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
parents:
2852
diff
changeset
|
179 |
"frees_lst (Var x) = [atom x]" |
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
parents:
2852
diff
changeset
|
180 |
| "frees_lst (App t1 t2) = frees_lst t1 @ frees_lst t2" |
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
parents:
2852
diff
changeset
|
181 |
| "frees_lst (Lam [x]. t) = removeAll (atom x) (frees_lst t)" |
3197
25d11b449e92
definition of an auxiliary graph in nominal-primrec definitions
Christian Urban <urbanc@in.tum.de>
parents:
3192
diff
changeset
|
182 |
apply(simp add: eqvt_def frees_lst_graph_aux_def) |
2858
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
parents:
2852
diff
changeset
|
183 |
apply(rule TrueI) |
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
parents:
2852
diff
changeset
|
184 |
apply(rule_tac y="x" in lam.exhaust) |
3192
14c7d7e29c44
added a simproc for alpha-equivalence to the simplifier
Christian Urban <urbanc@in.tum.de>
parents:
3191
diff
changeset
|
185 |
using [[simproc del: alpha_lst]] |
2858
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
parents:
2852
diff
changeset
|
186 |
apply(auto) |
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
187 |
apply (erule_tac c="()" in Abs_lst1_fcb2) |
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
188 |
apply(simp add: supp_removeAll fresh_def) |
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
189 |
apply(simp add: fresh_star_def fresh_Unit) |
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
190 |
apply(simp add: eqvt_at_def removeAll_eqvt atom_eqvt) |
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
191 |
apply(simp add: eqvt_at_def removeAll_eqvt atom_eqvt) |
2858
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
parents:
2852
diff
changeset
|
192 |
done |
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
parents:
2852
diff
changeset
|
193 |
|
2973
d1038e67923a
added a flag (eqvt) to termination proofs arising fron nominal_primrecs
Christian Urban <urbanc@in.tum.de>
parents:
2972
diff
changeset
|
194 |
termination (eqvt) by lexicographic_order |
2858
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
parents:
2852
diff
changeset
|
195 |
|
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
parents:
2852
diff
changeset
|
196 |
text {* a small test lemma *} |
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
parents:
2852
diff
changeset
|
197 |
lemma shows "supp t = set (frees_lst t)" |
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
parents:
2852
diff
changeset
|
198 |
by (induct t rule: frees_lst.induct) (simp_all add: lam.supp supp_at_base) |
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
parents:
2852
diff
changeset
|
199 |
|
2860
25a7f421a3ba
added a test that every function must be of pt-sort
Christian Urban <urbanc@in.tum.de>
parents:
2858
diff
changeset
|
200 |
text {* second returns an atom set - therefore needs an invariant *} |
2858
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
parents:
2852
diff
changeset
|
201 |
|
2821
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2819
diff
changeset
|
202 |
nominal_primrec (invariant "\<lambda>x (y::atom set). finite y") |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2819
diff
changeset
|
203 |
frees_set :: "lam \<Rightarrow> atom set" |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2819
diff
changeset
|
204 |
where |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2819
diff
changeset
|
205 |
"frees_set (Var x) = {atom x}" |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2819
diff
changeset
|
206 |
| "frees_set (App t1 t2) = frees_set t1 \<union> frees_set t2" |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2819
diff
changeset
|
207 |
| "frees_set (Lam [x]. t) = (frees_set t) - {atom x}" |
3197
25d11b449e92
definition of an auxiliary graph in nominal-primrec definitions
Christian Urban <urbanc@in.tum.de>
parents:
3192
diff
changeset
|
208 |
apply(simp add: eqvt_def frees_set_graph_aux_def) |
2845
a99f488a96bb
Optimized proofs and removed some garbage.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2843
diff
changeset
|
209 |
apply(erule frees_set_graph.induct) |
a99f488a96bb
Optimized proofs and removed some garbage.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2843
diff
changeset
|
210 |
apply(auto)[9] |
a99f488a96bb
Optimized proofs and removed some garbage.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2843
diff
changeset
|
211 |
apply(rule_tac y="x" in lam.exhaust) |
a99f488a96bb
Optimized proofs and removed some garbage.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2843
diff
changeset
|
212 |
apply(auto)[3] |
3192
14c7d7e29c44
added a simproc for alpha-equivalence to the simplifier
Christian Urban <urbanc@in.tum.de>
parents:
3191
diff
changeset
|
213 |
using [[simproc del: alpha_lst]] |
2845
a99f488a96bb
Optimized proofs and removed some garbage.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2843
diff
changeset
|
214 |
apply(simp) |
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
215 |
apply(erule_tac c="()" in Abs_lst1_fcb2) |
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
216 |
apply(simp add: fresh_minus_atom_set) |
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
217 |
apply(simp add: fresh_star_def fresh_Unit) |
3183
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3181
diff
changeset
|
218 |
apply(simp add: Diff_eqvt eqvt_at_def) |
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3181
diff
changeset
|
219 |
apply(simp add: Diff_eqvt eqvt_at_def) |
2845
a99f488a96bb
Optimized proofs and removed some garbage.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2843
diff
changeset
|
220 |
done |
2821
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2819
diff
changeset
|
221 |
|
2973
d1038e67923a
added a flag (eqvt) to termination proofs arising fron nominal_primrecs
Christian Urban <urbanc@in.tum.de>
parents:
2972
diff
changeset
|
222 |
termination (eqvt) |
2858
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
parents:
2852
diff
changeset
|
223 |
by lexicographic_order |
2821
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2819
diff
changeset
|
224 |
|
2822
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
parents:
2821
diff
changeset
|
225 |
lemma "frees_set t = supp t" |
2845
a99f488a96bb
Optimized proofs and removed some garbage.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2843
diff
changeset
|
226 |
by (induct rule: frees_set.induct) (simp_all add: lam.supp supp_at_base) |
2821
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2819
diff
changeset
|
227 |
|
2868
2b8e387d2dfc
got rid of the boolean flag in the raw_equivariance function
Christian Urban <urbanc@in.tum.de>
parents:
2860
diff
changeset
|
228 |
section {* height function *} |
2431
331873ebc5cd
can now deal with type variables in nominal datatype definitions
Christian Urban <urbanc@in.tum.de>
parents:
2425
diff
changeset
|
229 |
|
2666
324a5d1289a3
added a few examples of functions to Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2664
diff
changeset
|
230 |
nominal_primrec |
2678
494b859bfc16
defined height as a function that returns an integer
Christian Urban <urbanc@in.tum.de>
parents:
2675
diff
changeset
|
231 |
height :: "lam \<Rightarrow> int" |
2666
324a5d1289a3
added a few examples of functions to Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2664
diff
changeset
|
232 |
where |
2678
494b859bfc16
defined height as a function that returns an integer
Christian Urban <urbanc@in.tum.de>
parents:
2675
diff
changeset
|
233 |
"height (Var x) = 1" |
2683
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
234 |
| "height (App t1 t2) = max (height t1) (height t2) + 1" |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
235 |
| "height (Lam [x].t) = height t + 1" |
3197
25d11b449e92
definition of an auxiliary graph in nominal-primrec definitions
Christian Urban <urbanc@in.tum.de>
parents:
3192
diff
changeset
|
236 |
apply(simp add: eqvt_def height_graph_aux_def) |
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
237 |
apply(rule TrueI) |
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
238 |
apply(rule_tac y="x" in lam.exhaust) |
3192
14c7d7e29c44
added a simproc for alpha-equivalence to the simplifier
Christian Urban <urbanc@in.tum.de>
parents:
3191
diff
changeset
|
239 |
using [[simproc del: alpha_lst]] |
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
240 |
apply(auto) |
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
241 |
apply (erule_tac c="()" in Abs_lst1_fcb2) |
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
242 |
apply(simp_all add: fresh_def pure_supp eqvt_at_def fresh_star_def) |
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
243 |
done |
2666
324a5d1289a3
added a few examples of functions to Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2664
diff
changeset
|
244 |
|
2973
d1038e67923a
added a flag (eqvt) to termination proofs arising fron nominal_primrecs
Christian Urban <urbanc@in.tum.de>
parents:
2972
diff
changeset
|
245 |
termination (eqvt) |
2858
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
parents:
2852
diff
changeset
|
246 |
by lexicographic_order |
2666
324a5d1289a3
added a few examples of functions to Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2664
diff
changeset
|
247 |
|
2707
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
248 |
thm height.simps |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
249 |
|
2683
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
250 |
|
2868
2b8e387d2dfc
got rid of the boolean flag in the raw_equivariance function
Christian Urban <urbanc@in.tum.de>
parents:
2860
diff
changeset
|
251 |
section {* capture-avoiding substitution *} |
2683
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
252 |
|
2675
68ccf847507d
defined properly substitution
Christian Urban <urbanc@in.tum.de>
parents:
2669
diff
changeset
|
253 |
nominal_primrec |
2683
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
254 |
subst :: "lam \<Rightarrow> name \<Rightarrow> lam \<Rightarrow> lam" ("_ [_ ::= _]" [90, 90, 90] 90) |
2675
68ccf847507d
defined properly substitution
Christian Urban <urbanc@in.tum.de>
parents:
2669
diff
changeset
|
255 |
where |
2683
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
256 |
"(Var x)[y ::= s] = (if x = y then s else (Var x))" |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
257 |
| "(App t1 t2)[y ::= s] = App (t1[y ::= s]) (t2[y ::= s])" |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
258 |
| "atom x \<sharp> (y, s) \<Longrightarrow> (Lam [x]. t)[y ::= s] = Lam [x].(t[y ::= s])" |
3197
25d11b449e92
definition of an auxiliary graph in nominal-primrec definitions
Christian Urban <urbanc@in.tum.de>
parents:
3192
diff
changeset
|
259 |
apply(simp add: eqvt_def subst_graph_aux_def) |
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
260 |
apply(rule TrueI) |
3192
14c7d7e29c44
added a simproc for alpha-equivalence to the simplifier
Christian Urban <urbanc@in.tum.de>
parents:
3191
diff
changeset
|
261 |
using [[simproc del: alpha_lst]] |
3085
25d813c5042d
Port CR_Takahashi from Nominal1, no more "sorry" in BetaCR.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
3065
diff
changeset
|
262 |
apply(auto) |
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
263 |
apply(rule_tac y="a" and c="(aa, b)" in lam.strong_exhaust) |
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
264 |
apply(blast)+ |
3192
14c7d7e29c44
added a simproc for alpha-equivalence to the simplifier
Christian Urban <urbanc@in.tum.de>
parents:
3191
diff
changeset
|
265 |
using [[simproc del: alpha_lst]] |
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
266 |
apply(simp_all add: fresh_star_def fresh_Pair_elim) |
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
267 |
apply (erule_tac c="(ya,sa)" in Abs_lst1_fcb2) |
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
268 |
apply(simp_all add: Abs_fresh_iff) |
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
269 |
apply(simp add: fresh_star_def fresh_Pair) |
3183
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3181
diff
changeset
|
270 |
apply(simp only: eqvt_at_def) |
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3181
diff
changeset
|
271 |
apply(perm_simp) |
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3181
diff
changeset
|
272 |
apply(simp) |
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3181
diff
changeset
|
273 |
apply(simp add: fresh_star_Pair perm_supp_eq) |
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3181
diff
changeset
|
274 |
apply(simp only: eqvt_at_def) |
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3181
diff
changeset
|
275 |
apply(perm_simp) |
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3181
diff
changeset
|
276 |
apply(simp) |
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3181
diff
changeset
|
277 |
apply(simp add: fresh_star_Pair perm_supp_eq) |
2675
68ccf847507d
defined properly substitution
Christian Urban <urbanc@in.tum.de>
parents:
2669
diff
changeset
|
278 |
done |
68ccf847507d
defined properly substitution
Christian Urban <urbanc@in.tum.de>
parents:
2669
diff
changeset
|
279 |
|
2973
d1038e67923a
added a flag (eqvt) to termination proofs arising fron nominal_primrecs
Christian Urban <urbanc@in.tum.de>
parents:
2972
diff
changeset
|
280 |
termination (eqvt) |
2858
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
parents:
2852
diff
changeset
|
281 |
by lexicographic_order |
2683
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
282 |
|
2975
c62e26830420
preliminary version of automatically generation the eqvt-lemmas for functions defined with nominal_primrec
Christian Urban <urbanc@in.tum.de>
parents:
2974
diff
changeset
|
283 |
thm subst.eqvt |
2683
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
284 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
285 |
lemma forget: |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
286 |
shows "atom x \<sharp> t \<Longrightarrow> t[x ::= s] = t" |
2845
a99f488a96bb
Optimized proofs and removed some garbage.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2843
diff
changeset
|
287 |
by (nominal_induct t avoiding: x s rule: lam.strong_induct) |
3181
ca162f0a7957
added to the simplifier nominal_datatype.fresh lemmas
Christian Urban <urbanc@in.tum.de>
parents:
3174
diff
changeset
|
288 |
(auto simp add: fresh_at_base) |
2683
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
289 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
290 |
text {* same lemma but with subst.induction *} |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
291 |
lemma forget2: |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
292 |
shows "atom x \<sharp> t \<Longrightarrow> t[x ::= s] = t" |
3192
14c7d7e29c44
added a simproc for alpha-equivalence to the simplifier
Christian Urban <urbanc@in.tum.de>
parents:
3191
diff
changeset
|
293 |
apply(induct t x s rule: subst.induct) |
14c7d7e29c44
added a simproc for alpha-equivalence to the simplifier
Christian Urban <urbanc@in.tum.de>
parents:
3191
diff
changeset
|
294 |
using [[simproc del: alpha_lst]] |
14c7d7e29c44
added a simproc for alpha-equivalence to the simplifier
Christian Urban <urbanc@in.tum.de>
parents:
3191
diff
changeset
|
295 |
apply(auto simp add: flip_fresh_fresh fresh_Pair fresh_at_base) |
14c7d7e29c44
added a simproc for alpha-equivalence to the simplifier
Christian Urban <urbanc@in.tum.de>
parents:
3191
diff
changeset
|
296 |
done |
2683
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
297 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
298 |
lemma fresh_fact: |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
299 |
fixes z::"name" |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
300 |
assumes a: "atom z \<sharp> s" |
2845
a99f488a96bb
Optimized proofs and removed some garbage.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2843
diff
changeset
|
301 |
and b: "z = y \<or> atom z \<sharp> t" |
2683
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
302 |
shows "atom z \<sharp> t[y ::= s]" |
2845
a99f488a96bb
Optimized proofs and removed some garbage.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2843
diff
changeset
|
303 |
using a b |
a99f488a96bb
Optimized proofs and removed some garbage.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2843
diff
changeset
|
304 |
by (nominal_induct t avoiding: z y s rule: lam.strong_induct) |
3181
ca162f0a7957
added to the simplifier nominal_datatype.fresh lemmas
Christian Urban <urbanc@in.tum.de>
parents:
3174
diff
changeset
|
305 |
(auto simp add: fresh_at_base) |
2683
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
306 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
307 |
lemma substitution_lemma: |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
308 |
assumes a: "x \<noteq> y" "atom x \<sharp> u" |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
309 |
shows "t[x ::= s][y ::= u] = t[y ::= u][x ::= s[y ::= u]]" |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
310 |
using a |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
311 |
by (nominal_induct t avoiding: x y s u rule: lam.strong_induct) |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
312 |
(auto simp add: fresh_fact forget) |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
313 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
314 |
lemma subst_rename: |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
315 |
assumes a: "atom y \<sharp> t" |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
316 |
shows "t[x ::= s] = ((y \<leftrightarrow> x) \<bullet>t)[y ::= s]" |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
317 |
using a |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
318 |
apply (nominal_induct t avoiding: x y s rule: lam.strong_induct) |
3181
ca162f0a7957
added to the simplifier nominal_datatype.fresh lemmas
Christian Urban <urbanc@in.tum.de>
parents:
3174
diff
changeset
|
319 |
apply (auto simp add: fresh_at_base) |
2683
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
320 |
done |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
321 |
|
2767
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2765
diff
changeset
|
322 |
lemma height_ge_one: |
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2765
diff
changeset
|
323 |
shows "1 \<le> (height e)" |
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2765
diff
changeset
|
324 |
by (induct e rule: lam.induct) (simp_all) |
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2765
diff
changeset
|
325 |
|
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2765
diff
changeset
|
326 |
theorem height_subst: |
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2765
diff
changeset
|
327 |
shows "height (e[x::=e']) \<le> ((height e) - 1) + (height e')" |
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2765
diff
changeset
|
328 |
proof (nominal_induct e avoiding: x e' rule: lam.strong_induct) |
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2765
diff
changeset
|
329 |
case (Var y) |
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2765
diff
changeset
|
330 |
have "1 \<le> height e'" by (rule height_ge_one) |
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2765
diff
changeset
|
331 |
then show "height (Var y[x::=e']) \<le> height (Var y) - 1 + height e'" by simp |
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2765
diff
changeset
|
332 |
next |
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2765
diff
changeset
|
333 |
case (Lam y e1) |
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2765
diff
changeset
|
334 |
hence ih: "height (e1[x::=e']) \<le> ((height e1) - 1) + (height e')" by simp |
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2765
diff
changeset
|
335 |
moreover |
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2765
diff
changeset
|
336 |
have vc: "atom y\<sharp>x" "atom y\<sharp>e'" by fact+ (* usual variable convention *) |
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2765
diff
changeset
|
337 |
ultimately show "height ((Lam [y]. e1)[x::=e']) \<le> height (Lam [y]. e1) - 1 + height e'" by simp |
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2765
diff
changeset
|
338 |
next |
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2765
diff
changeset
|
339 |
case (App e1 e2) |
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2765
diff
changeset
|
340 |
hence ih1: "height (e1[x::=e']) \<le> ((height e1) - 1) + (height e')" |
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2765
diff
changeset
|
341 |
and ih2: "height (e2[x::=e']) \<le> ((height e2) - 1) + (height e')" by simp_all |
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2765
diff
changeset
|
342 |
then show "height ((App e1 e2)[x::=e']) \<le> height (App e1 e2) - 1 + height e'" by simp |
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2765
diff
changeset
|
343 |
qed |
2683
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
344 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
345 |
subsection {* single-step beta-reduction *} |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
346 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
347 |
inductive |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
348 |
beta :: "lam \<Rightarrow> lam \<Rightarrow> bool" (" _ \<longrightarrow>b _" [80,80] 80) |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
349 |
where |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
350 |
b1[intro]: "t1 \<longrightarrow>b t2 \<Longrightarrow> App t1 s \<longrightarrow>b App t2 s" |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
351 |
| b2[intro]: "s1 \<longrightarrow>b s2 \<Longrightarrow> App t s1 \<longrightarrow>b App t s2" |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
352 |
| b3[intro]: "t1 \<longrightarrow>b t2 \<Longrightarrow> Lam [x]. t1 \<longrightarrow>b Lam [x]. t2" |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
353 |
| b4[intro]: "atom x \<sharp> s \<Longrightarrow> App (Lam [x]. t) s \<longrightarrow>b t[x ::= s]" |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
354 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
355 |
equivariance beta |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
356 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
357 |
nominal_inductive beta |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
358 |
avoids b4: "x" |
3181
ca162f0a7957
added to the simplifier nominal_datatype.fresh lemmas
Christian Urban <urbanc@in.tum.de>
parents:
3174
diff
changeset
|
359 |
by (simp_all add: fresh_star_def fresh_Pair fresh_fact) |
2683
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
360 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
361 |
text {* One-Reduction *} |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
362 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
363 |
inductive |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
364 |
One :: "lam \<Rightarrow> lam \<Rightarrow> bool" (" _ \<longrightarrow>1 _" [80,80] 80) |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
365 |
where |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
366 |
o1[intro]: "Var x \<longrightarrow>1 Var x" |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
367 |
| o2[intro]: "\<lbrakk>t1 \<longrightarrow>1 t2; s1 \<longrightarrow>1 s2\<rbrakk> \<Longrightarrow> App t1 s1 \<longrightarrow>1 App t2 s2" |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
368 |
| o3[intro]: "t1 \<longrightarrow>1 t2 \<Longrightarrow> Lam [x].t1 \<longrightarrow>1 Lam [x].t2" |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
369 |
| o4[intro]: "\<lbrakk>atom x \<sharp> (s1, s2); t1 \<longrightarrow>1 t2; s1 \<longrightarrow>1 s2\<rbrakk> \<Longrightarrow> App (Lam [x].t1) s1 \<longrightarrow>1 t2[x ::= s2]" |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
370 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
371 |
equivariance One |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
372 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
373 |
nominal_inductive One |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
374 |
avoids o3: "x" |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
375 |
| o4: "x" |
3181
ca162f0a7957
added to the simplifier nominal_datatype.fresh lemmas
Christian Urban <urbanc@in.tum.de>
parents:
3174
diff
changeset
|
376 |
by (simp_all add: fresh_star_def fresh_Pair fresh_fact) |
2683
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
377 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
378 |
lemma One_refl: |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
379 |
shows "t \<longrightarrow>1 t" |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
380 |
by (nominal_induct t rule: lam.strong_induct) (auto) |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
381 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
382 |
lemma One_subst: |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
383 |
assumes a: "t1 \<longrightarrow>1 t2" "s1 \<longrightarrow>1 s2" |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
384 |
shows "t1[x ::= s1] \<longrightarrow>1 t2[x ::= s2]" |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
385 |
using a |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
386 |
apply(nominal_induct t1 t2 avoiding: s1 s2 x rule: One.strong_induct) |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
387 |
apply(auto simp add: substitution_lemma fresh_at_base fresh_fact fresh_Pair) |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
388 |
done |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
389 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
390 |
lemma better_o4_intro: |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
391 |
assumes a: "t1 \<longrightarrow>1 t2" "s1 \<longrightarrow>1 s2" |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
392 |
shows "App (Lam [x]. t1) s1 \<longrightarrow>1 t2[ x ::= s2]" |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
393 |
proof - |
2685
1df873b63cb2
added obtain_fresh lemma; tuned Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2683
diff
changeset
|
394 |
obtain y::"name" where fs: "atom y \<sharp> (x, t1, s1, t2, s2)" by (rule obtain_fresh) |
2683
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
395 |
have "App (Lam [x]. t1) s1 = App (Lam [y]. ((y \<leftrightarrow> x) \<bullet> t1)) s1" using fs |
3085
25d813c5042d
Port CR_Takahashi from Nominal1, no more "sorry" in BetaCR.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
3065
diff
changeset
|
396 |
by (auto simp add: Abs1_eq_iff' flip_def fresh_Pair fresh_at_base) |
2683
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
397 |
also have "\<dots> \<longrightarrow>1 ((y \<leftrightarrow> x) \<bullet> t2)[y ::= s2]" using fs a by (auto simp add: One.eqvt) |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
398 |
also have "\<dots> = t2[x ::= s2]" using fs by (simp add: subst_rename[symmetric]) |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
399 |
finally show "App (Lam [x].t1) s1 \<longrightarrow>1 t2[x ::= s2]" by simp |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
400 |
qed |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
401 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
402 |
section {* Locally Nameless Terms *} |
2678
494b859bfc16
defined height as a function that returns an integer
Christian Urban <urbanc@in.tum.de>
parents:
2675
diff
changeset
|
403 |
|
2669
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
parents:
2667
diff
changeset
|
404 |
nominal_datatype ln = |
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
parents:
2667
diff
changeset
|
405 |
LNBnd nat |
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
parents:
2667
diff
changeset
|
406 |
| LNVar name |
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
parents:
2667
diff
changeset
|
407 |
| LNApp ln ln |
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
parents:
2667
diff
changeset
|
408 |
| LNLam ln |
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
parents:
2667
diff
changeset
|
409 |
|
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
parents:
2667
diff
changeset
|
410 |
fun |
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
parents:
2667
diff
changeset
|
411 |
lookup :: "name list \<Rightarrow> nat \<Rightarrow> name \<Rightarrow> ln" |
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
parents:
2667
diff
changeset
|
412 |
where |
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
parents:
2667
diff
changeset
|
413 |
"lookup [] n x = LNVar x" |
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
parents:
2667
diff
changeset
|
414 |
| "lookup (y # ys) n x = (if x = y then LNBnd n else (lookup ys (n + 1) x))" |
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
parents:
2667
diff
changeset
|
415 |
|
2822
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
parents:
2821
diff
changeset
|
416 |
lemma supp_lookup: |
2824
44d937e8ae78
Proof of trans with invariant
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2822
diff
changeset
|
417 |
shows "supp (lookup xs n x) \<subseteq> {atom x}" |
2822
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
parents:
2821
diff
changeset
|
418 |
apply(induct arbitrary: n rule: lookup.induct) |
2824
44d937e8ae78
Proof of trans with invariant
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2822
diff
changeset
|
419 |
apply(simp add: ln.supp supp_at_base) |
2822
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
parents:
2821
diff
changeset
|
420 |
apply(simp add: ln.supp pure_supp) |
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
parents:
2821
diff
changeset
|
421 |
done |
2824
44d937e8ae78
Proof of trans with invariant
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2822
diff
changeset
|
422 |
|
44d937e8ae78
Proof of trans with invariant
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2822
diff
changeset
|
423 |
lemma supp_lookup_in: |
44d937e8ae78
Proof of trans with invariant
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2822
diff
changeset
|
424 |
shows "x \<in> set xs \<Longrightarrow> supp (lookup xs n x) = {}" |
44d937e8ae78
Proof of trans with invariant
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2822
diff
changeset
|
425 |
by (induct arbitrary: n rule: lookup.induct)(auto simp add: ln.supp pure_supp) |
44d937e8ae78
Proof of trans with invariant
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2822
diff
changeset
|
426 |
|
44d937e8ae78
Proof of trans with invariant
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2822
diff
changeset
|
427 |
lemma supp_lookup_notin: |
44d937e8ae78
Proof of trans with invariant
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2822
diff
changeset
|
428 |
shows "x \<notin> set xs \<Longrightarrow> supp (lookup xs n x) = {atom x}" |
44d937e8ae78
Proof of trans with invariant
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2822
diff
changeset
|
429 |
by (induct arbitrary: n rule: lookup.induct) (auto simp add: ln.supp pure_supp supp_at_base) |
2822
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
parents:
2821
diff
changeset
|
430 |
|
2829
0acb0b8f4106
Simplify ln-trans proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2828
diff
changeset
|
431 |
lemma supp_lookup_fresh: |
0acb0b8f4106
Simplify ln-trans proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2828
diff
changeset
|
432 |
shows "atom ` set xs \<sharp>* lookup xs n x" |
0acb0b8f4106
Simplify ln-trans proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2828
diff
changeset
|
433 |
by (case_tac "x \<in> set xs") (auto simp add: fresh_star_def fresh_def supp_lookup_in supp_lookup_notin) |
0acb0b8f4106
Simplify ln-trans proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2828
diff
changeset
|
434 |
|
0acb0b8f4106
Simplify ln-trans proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2828
diff
changeset
|
435 |
lemma lookup_eqvt[eqvt]: |
2669
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
parents:
2667
diff
changeset
|
436 |
shows "(p \<bullet> lookup xs n x) = lookup (p \<bullet> xs) (p \<bullet> n) (p \<bullet> x)" |
2767
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2765
diff
changeset
|
437 |
by (induct xs arbitrary: n) (simp_all add: permute_pure) |
2669
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
parents:
2667
diff
changeset
|
438 |
|
2858
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
parents:
2852
diff
changeset
|
439 |
text {* Function that translates lambda-terms into locally nameless terms *} |
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
parents:
2852
diff
changeset
|
440 |
|
2826 | 441 |
nominal_primrec (invariant "\<lambda>(_, xs) y. atom ` set xs \<sharp>* y") |
2669
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
parents:
2667
diff
changeset
|
442 |
trans :: "lam \<Rightarrow> name list \<Rightarrow> ln" |
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
parents:
2667
diff
changeset
|
443 |
where |
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
parents:
2667
diff
changeset
|
444 |
"trans (Var x) xs = lookup xs 0 x" |
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
parents:
2667
diff
changeset
|
445 |
| "trans (App t1 t2) xs = LNApp (trans t1 xs) (trans t2 xs)" |
2685
1df873b63cb2
added obtain_fresh lemma; tuned Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2683
diff
changeset
|
446 |
| "atom x \<sharp> xs \<Longrightarrow> trans (Lam [x]. t) xs = LNLam (trans t (x # xs))" |
3197
25d11b449e92
definition of an auxiliary graph in nominal-primrec definitions
Christian Urban <urbanc@in.tum.de>
parents:
3192
diff
changeset
|
447 |
apply (simp add: eqvt_def trans_graph_aux_def) |
2824
44d937e8ae78
Proof of trans with invariant
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2822
diff
changeset
|
448 |
apply (erule trans_graph.induct) |
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
449 |
apply (auto simp add: ln.fresh)[3] |
2829
0acb0b8f4106
Simplify ln-trans proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2828
diff
changeset
|
450 |
apply (simp add: supp_lookup_fresh) |
2824
44d937e8ae78
Proof of trans with invariant
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2822
diff
changeset
|
451 |
apply (simp add: fresh_star_def ln.fresh) |
44d937e8ae78
Proof of trans with invariant
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2822
diff
changeset
|
452 |
apply (simp add: ln.fresh fresh_star_def) |
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
453 |
apply(auto)[1] |
2829
0acb0b8f4106
Simplify ln-trans proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2828
diff
changeset
|
454 |
apply (rule_tac y="a" and c="b" in lam.strong_exhaust) |
0acb0b8f4106
Simplify ln-trans proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2828
diff
changeset
|
455 |
apply (auto simp add: fresh_star_def)[3] |
3192
14c7d7e29c44
added a simproc for alpha-equivalence to the simplifier
Christian Urban <urbanc@in.tum.de>
parents:
3191
diff
changeset
|
456 |
using [[simproc del: alpha_lst]] |
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
457 |
apply(simp_all) |
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
458 |
apply(erule conjE)+ |
2948
b0b2adafb6d2
made the tests go through again
Christian Urban <urbanc@in.tum.de>
parents:
2945
diff
changeset
|
459 |
apply (erule_tac c="xsa" in Abs_lst1_fcb2') |
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
460 |
apply (simp add: fresh_star_def) |
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
461 |
apply (simp add: fresh_star_def) |
3183
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3181
diff
changeset
|
462 |
apply(simp only: eqvt_at_def) |
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3181
diff
changeset
|
463 |
apply(perm_simp) |
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3181
diff
changeset
|
464 |
apply(simp add: fresh_star_Pair perm_supp_eq) |
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3181
diff
changeset
|
465 |
apply(simp only: eqvt_at_def) |
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3181
diff
changeset
|
466 |
apply(perm_simp) |
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3181
diff
changeset
|
467 |
apply(simp add: fresh_star_Pair perm_supp_eq) |
2829
0acb0b8f4106
Simplify ln-trans proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2828
diff
changeset
|
468 |
done |
2669
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
parents:
2667
diff
changeset
|
469 |
|
2973
d1038e67923a
added a flag (eqvt) to termination proofs arising fron nominal_primrecs
Christian Urban <urbanc@in.tum.de>
parents:
2972
diff
changeset
|
470 |
termination (eqvt) |
2858
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
parents:
2852
diff
changeset
|
471 |
by lexicographic_order |
2827
394664816e24
defined the "count-bound-variables-occurences" function which has an accumulator like trans
Christian Urban <urbanc@in.tum.de>
parents:
2826
diff
changeset
|
472 |
|
2950
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
parents:
2948
diff
changeset
|
473 |
|
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
parents:
2948
diff
changeset
|
474 |
text {* count the occurences of lambdas in a term *} |
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
parents:
2948
diff
changeset
|
475 |
|
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
parents:
2948
diff
changeset
|
476 |
nominal_primrec |
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
parents:
2948
diff
changeset
|
477 |
cntlams :: "lam \<Rightarrow> nat" |
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
parents:
2948
diff
changeset
|
478 |
where |
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
parents:
2948
diff
changeset
|
479 |
"cntlams (Var x) = 0" |
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
parents:
2948
diff
changeset
|
480 |
| "cntlams (App t1 t2) = (cntlams t1) + (cntlams t2)" |
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
parents:
2948
diff
changeset
|
481 |
| "cntlams (Lam [x]. t) = Suc (cntlams t)" |
3197
25d11b449e92
definition of an auxiliary graph in nominal-primrec definitions
Christian Urban <urbanc@in.tum.de>
parents:
3192
diff
changeset
|
482 |
apply(simp add: eqvt_def cntlams_graph_aux_def) |
2950
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
parents:
2948
diff
changeset
|
483 |
apply(rule TrueI) |
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
parents:
2948
diff
changeset
|
484 |
apply(rule_tac y="x" in lam.exhaust) |
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
parents:
2948
diff
changeset
|
485 |
apply(auto)[3] |
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
parents:
2948
diff
changeset
|
486 |
apply(all_trivials) |
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
parents:
2948
diff
changeset
|
487 |
apply(simp) |
3192
14c7d7e29c44
added a simproc for alpha-equivalence to the simplifier
Christian Urban <urbanc@in.tum.de>
parents:
3191
diff
changeset
|
488 |
using [[simproc del: alpha_lst]] |
2950
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
parents:
2948
diff
changeset
|
489 |
apply(simp) |
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
parents:
2948
diff
changeset
|
490 |
apply(erule_tac c="()" in Abs_lst1_fcb2') |
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
parents:
2948
diff
changeset
|
491 |
apply(simp add: pure_fresh) |
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
parents:
2948
diff
changeset
|
492 |
apply(simp add: fresh_star_def pure_fresh) |
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
parents:
2948
diff
changeset
|
493 |
apply(simp add: eqvt_at_def atom_eqvt fresh_star_Pair perm_supp_eq) |
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
parents:
2948
diff
changeset
|
494 |
apply(simp add: eqvt_at_def atom_eqvt fresh_star_Pair perm_supp_eq) |
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
parents:
2948
diff
changeset
|
495 |
done |
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
parents:
2948
diff
changeset
|
496 |
|
2973
d1038e67923a
added a flag (eqvt) to termination proofs arising fron nominal_primrecs
Christian Urban <urbanc@in.tum.de>
parents:
2972
diff
changeset
|
497 |
termination (eqvt) |
2950
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
parents:
2948
diff
changeset
|
498 |
by lexicographic_order |
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
parents:
2948
diff
changeset
|
499 |
|
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
parents:
2948
diff
changeset
|
500 |
|
2860
25a7f421a3ba
added a test that every function must be of pt-sort
Christian Urban <urbanc@in.tum.de>
parents:
2858
diff
changeset
|
501 |
text {* count the bound-variable occurences in a lambda-term *} |
2827
394664816e24
defined the "count-bound-variables-occurences" function which has an accumulator like trans
Christian Urban <urbanc@in.tum.de>
parents:
2826
diff
changeset
|
502 |
|
2828
81276d5c7438
cbvs can be easily defined without an invariant
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2827
diff
changeset
|
503 |
nominal_primrec |
2950
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
parents:
2948
diff
changeset
|
504 |
cntbvs :: "lam \<Rightarrow> name list \<Rightarrow> nat" |
2827
394664816e24
defined the "count-bound-variables-occurences" function which has an accumulator like trans
Christian Urban <urbanc@in.tum.de>
parents:
2826
diff
changeset
|
505 |
where |
2950
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
parents:
2948
diff
changeset
|
506 |
"cntbvs (Var x) xs = (if x \<in> set xs then 1 else 0)" |
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
parents:
2948
diff
changeset
|
507 |
| "cntbvs (App t1 t2) xs = (cntbvs t1 xs) + (cntbvs t2 xs)" |
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
parents:
2948
diff
changeset
|
508 |
| "atom x \<sharp> xs \<Longrightarrow> cntbvs (Lam [x]. t) xs = cntbvs t (x # xs)" |
3197
25d11b449e92
definition of an auxiliary graph in nominal-primrec definitions
Christian Urban <urbanc@in.tum.de>
parents:
3192
diff
changeset
|
509 |
apply(simp add: eqvt_def cntbvs_graph_aux_def) |
2950
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
parents:
2948
diff
changeset
|
510 |
apply(rule TrueI) |
2828
81276d5c7438
cbvs can be easily defined without an invariant
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2827
diff
changeset
|
511 |
apply(case_tac x) |
81276d5c7438
cbvs can be easily defined without an invariant
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2827
diff
changeset
|
512 |
apply(rule_tac y="a" and c="b" in lam.strong_exhaust) |
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
513 |
apply(auto simp add: fresh_star_def)[3] |
2950
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
parents:
2948
diff
changeset
|
514 |
apply(all_trivials) |
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
parents:
2948
diff
changeset
|
515 |
apply(simp) |
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
parents:
2948
diff
changeset
|
516 |
apply(simp) |
3192
14c7d7e29c44
added a simproc for alpha-equivalence to the simplifier
Christian Urban <urbanc@in.tum.de>
parents:
3191
diff
changeset
|
517 |
using [[simproc del: alpha_lst]] |
2950
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
parents:
2948
diff
changeset
|
518 |
apply(simp) |
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
519 |
apply(erule conjE) |
2912
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
parents:
2902
diff
changeset
|
520 |
apply(erule Abs_lst1_fcb2') |
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
521 |
apply(simp add: pure_fresh fresh_star_def) |
2950
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
parents:
2948
diff
changeset
|
522 |
apply(simp add: fresh_star_def) |
3183
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3181
diff
changeset
|
523 |
apply(simp only: eqvt_at_def) |
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3181
diff
changeset
|
524 |
apply(perm_simp) |
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3181
diff
changeset
|
525 |
apply(simp add: fresh_star_Pair perm_supp_eq) |
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3181
diff
changeset
|
526 |
apply(simp only: eqvt_at_def) |
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3181
diff
changeset
|
527 |
apply(perm_simp) |
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3181
diff
changeset
|
528 |
apply(simp add: fresh_star_Pair perm_supp_eq) |
2828
81276d5c7438
cbvs can be easily defined without an invariant
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2827
diff
changeset
|
529 |
done |
2827
394664816e24
defined the "count-bound-variables-occurences" function which has an accumulator like trans
Christian Urban <urbanc@in.tum.de>
parents:
2826
diff
changeset
|
530 |
|
2973
d1038e67923a
added a flag (eqvt) to termination proofs arising fron nominal_primrecs
Christian Urban <urbanc@in.tum.de>
parents:
2972
diff
changeset
|
531 |
termination (eqvt) |
2858
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
parents:
2852
diff
changeset
|
532 |
by lexicographic_order |
2827
394664816e24
defined the "count-bound-variables-occurences" function which has an accumulator like trans
Christian Urban <urbanc@in.tum.de>
parents:
2826
diff
changeset
|
533 |
|
2858
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
parents:
2852
diff
changeset
|
534 |
section {* De Bruijn Terms *} |
2827
394664816e24
defined the "count-bound-variables-occurences" function which has an accumulator like trans
Christian Urban <urbanc@in.tum.de>
parents:
2826
diff
changeset
|
535 |
|
2667
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
parents:
2666
diff
changeset
|
536 |
nominal_datatype db = |
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
parents:
2666
diff
changeset
|
537 |
DBVar nat |
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
parents:
2666
diff
changeset
|
538 |
| DBApp db db |
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
parents:
2666
diff
changeset
|
539 |
| DBLam db |
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
parents:
2666
diff
changeset
|
540 |
|
2792
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2791
diff
changeset
|
541 |
instance db :: pure |
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2791
diff
changeset
|
542 |
apply default |
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2791
diff
changeset
|
543 |
apply (induct_tac x rule: db.induct) |
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2791
diff
changeset
|
544 |
apply (simp_all add: permute_pure) |
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2791
diff
changeset
|
545 |
done |
2795
929bd2dd1ab2
DeBruijn translation in a simplifier friendly way
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2794
diff
changeset
|
546 |
|
929bd2dd1ab2
DeBruijn translation in a simplifier friendly way
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2794
diff
changeset
|
547 |
lemma fresh_at_list: "atom x \<sharp> xs \<longleftrightarrow> x \<notin> set xs" |
929bd2dd1ab2
DeBruijn translation in a simplifier friendly way
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2794
diff
changeset
|
548 |
unfolding fresh_def supp_set[symmetric] |
2845
a99f488a96bb
Optimized proofs and removed some garbage.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2843
diff
changeset
|
549 |
by (induct xs) (auto simp add: supp_of_finite_insert supp_at_base supp_set_empty) |
2795
929bd2dd1ab2
DeBruijn translation in a simplifier friendly way
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2794
diff
changeset
|
550 |
|
2800
6e518b436740
DB translation using index; easier to reason about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2799
diff
changeset
|
551 |
fun |
6e518b436740
DB translation using index; easier to reason about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2799
diff
changeset
|
552 |
vindex :: "name list \<Rightarrow> name \<Rightarrow> nat \<Rightarrow> db option" |
2792
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2791
diff
changeset
|
553 |
where |
2800
6e518b436740
DB translation using index; easier to reason about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2799
diff
changeset
|
554 |
"vindex [] v n = None" |
6e518b436740
DB translation using index; easier to reason about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2799
diff
changeset
|
555 |
| "vindex (h # t) v n = (if v = h then (Some (DBVar n)) else (vindex t v (Suc n)))" |
6e518b436740
DB translation using index; easier to reason about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2799
diff
changeset
|
556 |
|
6e518b436740
DB translation using index; easier to reason about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2799
diff
changeset
|
557 |
lemma vindex_eqvt[eqvt]: |
6e518b436740
DB translation using index; easier to reason about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2799
diff
changeset
|
558 |
"(p \<bullet> vindex l v n) = vindex (p \<bullet> l) (p \<bullet> v) (p \<bullet> n)" |
6e518b436740
DB translation using index; easier to reason about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2799
diff
changeset
|
559 |
by (induct l arbitrary: n) (simp_all add: permute_pure) |
6e518b436740
DB translation using index; easier to reason about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2799
diff
changeset
|
560 |
|
6e518b436740
DB translation using index; easier to reason about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2799
diff
changeset
|
561 |
nominal_primrec |
2822
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
parents:
2821
diff
changeset
|
562 |
transdb :: "lam \<Rightarrow> name list \<Rightarrow> db option" |
2800
6e518b436740
DB translation using index; easier to reason about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2799
diff
changeset
|
563 |
where |
2822
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
parents:
2821
diff
changeset
|
564 |
"transdb (Var x) l = vindex l x 0" |
2950
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
parents:
2948
diff
changeset
|
565 |
| "transdb (App t1 t2) xs = |
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
parents:
2948
diff
changeset
|
566 |
Option.bind (transdb t1 xs) (\<lambda>d1. Option.bind (transdb t2 xs) (\<lambda>d2. Some (DBApp d1 d2)))" |
2942
fac8895b109a
Express trans_db with Option.map and Option.bind. Possibly mbind is a copy of bind?
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2941
diff
changeset
|
567 |
| "x \<notin> set xs \<Longrightarrow> transdb (Lam [x].t) xs = Option.map DBLam (transdb t (x # xs))" |
3197
25d11b449e92
definition of an auxiliary graph in nominal-primrec definitions
Christian Urban <urbanc@in.tum.de>
parents:
3192
diff
changeset
|
568 |
apply(simp add: eqvt_def transdb_graph_aux_def) |
2822
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
parents:
2821
diff
changeset
|
569 |
apply(rule TrueI) |
2792
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2791
diff
changeset
|
570 |
apply (case_tac x) |
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2791
diff
changeset
|
571 |
apply (rule_tac y="a" and c="b" in lam.strong_exhaust) |
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
572 |
apply (auto simp add: fresh_star_def fresh_at_list)[3] |
3192
14c7d7e29c44
added a simproc for alpha-equivalence to the simplifier
Christian Urban <urbanc@in.tum.de>
parents:
3191
diff
changeset
|
573 |
using [[simproc del: alpha_lst]] |
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
574 |
apply(simp_all) |
2942
fac8895b109a
Express trans_db with Option.map and Option.bind. Possibly mbind is a copy of bind?
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2941
diff
changeset
|
575 |
apply(elim conjE) |
2912
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
parents:
2902
diff
changeset
|
576 |
apply (erule_tac c="xsa" in Abs_lst1_fcb2') |
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
577 |
apply (simp add: pure_fresh) |
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
578 |
apply(simp add: fresh_star_def fresh_at_list) |
3183
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3181
diff
changeset
|
579 |
apply(simp only: eqvt_at_def) |
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3181
diff
changeset
|
580 |
apply(perm_simp) |
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3181
diff
changeset
|
581 |
apply(simp) |
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3181
diff
changeset
|
582 |
apply(simp add: fresh_star_Pair perm_supp_eq) |
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3181
diff
changeset
|
583 |
apply(simp only: eqvt_at_def) |
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3181
diff
changeset
|
584 |
apply(perm_simp) |
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3181
diff
changeset
|
585 |
apply(simp) |
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3181
diff
changeset
|
586 |
apply(simp add: fresh_star_Pair perm_supp_eq) |
2792
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2791
diff
changeset
|
587 |
done |
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2791
diff
changeset
|
588 |
|
2973
d1038e67923a
added a flag (eqvt) to termination proofs arising fron nominal_primrecs
Christian Urban <urbanc@in.tum.de>
parents:
2972
diff
changeset
|
589 |
termination (eqvt) |
2858
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
parents:
2852
diff
changeset
|
590 |
by lexicographic_order |
2792
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2791
diff
changeset
|
591 |
|
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2791
diff
changeset
|
592 |
lemma db_trans_test: |
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2791
diff
changeset
|
593 |
assumes a: "y \<noteq> x" |
2858
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
parents:
2852
diff
changeset
|
594 |
shows "transdb (Lam [x]. Lam [y]. App (Var x) (Var y)) [] = |
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
parents:
2852
diff
changeset
|
595 |
Some (DBLam (DBLam (DBApp (DBVar 1) (DBVar 0))))" |
2795
929bd2dd1ab2
DeBruijn translation in a simplifier friendly way
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2794
diff
changeset
|
596 |
using a by simp |
2792
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2791
diff
changeset
|
597 |
|
2841
f8d660de0cf7
Eval can be defined with additional freshness
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2840
diff
changeset
|
598 |
lemma supp_subst: |
2972
84afb941df53
moved eqvt for Option.map
Christian Urban <urbanc@in.tum.de>
parents:
2951
diff
changeset
|
599 |
shows "supp (t[x ::= s]) \<subseteq> (supp t - {atom x}) \<union> supp s" |
84afb941df53
moved eqvt for Option.map
Christian Urban <urbanc@in.tum.de>
parents:
2951
diff
changeset
|
600 |
by (induct t x s rule: subst.induct) (auto simp add: lam.supp supp_at_base) |
2841
f8d660de0cf7
Eval can be defined with additional freshness
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2840
diff
changeset
|
601 |
|
f8d660de0cf7
Eval can be defined with additional freshness
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2840
diff
changeset
|
602 |
lemma var_fresh_subst: |
f8d660de0cf7
Eval can be defined with additional freshness
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2840
diff
changeset
|
603 |
"atom x \<sharp> s \<Longrightarrow> atom x \<sharp> (t[x ::= s])" |
3181
ca162f0a7957
added to the simplifier nominal_datatype.fresh lemmas
Christian Urban <urbanc@in.tum.de>
parents:
3174
diff
changeset
|
604 |
by (induct t x s rule: subst.induct) (auto simp add: lam.supp fresh_at_base) |
2841
f8d660de0cf7
Eval can be defined with additional freshness
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2840
diff
changeset
|
605 |
|
2834 | 606 |
(* function that evaluates a lambda term *) |
607 |
nominal_primrec |
|
608 |
eval :: "lam \<Rightarrow> lam" and |
|
2860
25a7f421a3ba
added a test that every function must be of pt-sort
Christian Urban <urbanc@in.tum.de>
parents:
2858
diff
changeset
|
609 |
apply_subst :: "lam \<Rightarrow> lam \<Rightarrow> lam" |
2834 | 610 |
where |
611 |
"eval (Var x) = Var x" |
|
612 |
| "eval (Lam [x].t) = Lam [x].(eval t)" |
|
2860
25a7f421a3ba
added a test that every function must be of pt-sort
Christian Urban <urbanc@in.tum.de>
parents:
2858
diff
changeset
|
613 |
| "eval (App t1 t2) = apply_subst (eval t1) (eval t2)" |
25a7f421a3ba
added a test that every function must be of pt-sort
Christian Urban <urbanc@in.tum.de>
parents:
2858
diff
changeset
|
614 |
| "apply_subst (Var x) t2 = App (Var x) t2" |
25a7f421a3ba
added a test that every function must be of pt-sort
Christian Urban <urbanc@in.tum.de>
parents:
2858
diff
changeset
|
615 |
| "apply_subst (App t0 t1) t2 = App (App t0 t1) t2" |
25a7f421a3ba
added a test that every function must be of pt-sort
Christian Urban <urbanc@in.tum.de>
parents:
2858
diff
changeset
|
616 |
| "atom x \<sharp> t2 \<Longrightarrow> apply_subst (Lam [x].t1) t2 = eval (t1[x::= t2])" |
3197
25d11b449e92
definition of an auxiliary graph in nominal-primrec definitions
Christian Urban <urbanc@in.tum.de>
parents:
3192
diff
changeset
|
617 |
apply(simp add: eval_apply_subst_graph_aux_def eqvt_def) |
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
618 |
apply(rule TrueI) |
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
619 |
apply (case_tac x) |
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
620 |
apply (case_tac a rule: lam.exhaust) |
3192
14c7d7e29c44
added a simproc for alpha-equivalence to the simplifier
Christian Urban <urbanc@in.tum.de>
parents:
3191
diff
changeset
|
621 |
using [[simproc del: alpha_lst]] |
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
622 |
apply simp_all[3] |
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
623 |
apply blast |
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
624 |
apply (case_tac b) |
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
625 |
apply (rule_tac y="a" and c="ba" in lam.strong_exhaust) |
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
626 |
apply simp_all[3] |
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
627 |
apply blast |
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
628 |
apply blast |
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
629 |
apply (simp add: Abs1_eq_iff fresh_star_def) |
3192
14c7d7e29c44
added a simproc for alpha-equivalence to the simplifier
Christian Urban <urbanc@in.tum.de>
parents:
3191
diff
changeset
|
630 |
using [[simproc del: alpha_lst]] |
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
631 |
apply(simp_all) |
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
632 |
apply(erule_tac c="()" in Abs_lst1_fcb2) |
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
633 |
apply (simp add: Abs_fresh_iff) |
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
634 |
apply(simp add: fresh_star_def fresh_Unit) |
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
635 |
apply(simp add: eqvt_at_def atom_eqvt fresh_star_Pair perm_supp_eq) |
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
636 |
apply(simp add: eqvt_at_def atom_eqvt fresh_star_Pair perm_supp_eq) |
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
637 |
apply(erule conjE) |
2912
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
parents:
2902
diff
changeset
|
638 |
apply(erule_tac c="t2a" in Abs_lst1_fcb2') |
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
639 |
apply (erule fresh_eqvt_at) |
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
640 |
apply (simp add: finite_supp) |
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2891
diff
changeset
|
641 |
apply (simp add: fresh_Inl var_fresh_subst) |
2912
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
parents:
2902
diff
changeset
|
642 |
apply(simp add: fresh_star_def) |
3183
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3181
diff
changeset
|
643 |
apply(simp only: eqvt_at_def) |
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3181
diff
changeset
|
644 |
apply(perm_simp) |
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3181
diff
changeset
|
645 |
apply(simp add: fresh_star_Pair perm_supp_eq) |
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3181
diff
changeset
|
646 |
apply(simp only: eqvt_at_def) |
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3181
diff
changeset
|
647 |
apply(perm_simp) |
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3181
diff
changeset
|
648 |
apply(simp add: fresh_star_Pair perm_supp_eq) |
2860
25a7f421a3ba
added a test that every function must be of pt-sort
Christian Urban <urbanc@in.tum.de>
parents:
2858
diff
changeset
|
649 |
done |
25a7f421a3ba
added a test that every function must be of pt-sort
Christian Urban <urbanc@in.tum.de>
parents:
2858
diff
changeset
|
650 |
|
25a7f421a3ba
added a test that every function must be of pt-sort
Christian Urban <urbanc@in.tum.de>
parents:
2858
diff
changeset
|
651 |
|
2846
1d43d30e44c9
Move working examples before non-working ones
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2845
diff
changeset
|
652 |
nominal_primrec |
1d43d30e44c9
Move working examples before non-working ones
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2845
diff
changeset
|
653 |
map_term :: "(lam \<Rightarrow> lam) \<Rightarrow> lam \<Rightarrow> lam" |
1d43d30e44c9
Move working examples before non-working ones
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2845
diff
changeset
|
654 |
where |
1d43d30e44c9
Move working examples before non-working ones
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2845
diff
changeset
|
655 |
"eqvt f \<Longrightarrow> map_term f (Var x) = f (Var x)" |
1d43d30e44c9
Move working examples before non-working ones
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2845
diff
changeset
|
656 |
| "eqvt f \<Longrightarrow> map_term f (App t1 t2) = App (f t1) (f t2)" |
1d43d30e44c9
Move working examples before non-working ones
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2845
diff
changeset
|
657 |
| "eqvt f \<Longrightarrow> map_term f (Lam [x].t) = Lam [x].(f t)" |
1d43d30e44c9
Move working examples before non-working ones
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2845
diff
changeset
|
658 |
| "\<not>eqvt f \<Longrightarrow> map_term f t = t" |
3197
25d11b449e92
definition of an auxiliary graph in nominal-primrec definitions
Christian Urban <urbanc@in.tum.de>
parents:
3192
diff
changeset
|
659 |
apply (simp add: eqvt_def map_term_graph_aux_def) |
2846
1d43d30e44c9
Move working examples before non-working ones
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2845
diff
changeset
|
660 |
apply(rule TrueI) |
1d43d30e44c9
Move working examples before non-working ones
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2845
diff
changeset
|
661 |
apply (case_tac x, case_tac "eqvt a", case_tac b rule: lam.exhaust) |
3192
14c7d7e29c44
added a simproc for alpha-equivalence to the simplifier
Christian Urban <urbanc@in.tum.de>
parents:
3191
diff
changeset
|
662 |
using [[simproc del: alpha_lst]] |
2846
1d43d30e44c9
Move working examples before non-working ones
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2845
diff
changeset
|
663 |
apply auto |
1d43d30e44c9
Move working examples before non-working ones
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2845
diff
changeset
|
664 |
apply (erule Abs_lst1_fcb) |
1d43d30e44c9
Move working examples before non-working ones
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2845
diff
changeset
|
665 |
apply (simp_all add: Abs_fresh_iff fresh_fun_eqvt_app) |
1d43d30e44c9
Move working examples before non-working ones
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2845
diff
changeset
|
666 |
apply (simp add: eqvt_def permute_fun_app_eq) |
1d43d30e44c9
Move working examples before non-working ones
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2845
diff
changeset
|
667 |
done |
1d43d30e44c9
Move working examples before non-working ones
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2845
diff
changeset
|
668 |
|
2973
d1038e67923a
added a flag (eqvt) to termination proofs arising fron nominal_primrecs
Christian Urban <urbanc@in.tum.de>
parents:
2972
diff
changeset
|
669 |
termination (eqvt) |
2858
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
parents:
2852
diff
changeset
|
670 |
by lexicographic_order |
2846
1d43d30e44c9
Move working examples before non-working ones
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2845
diff
changeset
|
671 |
|
2950
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
parents:
2948
diff
changeset
|
672 |
|
1594 | 673 |
end |
674 |
||
675 |
||
676 |