author | Christian Urban <urbanc@in.tum.de> |
Tue, 03 May 2011 13:09:08 +0100 | |
changeset 2777 | 75a95431cd8b |
parent 2769 | 810e7303c70d |
child 2779 | 3c769bf10e63 |
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 |
2454
9ffee4eb1ae1
renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
2442
diff
changeset
|
2 |
imports "../Nominal2" |
1594 | 3 |
begin |
4 |
||
2765
7ac5e5c86c7d
introduced framework for finetuning eqvt-rules; this solves problem with permute_pure called in nominal_inductive
Christian Urban <urbanc@in.tum.de>
parents:
2729
diff
changeset
|
5 |
|
1594 | 6 |
atom_decl name |
7 |
||
2436
3885dc2669f9
cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents:
2434
diff
changeset
|
8 |
nominal_datatype lam = |
1800
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
parents:
1797
diff
changeset
|
9 |
Var "name" |
2436
3885dc2669f9
cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents:
2434
diff
changeset
|
10 |
| App "lam" "lam" |
2683
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
11 |
| Lam x::"name" l::"lam" bind 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
|
12 |
|
2765
7ac5e5c86c7d
introduced framework for finetuning eqvt-rules; this solves problem with permute_pure called in nominal_inductive
Christian Urban <urbanc@in.tum.de>
parents:
2729
diff
changeset
|
13 |
inductive |
7ac5e5c86c7d
introduced framework for finetuning eqvt-rules; this solves problem with permute_pure called in nominal_inductive
Christian Urban <urbanc@in.tum.de>
parents:
2729
diff
changeset
|
14 |
triv :: "lam \<Rightarrow> nat \<Rightarrow> bool" |
7ac5e5c86c7d
introduced framework for finetuning eqvt-rules; this solves problem with permute_pure called in nominal_inductive
Christian Urban <urbanc@in.tum.de>
parents:
2729
diff
changeset
|
15 |
where |
7ac5e5c86c7d
introduced framework for finetuning eqvt-rules; this solves problem with permute_pure called in nominal_inductive
Christian Urban <urbanc@in.tum.de>
parents:
2729
diff
changeset
|
16 |
Var: "triv (Var x) n" |
7ac5e5c86c7d
introduced framework for finetuning eqvt-rules; this solves problem with permute_pure called in nominal_inductive
Christian Urban <urbanc@in.tum.de>
parents:
2729
diff
changeset
|
17 |
|
2777
75a95431cd8b
proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents:
2769
diff
changeset
|
18 |
lemma |
75a95431cd8b
proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents:
2769
diff
changeset
|
19 |
"p \<bullet> (triv t x) = triv (p \<bullet> t) (p \<bullet> x)" |
75a95431cd8b
proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents:
2769
diff
changeset
|
20 |
unfolding triv_def |
75a95431cd8b
proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents:
2769
diff
changeset
|
21 |
apply(perm_simp) |
75a95431cd8b
proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents:
2769
diff
changeset
|
22 |
oops |
75a95431cd8b
proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents:
2769
diff
changeset
|
23 |
(*apply(perm_simp)*) |
75a95431cd8b
proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents:
2769
diff
changeset
|
24 |
|
2765
7ac5e5c86c7d
introduced framework for finetuning eqvt-rules; this solves problem with permute_pure called in nominal_inductive
Christian Urban <urbanc@in.tum.de>
parents:
2729
diff
changeset
|
25 |
equivariance triv |
2768
639979b7fa6e
added permute_pure back into the nominal_inductive procedure; updated to Isabelle 17 April
Christian Urban <urbanc@in.tum.de>
parents:
2765
diff
changeset
|
26 |
nominal_inductive triv avoids Var: "{}::name set" |
639979b7fa6e
added permute_pure back into the nominal_inductive procedure; updated to Isabelle 17 April
Christian Urban <urbanc@in.tum.de>
parents:
2765
diff
changeset
|
27 |
apply(auto simp add: fresh_star_def) |
639979b7fa6e
added permute_pure back into the nominal_inductive procedure; updated to Isabelle 17 April
Christian Urban <urbanc@in.tum.de>
parents:
2765
diff
changeset
|
28 |
done |
639979b7fa6e
added permute_pure back into the nominal_inductive procedure; updated to Isabelle 17 April
Christian Urban <urbanc@in.tum.de>
parents:
2765
diff
changeset
|
29 |
|
639979b7fa6e
added permute_pure back into the nominal_inductive procedure; updated to Isabelle 17 April
Christian Urban <urbanc@in.tum.de>
parents:
2765
diff
changeset
|
30 |
inductive |
639979b7fa6e
added permute_pure back into the nominal_inductive procedure; updated to Isabelle 17 April
Christian Urban <urbanc@in.tum.de>
parents:
2765
diff
changeset
|
31 |
triv2 :: "lam \<Rightarrow> nat \<Rightarrow> bool" |
639979b7fa6e
added permute_pure back into the nominal_inductive procedure; updated to Isabelle 17 April
Christian Urban <urbanc@in.tum.de>
parents:
2765
diff
changeset
|
32 |
where |
639979b7fa6e
added permute_pure back into the nominal_inductive procedure; updated to Isabelle 17 April
Christian Urban <urbanc@in.tum.de>
parents:
2765
diff
changeset
|
33 |
Var1: "triv2 (Var x) 0" |
639979b7fa6e
added permute_pure back into the nominal_inductive procedure; updated to Isabelle 17 April
Christian Urban <urbanc@in.tum.de>
parents:
2765
diff
changeset
|
34 |
| Var2: "triv2 (Var x) (n + n)" |
639979b7fa6e
added permute_pure back into the nominal_inductive procedure; updated to Isabelle 17 April
Christian Urban <urbanc@in.tum.de>
parents:
2765
diff
changeset
|
35 |
| Var3: "triv2 (Var x) n" |
639979b7fa6e
added permute_pure back into the nominal_inductive procedure; updated to Isabelle 17 April
Christian Urban <urbanc@in.tum.de>
parents:
2765
diff
changeset
|
36 |
|
639979b7fa6e
added permute_pure back into the nominal_inductive procedure; updated to Isabelle 17 April
Christian Urban <urbanc@in.tum.de>
parents:
2765
diff
changeset
|
37 |
equivariance triv2 |
639979b7fa6e
added permute_pure back into the nominal_inductive procedure; updated to Isabelle 17 April
Christian Urban <urbanc@in.tum.de>
parents:
2765
diff
changeset
|
38 |
nominal_inductive triv2 . |
2765
7ac5e5c86c7d
introduced framework for finetuning eqvt-rules; this solves problem with permute_pure called in nominal_inductive
Christian Urban <urbanc@in.tum.de>
parents:
2729
diff
changeset
|
39 |
|
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
|
40 |
lemma Abs1_eq_fdest: |
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
|
41 |
fixes x y :: "'a :: at_base" |
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
|
42 |
and S T :: "'b :: fs" |
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
|
43 |
assumes "(Abs_lst [atom x] T) = (Abs_lst [atom y] S)" |
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
|
44 |
and "x \<noteq> y \<Longrightarrow> atom y \<sharp> T \<Longrightarrow> atom x \<sharp> f x T" |
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
|
45 |
and "x \<noteq> y \<Longrightarrow> atom y \<sharp> T \<Longrightarrow> atom y \<sharp> f x T" |
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
|
46 |
and "x \<noteq> y \<Longrightarrow> atom y \<sharp> T \<Longrightarrow> (atom x \<rightleftharpoons> atom y) \<bullet> T = S \<Longrightarrow> (atom x \<rightleftharpoons> atom y) \<bullet> (f x T) = f y S" |
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
|
47 |
and "sort_of (atom x) = sort_of (atom 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
|
48 |
shows "f x T = f y S" |
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
|
49 |
using assms apply - |
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
|
50 |
apply (subst (asm) Abs1_eq_iff') |
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
|
51 |
apply 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
|
52 |
apply (elim conjE disjE) |
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
|
53 |
apply 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
|
54 |
apply(rule trans) |
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
|
55 |
apply (rule_tac p="(atom x \<rightleftharpoons> atom y)" in supp_perm_eq[symmetric]) |
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
|
56 |
apply(rule fresh_star_supp_conv) |
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
|
57 |
apply(simp add: supp_swap fresh_star_def) |
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
|
58 |
apply(simp add: swap_commute) |
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
|
59 |
done |
2765
7ac5e5c86c7d
introduced framework for finetuning eqvt-rules; this solves problem with permute_pure called in nominal_inductive
Christian Urban <urbanc@in.tum.de>
parents:
2729
diff
changeset
|
60 |
|
2683
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
61 |
text {* height function *} |
2431
331873ebc5cd
can now deal with type variables in nominal datatype definitions
Christian Urban <urbanc@in.tum.de>
parents:
2425
diff
changeset
|
62 |
|
2666
324a5d1289a3
added a few examples of functions to Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2664
diff
changeset
|
63 |
nominal_primrec |
2678
494b859bfc16
defined height as a function that returns an integer
Christian Urban <urbanc@in.tum.de>
parents:
2675
diff
changeset
|
64 |
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
|
65 |
where |
2678
494b859bfc16
defined height as a function that returns an integer
Christian Urban <urbanc@in.tum.de>
parents:
2675
diff
changeset
|
66 |
"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
|
67 |
| "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
|
68 |
| "height (Lam [x].t) = height t + 1" |
2707
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
69 |
defer |
2666
324a5d1289a3
added a few examples of functions to Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2664
diff
changeset
|
70 |
apply(rule_tac y="x" in lam.exhaust) |
2683
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
71 |
apply(auto simp add: lam.distinct lam.eq_iff) |
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
|
72 |
apply (erule Abs1_eq_fdest) |
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
|
73 |
apply(simp_all add: fresh_def pure_supp eqvt_at_def) |
2707
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
74 |
apply(subgoal_tac "\<And>p x r. height_graph x r \<Longrightarrow> height_graph (p \<bullet> x) (p \<bullet> r)") |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
75 |
unfolding eqvt_def |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
76 |
apply(rule allI) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
77 |
apply(simp add: permute_fun_def) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
78 |
apply(rule ext) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
79 |
apply(rule ext) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
80 |
apply(simp add: permute_bool_def) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
81 |
apply(rule iffI) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
82 |
apply(drule_tac x="p" in meta_spec) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
83 |
apply(drule_tac x="- p \<bullet> x" in meta_spec) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
84 |
apply(drule_tac x="- p \<bullet> xa" in meta_spec) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
85 |
apply(simp) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
86 |
apply(drule_tac x="-p" in meta_spec) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
87 |
apply(drule_tac x="x" in meta_spec) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
88 |
apply(drule_tac x="xa" in meta_spec) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
89 |
apply(simp) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
90 |
apply(erule height_graph.induct) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
91 |
apply(perm_simp) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
92 |
apply(rule height_graph.intros) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
93 |
apply(perm_simp) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
94 |
apply(rule height_graph.intros) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
95 |
apply(assumption) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
96 |
apply(assumption) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
97 |
apply(perm_simp) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
98 |
apply(rule height_graph.intros) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
99 |
apply(assumption) |
2666
324a5d1289a3
added a few examples of functions to Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2664
diff
changeset
|
100 |
done |
324a5d1289a3
added a few examples of functions to Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2664
diff
changeset
|
101 |
|
324a5d1289a3
added a few examples of functions to Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2664
diff
changeset
|
102 |
termination |
2683
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
103 |
by (relation "measure size") (simp_all add: lam.size) |
2666
324a5d1289a3
added a few examples of functions to Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2664
diff
changeset
|
104 |
|
2707
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
105 |
thm height.simps |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
106 |
|
2683
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
107 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
108 |
text {* free name function - returns atom lists *} |
2666
324a5d1289a3
added a few examples of functions to Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2664
diff
changeset
|
109 |
|
324a5d1289a3
added a few examples of functions to Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2664
diff
changeset
|
110 |
nominal_primrec |
324a5d1289a3
added a few examples of functions to Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2664
diff
changeset
|
111 |
frees_lst :: "lam \<Rightarrow> atom list" |
324a5d1289a3
added a few examples of functions to Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2664
diff
changeset
|
112 |
where |
324a5d1289a3
added a few examples of functions to Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2664
diff
changeset
|
113 |
"frees_lst (Var x) = [atom x]" |
2683
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
114 |
| "frees_lst (App t1 t2) = frees_lst t1 @ frees_lst t2" |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
115 |
| "frees_lst (Lam [x]. t) = removeAll (atom x) (frees_lst t)" |
2707
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
116 |
defer |
2666
324a5d1289a3
added a few examples of functions to Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2664
diff
changeset
|
117 |
apply(rule_tac y="x" in lam.exhaust) |
324a5d1289a3
added a few examples of functions to Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2664
diff
changeset
|
118 |
apply(simp_all)[3] |
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
|
119 |
apply(simp_all add: lam.distinct lam.eq_iff) |
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
|
120 |
apply (erule Abs1_eq_fdest) |
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
|
121 |
apply(simp add: supp_removeAll fresh_def) |
2666
324a5d1289a3
added a few examples of functions to Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2664
diff
changeset
|
122 |
apply(drule supp_eqvt_at) |
324a5d1289a3
added a few examples of functions to Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2664
diff
changeset
|
123 |
apply(simp add: finite_supp) |
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
|
124 |
apply(auto simp add: fresh_def supp_removeAll eqvts eqvt_at_def) |
2707
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
125 |
apply(subgoal_tac "\<And>p x r. frees_lst_graph x r \<Longrightarrow> frees_lst_graph (p \<bullet> x) (p \<bullet> r)") |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
126 |
unfolding eqvt_def |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
127 |
apply(rule allI) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
128 |
apply(simp add: permute_fun_def) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
129 |
apply(rule ext) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
130 |
apply(rule ext) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
131 |
apply(simp add: permute_bool_def) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
132 |
apply(rule iffI) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
133 |
apply(drule_tac x="p" in meta_spec) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
134 |
apply(drule_tac x="- p \<bullet> x" in meta_spec) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
135 |
apply(drule_tac x="- p \<bullet> xa" in meta_spec) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
136 |
apply(simp) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
137 |
apply(drule_tac x="-p" in meta_spec) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
138 |
apply(drule_tac x="x" in meta_spec) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
139 |
apply(drule_tac x="xa" in meta_spec) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
140 |
apply(simp) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
141 |
apply(erule frees_lst_graph.induct) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
142 |
apply(perm_simp) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
143 |
apply(rule frees_lst_graph.intros) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
144 |
apply(perm_simp) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
145 |
apply(rule frees_lst_graph.intros) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
146 |
apply(assumption) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
147 |
apply(assumption) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
148 |
apply(perm_simp) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
149 |
apply(rule frees_lst_graph.intros) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
150 |
apply(assumption) |
2666
324a5d1289a3
added a few examples of functions to Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2664
diff
changeset
|
151 |
done |
324a5d1289a3
added a few examples of functions to Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2664
diff
changeset
|
152 |
|
324a5d1289a3
added a few examples of functions to Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2664
diff
changeset
|
153 |
termination |
324a5d1289a3
added a few examples of functions to Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2664
diff
changeset
|
154 |
apply(relation "measure size") |
324a5d1289a3
added a few examples of functions to Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2664
diff
changeset
|
155 |
apply(simp_all add: lam.size) |
324a5d1289a3
added a few examples of functions to Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2664
diff
changeset
|
156 |
done |
324a5d1289a3
added a few examples of functions to Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2664
diff
changeset
|
157 |
|
2683
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
158 |
text {* a small test lemma *} |
2666
324a5d1289a3
added a few examples of functions to Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2664
diff
changeset
|
159 |
lemma |
2683
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
160 |
shows "supp t = set (frees_lst t)" |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
161 |
apply(induct t rule: frees_lst.induct) |
2666
324a5d1289a3
added a few examples of functions to Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2664
diff
changeset
|
162 |
apply(simp_all add: lam.supp supp_at_base) |
324a5d1289a3
added a few examples of functions to Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2664
diff
changeset
|
163 |
done |
324a5d1289a3
added a few examples of functions to Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2664
diff
changeset
|
164 |
|
2683
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
165 |
text {* capture - avoiding substitution *} |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
166 |
|
2675
68ccf847507d
defined properly substitution
Christian Urban <urbanc@in.tum.de>
parents:
2669
diff
changeset
|
167 |
nominal_primrec |
2683
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
168 |
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
|
169 |
where |
2683
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
170 |
"(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
|
171 |
| "(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
|
172 |
| "atom x \<sharp> (y, s) \<Longrightarrow> (Lam [x]. t)[y ::= s] = Lam [x].(t[y ::= s])" |
2707
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
173 |
defer |
2683
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
174 |
apply(auto simp add: lam.distinct lam.eq_iff) |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
175 |
apply(rule_tac y="a" and c="(aa, b)" in lam.strong_exhaust) |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
176 |
apply(blast)+ |
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
|
177 |
apply(simp_all add: fresh_star_def fresh_Pair_elim) |
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
|
178 |
apply (erule Abs1_eq_fdest) |
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
|
179 |
apply(simp_all add: Abs_fresh_iff) |
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
|
180 |
apply(drule_tac a="atom (xa)" in fresh_eqvt_at) |
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
|
181 |
apply(simp_all add: finite_supp fresh_Pair) |
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
|
182 |
apply(subgoal_tac "(atom x \<rightleftharpoons> atom xa) \<bullet> sa = sa") |
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
|
183 |
apply(subgoal_tac "(atom x \<rightleftharpoons> atom xa) \<bullet> ya = ya") |
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
|
184 |
apply(simp add: eqvt_at_def) |
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
|
185 |
apply(rule perm_supp_eq,simp add: fresh_star_def fresh_Pair supp_swap)+ |
2707
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
186 |
apply(subgoal_tac "\<And>p x r. subst_graph x r \<Longrightarrow> subst_graph (p \<bullet> x) (p \<bullet> r)") |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
187 |
unfolding eqvt_def |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
188 |
apply(rule allI) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
189 |
apply(simp add: permute_fun_def) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
190 |
apply(rule ext) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
191 |
apply(rule ext) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
192 |
apply(simp add: permute_bool_def) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
193 |
apply(rule iffI) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
194 |
apply(drule_tac x="p" in meta_spec) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
195 |
apply(drule_tac x="- p \<bullet> x" in meta_spec) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
196 |
apply(drule_tac x="- p \<bullet> xa" in meta_spec) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
197 |
apply(simp) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
198 |
apply(drule_tac x="-p" in meta_spec) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
199 |
apply(drule_tac x="x" in meta_spec) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
200 |
apply(drule_tac x="xa" in meta_spec) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
201 |
apply(simp) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
202 |
apply(erule subst_graph.induct) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
203 |
apply(perm_simp) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
204 |
apply(rule subst_graph.intros) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
205 |
apply(perm_simp) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
206 |
apply(rule subst_graph.intros) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
207 |
apply(assumption) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
208 |
apply(assumption) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
209 |
apply(perm_simp) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
210 |
apply(rule subst_graph.intros) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
211 |
apply(simp add: fresh_Pair) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
212 |
apply(assumption) |
2675
68ccf847507d
defined properly substitution
Christian Urban <urbanc@in.tum.de>
parents:
2669
diff
changeset
|
213 |
done |
68ccf847507d
defined properly substitution
Christian Urban <urbanc@in.tum.de>
parents:
2669
diff
changeset
|
214 |
|
2678
494b859bfc16
defined height as a function that returns an integer
Christian Urban <urbanc@in.tum.de>
parents:
2675
diff
changeset
|
215 |
termination |
2683
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
216 |
by (relation "measure (\<lambda>(t,_,_). size t)") |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
217 |
(simp_all add: lam.size) |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
218 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
219 |
lemma subst_eqvt[eqvt]: |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
220 |
shows "(p \<bullet> t[x ::= s]) = (p \<bullet> t)[(p \<bullet> x) ::= (p \<bullet> s)]" |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
221 |
by (induct t x s rule: subst.induct) (simp_all) |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
222 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
223 |
lemma forget: |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
224 |
shows "atom x \<sharp> t \<Longrightarrow> t[x ::= s] = t" |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
225 |
apply(nominal_induct t avoiding: x s 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
|
226 |
apply(auto simp add: lam.fresh fresh_at_base) |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
227 |
done |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
228 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
229 |
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
|
230 |
lemma forget2: |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
231 |
shows "atom x \<sharp> t \<Longrightarrow> t[x ::= s] = t" |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
232 |
apply(induct t x s rule: subst.induct) |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
233 |
apply(auto simp add: lam.fresh fresh_at_base fresh_Pair) |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
234 |
done |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
235 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
236 |
lemma fresh_fact: |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
237 |
fixes z::"name" |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
238 |
assumes a: "atom z \<sharp> s" |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
239 |
and b: "z = y \<or> atom z \<sharp> t" |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
240 |
shows "atom z \<sharp> t[y ::= s]" |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
241 |
using a b |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
242 |
apply (nominal_induct t avoiding: z y s 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
|
243 |
apply (auto simp add: lam.fresh fresh_at_base) |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
244 |
done |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
245 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
246 |
lemma substitution_lemma: |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
247 |
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
|
248 |
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
|
249 |
using a |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
250 |
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
|
251 |
(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
|
252 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
253 |
lemma subst_rename: |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
254 |
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
|
255 |
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
|
256 |
using a |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
257 |
apply (nominal_induct t avoiding: x y s 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
|
258 |
apply (auto simp add: lam.fresh fresh_at_base) |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
259 |
done |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
260 |
|
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
|
261 |
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
|
262 |
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
|
263 |
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
|
264 |
|
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
|
265 |
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
|
266 |
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
|
267 |
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
|
268 |
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
|
269 |
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
|
270 |
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
|
271 |
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
|
272 |
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
|
273 |
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
|
274 |
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
|
275 |
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
|
276 |
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
|
277 |
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
|
278 |
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
|
279 |
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
|
280 |
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
|
281 |
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
|
282 |
qed |
2683
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
283 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
284 |
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
|
285 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
286 |
inductive |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
287 |
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
|
288 |
where |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
289 |
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
|
290 |
| 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
|
291 |
| 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
|
292 |
| 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
|
293 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
294 |
equivariance beta |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
295 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
296 |
nominal_inductive beta |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
297 |
avoids b4: "x" |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
298 |
by (simp_all add: fresh_star_def fresh_Pair lam.fresh fresh_fact) |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
299 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
300 |
text {* One-Reduction *} |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
301 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
302 |
inductive |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
303 |
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
|
304 |
where |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
305 |
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
|
306 |
| 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
|
307 |
| 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
|
308 |
| 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
|
309 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
310 |
equivariance One |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
311 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
312 |
nominal_inductive One |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
313 |
avoids o3: "x" |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
314 |
| o4: "x" |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
315 |
by (simp_all add: fresh_star_def fresh_Pair lam.fresh fresh_fact) |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
316 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
317 |
lemma One_refl: |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
318 |
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
|
319 |
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
|
320 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
321 |
lemma One_subst: |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
322 |
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
|
323 |
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
|
324 |
using a |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
325 |
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
|
326 |
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
|
327 |
done |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
328 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
329 |
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
|
330 |
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
|
331 |
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
|
332 |
proof - |
2685
1df873b63cb2
added obtain_fresh lemma; tuned Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2683
diff
changeset
|
333 |
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
|
334 |
have "App (Lam [x]. t1) s1 = App (Lam [y]. ((y \<leftrightarrow> x) \<bullet> t1)) s1" using fs |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
335 |
by (auto simp add: lam.eq_iff Abs1_eq_iff' flip_def fresh_Pair fresh_at_base) |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
336 |
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
|
337 |
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
|
338 |
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
|
339 |
qed |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
340 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
341 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
342 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
343 |
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
|
344 |
|
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
|
345 |
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
|
346 |
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
|
347 |
| 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
|
348 |
| 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
|
349 |
| 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
|
350 |
|
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
|
351 |
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
|
352 |
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
|
353 |
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
|
354 |
"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
|
355 |
| "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
|
356 |
|
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
|
357 |
lemma [eqvt]: |
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
|
358 |
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
|
359 |
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
|
360 |
|
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
|
361 |
nominal_primrec |
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
|
362 |
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
|
363 |
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
|
364 |
"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
|
365 |
| "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
|
366 |
| "atom x \<sharp> xs \<Longrightarrow> trans (Lam [x]. t) xs = LNLam (trans t (x # xs))" |
2707
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
367 |
defer |
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
|
368 |
apply(case_tac 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
|
369 |
apply(simp) |
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
|
370 |
apply(rule_tac y="a" and c="b" in lam.strong_exhaust) |
2729
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
371 |
apply(simp_all add: fresh_star_def)[3] |
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
|
372 |
apply(blast) |
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
|
373 |
apply(blast) |
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
|
374 |
apply(simp_all add: lam.distinct lam.eq_iff) |
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
|
375 |
apply(elim conjE) |
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
|
376 |
apply clarify |
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
|
377 |
apply (erule Abs1_eq_fdest) |
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
|
378 |
apply (simp_all add: ln.fresh) |
2675
68ccf847507d
defined properly substitution
Christian Urban <urbanc@in.tum.de>
parents:
2669
diff
changeset
|
379 |
prefer 2 |
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
|
380 |
apply(drule supp_eqvt_at) |
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
|
381 |
apply (auto simp add: finite_supp supp_Pair fresh_def supp_Cons supp_at_base)[2] |
2729
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
382 |
prefer 2 |
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
|
383 |
apply (subgoal_tac "(atom x \<rightleftharpoons> atom xa) \<bullet> xsa = xsa") |
2729
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
384 |
apply (simp add: eqvt_at_def) |
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
|
385 |
apply (metis atom_name_def swap_fresh_fresh) |
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
|
386 |
oops |
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
|
387 |
|
2729
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
388 |
(* lemma helpr: "atom x \<sharp> ta \<Longrightarrow> Lam [xa]. ta = Lam [x]. ((xa \<leftrightarrow> x) \<bullet> ta)" |
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
389 |
apply (case_tac "x = xa") |
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
390 |
apply simp |
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
391 |
apply (simp add: lam.eq_iff Abs1_eq_iff flip_def[symmetric]) |
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
392 |
by (metis atom_eqvt flip_at_simps(2) fresh_permute_iff) |
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
393 |
|
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
394 |
lemma supp_lookup: "supp (lookup l n name) = {atom name} - supp l" |
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
395 |
apply (induct l arbitrary: n) |
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
396 |
apply (simp_all add: ln.supp supp_at_base supp_Nil supp_Cons pure_supp) |
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
397 |
done |
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
398 |
|
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
399 |
lemma trans_eqvt[eqvt]: "p \<bullet> (trans t l) = trans (p \<bullet> t) (p \<bullet> l)" |
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
400 |
apply (induct t l rule: trans.induct) |
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
401 |
apply simp_all |
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
402 |
apply (simp add: eqvts permute_pure) |
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
403 |
done |
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
404 |
|
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
405 |
lemma diff_un: "a - (b \<union> c) = a - b - c" |
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
406 |
by blast |
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
407 |
|
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
408 |
lemma supp_trans: "supp (trans t l) = supp t - supp l" |
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
409 |
apply (induct t arbitrary: l rule: lam.induct) |
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
410 |
apply (simp_all add: lam.supp supp_at_base supp_lookup ln.supp) |
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
411 |
apply blast |
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
412 |
apply (rule_tac x="(lam, l)" and ?'a="name" in obtain_fresh) |
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
413 |
apply (simp add: fresh_Pair) |
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
414 |
apply clarify |
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
415 |
apply (subgoal_tac "supp (Lambda.trans (Lam [a]. ((name \<leftrightarrow> a) \<bullet> lam)) l) = |
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
416 |
supp lam - {atom name} - supp l") |
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
417 |
using helpr |
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
418 |
apply simp |
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
419 |
apply (simp add: ln.supp) |
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
420 |
apply (subgoal_tac "supp ((name \<leftrightarrow> a) \<bullet> (Lambda.trans lam ((name \<leftrightarrow> a) \<bullet> (a # l)))) = supp lam - {atom name} - supp l") |
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
421 |
apply (simp add: trans_eqvt) |
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
422 |
apply (simp add: supp_eqvt[symmetric]) |
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
423 |
apply (simp add: Diff_eqvt) |
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
424 |
apply (simp add: supp_eqvt supp_Cons union_eqvt) |
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
425 |
apply (simp add: diff_un) |
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
426 |
apply (tactic {* Cong_Tac.cong_tac @{thm cong} 1*}) |
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
427 |
apply (tactic {* Cong_Tac.cong_tac @{thm cong} 1*}) |
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
428 |
apply rule |
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
429 |
prefer 2 |
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
430 |
apply rule |
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
431 |
apply (simp add: supp_at_base) |
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
432 |
apply (subgoal_tac "(name \<leftrightarrow> a) \<bullet> (supp lam - {atom name}) = supp lam - {atom name}") |
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
433 |
apply (simp add: eqvts) |
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
434 |
unfolding flip_def |
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
435 |
apply (rule swap_fresh_fresh) |
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
436 |
apply (metis fresh_at_base fresh_def fresh_minus_atom_set lam.fsupp supp_at_base) |
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
437 |
by (metis fresh_def fresh_finite_atom_set fresh_minus_atom_set lam.fsupp) |
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
438 |
|
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
439 |
lemma "atom x \<sharp> trans_sumC (t, x # xsa)" |
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
440 |
by (simp add: fresh_def meta_eq_to_obj_eq[OF trans_def, symmetric, unfolded fun_eq_iff] supp_trans supp_Cons supp_at_base) |
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
441 |
*) |
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2715
diff
changeset
|
442 |
|
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
|
443 |
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
|
444 |
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
|
445 |
| 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
|
446 |
| 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
|
447 |
|
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
|
448 |
abbreviation |
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
|
449 |
mbind :: "'a option => ('a => 'b option) => 'b option" ("_ \<guillemotright>= _" [65,65] 65) |
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
|
450 |
where |
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
|
451 |
"c \<guillemotright>= f \<equiv> case c of None => None | (Some v) => f v" |
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
|
452 |
|
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
|
453 |
lemma mbind_eqvt: |
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
|
454 |
fixes c::"'a::pt option" |
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
|
455 |
shows "(p \<bullet> (c \<guillemotright>= f)) = ((p \<bullet> c) \<guillemotright>= (p \<bullet> f))" |
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
|
456 |
apply(cases c) |
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
|
457 |
apply(simp_all) |
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
|
458 |
apply(perm_simp) |
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
|
459 |
apply(rule refl) |
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
|
460 |
done |
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
|
461 |
|
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
|
462 |
lemma mbind_eqvt_raw[eqvt_raw]: |
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
|
463 |
shows "(p \<bullet> option_case) \<equiv> option_case" |
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
|
464 |
apply(rule eq_reflection) |
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
|
465 |
apply(rule ext)+ |
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
|
466 |
apply(case_tac xb) |
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
|
467 |
apply(simp_all) |
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
|
468 |
apply(rule_tac p="-p" in permute_boolE) |
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
|
469 |
apply(perm_simp add: permute_minus_cancel) |
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
|
470 |
apply(simp) |
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
|
471 |
apply(rule_tac p="-p" in permute_boolE) |
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
|
472 |
apply(perm_simp add: permute_minus_cancel) |
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
|
473 |
apply(simp) |
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
|
474 |
done |
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
|
475 |
|
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
|
476 |
fun |
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
|
477 |
index :: "atom list \<Rightarrow> nat \<Rightarrow> atom \<Rightarrow> nat option" |
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
|
478 |
where |
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
|
479 |
"index [] n x = None" |
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
|
480 |
| "index (y # ys) n x = (if x = y then (Some n) else (index ys (n + 1) x))" |
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
|
481 |
|
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
|
482 |
lemma [eqvt]: |
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
|
483 |
shows "(p \<bullet> index xs n x) = index (p \<bullet> xs) (p \<bullet> n) (p \<bullet> x)" |
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
|
484 |
apply(induct xs arbitrary: n) |
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
|
485 |
apply(simp_all add: permute_pure) |
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
|
486 |
done |
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
|
487 |
|
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
|
488 |
(* |
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
|
489 |
nominal_primrec |
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
|
490 |
trans :: "lam \<Rightarrow> atom list \<Rightarrow> db option" |
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
|
491 |
where |
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
|
492 |
"trans (Var x) xs = (index xs 0 (atom x) \<guillemotright>= (\<lambda>n. Some (DBVar n)))" |
2707
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
493 |
| "trans (App t1 t2) xs = ((trans t1 xs) \<guillemotright>= (\<lambda>db1. (trans t2 xs) \<guillemotright>= (\<lambda>db2. Some (DBApp db1 db2))))" |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
494 |
| "trans (Lam [x].t) xs = (trans t (atom x # xs) \<guillemotright>= (\<lambda>db. Some (DBLam db)))" |
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
|
495 |
*) |
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
|
496 |
|
2675
68ccf847507d
defined properly substitution
Christian Urban <urbanc@in.tum.de>
parents:
2669
diff
changeset
|
497 |
|
2666
324a5d1289a3
added a few examples of functions to Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2664
diff
changeset
|
498 |
|
1594 | 499 |
end |
500 |
||
501 |
||
502 |