author | Christian Urban <urbanc@in.tum.de> |
Tue, 07 Jun 2011 10:40:06 +0100 | |
changeset 2822 | 23befefc6e73 |
parent 2821 | c7d4bd9e89e0 |
child 2824 | 44d937e8ae78 |
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 |
||
2784
61384946ba2c
added a problem with inductive_cases (reported by Randy)
Christian Urban <urbanc@in.tum.de>
parents:
2779
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 |
|
2807
13af2c8d7329
a test with a recursion combinator defined on top of nominal_primrec
Christian Urban <urbanc@in.tum.de>
parents:
2803
diff
changeset
|
13 |
lemma cheat: "P" sorry |
13af2c8d7329
a test with a recursion combinator defined on top of nominal_primrec
Christian Urban <urbanc@in.tum.de>
parents:
2803
diff
changeset
|
14 |
|
2814
887d8bd4eb99
recursion combinator inside a locale
Christian Urban <urbanc@in.tum.de>
parents:
2809
diff
changeset
|
15 |
thm lam.strong_exhaust |
887d8bd4eb99
recursion combinator inside a locale
Christian Urban <urbanc@in.tum.de>
parents:
2809
diff
changeset
|
16 |
|
887d8bd4eb99
recursion combinator inside a locale
Christian Urban <urbanc@in.tum.de>
parents:
2809
diff
changeset
|
17 |
lemma lam_strong_exhaust2: |
887d8bd4eb99
recursion combinator inside a locale
Christian Urban <urbanc@in.tum.de>
parents:
2809
diff
changeset
|
18 |
"\<lbrakk>\<And>name. y = Var name \<Longrightarrow> P; |
887d8bd4eb99
recursion combinator inside a locale
Christian Urban <urbanc@in.tum.de>
parents:
2809
diff
changeset
|
19 |
\<And>lam1 lam2. y = App lam1 lam2 \<Longrightarrow> P; |
887d8bd4eb99
recursion combinator inside a locale
Christian Urban <urbanc@in.tum.de>
parents:
2809
diff
changeset
|
20 |
\<And>name lam. \<lbrakk>{atom name} \<sharp>* c; y = Lam [name]. lam\<rbrakk> \<Longrightarrow> P; |
887d8bd4eb99
recursion combinator inside a locale
Christian Urban <urbanc@in.tum.de>
parents:
2809
diff
changeset
|
21 |
finite (supp c)\<rbrakk> |
887d8bd4eb99
recursion combinator inside a locale
Christian Urban <urbanc@in.tum.de>
parents:
2809
diff
changeset
|
22 |
\<Longrightarrow> P" |
887d8bd4eb99
recursion combinator inside a locale
Christian Urban <urbanc@in.tum.de>
parents:
2809
diff
changeset
|
23 |
sorry |
887d8bd4eb99
recursion combinator inside a locale
Christian Urban <urbanc@in.tum.de>
parents:
2809
diff
changeset
|
24 |
|
887d8bd4eb99
recursion combinator inside a locale
Christian Urban <urbanc@in.tum.de>
parents:
2809
diff
changeset
|
25 |
abbreviation |
887d8bd4eb99
recursion combinator inside a locale
Christian Urban <urbanc@in.tum.de>
parents:
2809
diff
changeset
|
26 |
"FCB f \<equiv> \<forall>x t r. atom x \<sharp> f x t r" |
887d8bd4eb99
recursion combinator inside a locale
Christian Urban <urbanc@in.tum.de>
parents:
2809
diff
changeset
|
27 |
|
2809
e67bb8dca324
finished the missing obligations
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2808
diff
changeset
|
28 |
lemma Abs1_eq_fdest: |
e67bb8dca324
finished the missing obligations
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2808
diff
changeset
|
29 |
fixes x y :: "'a :: at_base" |
e67bb8dca324
finished the missing obligations
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2808
diff
changeset
|
30 |
and S T :: "'b :: fs" |
e67bb8dca324
finished the missing obligations
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2808
diff
changeset
|
31 |
assumes "(Abs_lst [atom x] T) = (Abs_lst [atom y] S)" |
e67bb8dca324
finished the missing obligations
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2808
diff
changeset
|
32 |
and "x \<noteq> y \<Longrightarrow> atom y \<sharp> T \<Longrightarrow> atom x \<sharp> f x T" |
e67bb8dca324
finished the missing obligations
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2808
diff
changeset
|
33 |
and "x \<noteq> y \<Longrightarrow> atom y \<sharp> T \<Longrightarrow> atom y \<sharp> f x T" |
e67bb8dca324
finished the missing obligations
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2808
diff
changeset
|
34 |
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" |
e67bb8dca324
finished the missing obligations
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2808
diff
changeset
|
35 |
and "sort_of (atom x) = sort_of (atom y)" |
e67bb8dca324
finished the missing obligations
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2808
diff
changeset
|
36 |
shows "f x T = f y S" |
e67bb8dca324
finished the missing obligations
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2808
diff
changeset
|
37 |
using assms apply - |
2819
4bd584ff4fab
added an option for an invariant (at the moment only a stub)
Christian Urban <urbanc@in.tum.de>
parents:
2816
diff
changeset
|
38 |
thm Abs1_eq_iff' |
2809
e67bb8dca324
finished the missing obligations
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2808
diff
changeset
|
39 |
apply (subst (asm) Abs1_eq_iff') |
e67bb8dca324
finished the missing obligations
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2808
diff
changeset
|
40 |
apply simp_all |
e67bb8dca324
finished the missing obligations
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2808
diff
changeset
|
41 |
apply (elim conjE disjE) |
e67bb8dca324
finished the missing obligations
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2808
diff
changeset
|
42 |
apply simp |
e67bb8dca324
finished the missing obligations
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2808
diff
changeset
|
43 |
apply(rule trans) |
e67bb8dca324
finished the missing obligations
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2808
diff
changeset
|
44 |
apply (rule_tac p="(atom x \<rightleftharpoons> atom y)" in supp_perm_eq[symmetric]) |
e67bb8dca324
finished the missing obligations
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2808
diff
changeset
|
45 |
apply(rule fresh_star_supp_conv) |
e67bb8dca324
finished the missing obligations
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2808
diff
changeset
|
46 |
apply(simp add: supp_swap fresh_star_def) |
e67bb8dca324
finished the missing obligations
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2808
diff
changeset
|
47 |
apply(simp add: swap_commute) |
e67bb8dca324
finished the missing obligations
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2808
diff
changeset
|
48 |
done |
e67bb8dca324
finished the missing obligations
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2808
diff
changeset
|
49 |
|
2821
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2819
diff
changeset
|
50 |
nominal_primrec (invariant "\<lambda>x (y::atom set). finite y") |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2819
diff
changeset
|
51 |
frees_set :: "lam \<Rightarrow> atom set" |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2819
diff
changeset
|
52 |
where |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2819
diff
changeset
|
53 |
"frees_set (Var x) = {atom x}" |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2819
diff
changeset
|
54 |
| "frees_set (App t1 t2) = frees_set t1 \<union> frees_set t2" |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2819
diff
changeset
|
55 |
| "frees_set (Lam [x]. t) = (frees_set t) - {atom x}" |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2819
diff
changeset
|
56 |
apply(simp add: eqvt_def frees_set_graph_def) |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2819
diff
changeset
|
57 |
apply (rule, perm_simp, rule) |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2819
diff
changeset
|
58 |
apply(erule frees_set_graph.induct) |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2819
diff
changeset
|
59 |
apply(simp) |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2819
diff
changeset
|
60 |
apply(simp) |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2819
diff
changeset
|
61 |
apply(simp) |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2819
diff
changeset
|
62 |
apply(rule_tac y="x" in lam.exhaust) |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2819
diff
changeset
|
63 |
apply(auto)[6] |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2819
diff
changeset
|
64 |
apply(simp) |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2819
diff
changeset
|
65 |
apply(simp) |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2819
diff
changeset
|
66 |
apply(simp) |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2819
diff
changeset
|
67 |
apply (erule Abs1_eq_fdest) |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2819
diff
changeset
|
68 |
apply(simp add: fresh_def) |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2819
diff
changeset
|
69 |
apply(subst supp_of_finite_sets) |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2819
diff
changeset
|
70 |
apply(simp) |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2819
diff
changeset
|
71 |
apply(simp add: supp_atom) |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2819
diff
changeset
|
72 |
apply(simp add: fresh_def) |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2819
diff
changeset
|
73 |
apply(subst supp_of_finite_sets) |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2819
diff
changeset
|
74 |
apply(simp) |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2819
diff
changeset
|
75 |
apply(simp add: supp_atom) |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2819
diff
changeset
|
76 |
apply(subst supp_finite_atom_set[symmetric]) |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2819
diff
changeset
|
77 |
apply(simp) |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2819
diff
changeset
|
78 |
apply(simp add: fresh_def[symmetric]) |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2819
diff
changeset
|
79 |
apply(rule fresh_eqvt_at) |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2819
diff
changeset
|
80 |
apply(assumption) |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2819
diff
changeset
|
81 |
apply(simp add: finite_supp) |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2819
diff
changeset
|
82 |
apply(simp) |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2819
diff
changeset
|
83 |
apply(simp add: eqvt_at_def eqvts) |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2819
diff
changeset
|
84 |
apply(simp) |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2819
diff
changeset
|
85 |
done |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2819
diff
changeset
|
86 |
|
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2819
diff
changeset
|
87 |
termination |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2819
diff
changeset
|
88 |
by (relation "measure size") (auto simp add: lam.size) |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2819
diff
changeset
|
89 |
|
2822
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
parents:
2821
diff
changeset
|
90 |
thm frees_set.simps |
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
parents:
2821
diff
changeset
|
91 |
thm frees_set.induct |
2821
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2819
diff
changeset
|
92 |
|
2822
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
parents:
2821
diff
changeset
|
93 |
lemma "frees_set t = supp t" |
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
parents:
2821
diff
changeset
|
94 |
apply(induct rule: frees_set.induct) |
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
parents:
2821
diff
changeset
|
95 |
apply(simp_all add: lam.supp supp_at_base) |
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
parents:
2821
diff
changeset
|
96 |
done |
2821
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2819
diff
changeset
|
97 |
|
2809
e67bb8dca324
finished the missing obligations
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2808
diff
changeset
|
98 |
lemma fresh_fun_eqvt_app3: |
e67bb8dca324
finished the missing obligations
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2808
diff
changeset
|
99 |
assumes a: "eqvt f" |
e67bb8dca324
finished the missing obligations
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2808
diff
changeset
|
100 |
and b: "a \<sharp> x" "a \<sharp> y" "a \<sharp> z" |
e67bb8dca324
finished the missing obligations
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2808
diff
changeset
|
101 |
shows "a \<sharp> f x y z" |
e67bb8dca324
finished the missing obligations
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2808
diff
changeset
|
102 |
using fresh_fun_eqvt_app[OF a b(1)] a b |
e67bb8dca324
finished the missing obligations
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2808
diff
changeset
|
103 |
by (metis fresh_fun_app) |
e67bb8dca324
finished the missing obligations
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2808
diff
changeset
|
104 |
|
2814
887d8bd4eb99
recursion combinator inside a locale
Christian Urban <urbanc@in.tum.de>
parents:
2809
diff
changeset
|
105 |
locale test = |
887d8bd4eb99
recursion combinator inside a locale
Christian Urban <urbanc@in.tum.de>
parents:
2809
diff
changeset
|
106 |
fixes f1::"name \<Rightarrow> ('a::pt)" |
887d8bd4eb99
recursion combinator inside a locale
Christian Urban <urbanc@in.tum.de>
parents:
2809
diff
changeset
|
107 |
and f2::"lam \<Rightarrow> lam \<Rightarrow> 'a \<Rightarrow> 'a \<Rightarrow> ('a::pt)" |
887d8bd4eb99
recursion combinator inside a locale
Christian Urban <urbanc@in.tum.de>
parents:
2809
diff
changeset
|
108 |
and f3::"name \<Rightarrow> lam \<Rightarrow> 'a \<Rightarrow> ('a::pt)" |
887d8bd4eb99
recursion combinator inside a locale
Christian Urban <urbanc@in.tum.de>
parents:
2809
diff
changeset
|
109 |
assumes fs: "finite (supp (f1, f2, f3))" |
887d8bd4eb99
recursion combinator inside a locale
Christian Urban <urbanc@in.tum.de>
parents:
2809
diff
changeset
|
110 |
and eq: "eqvt f1" "eqvt f2" "eqvt f3" |
887d8bd4eb99
recursion combinator inside a locale
Christian Urban <urbanc@in.tum.de>
parents:
2809
diff
changeset
|
111 |
and fcb: "\<forall>x t r. atom x \<sharp> f3 x t r" |
887d8bd4eb99
recursion combinator inside a locale
Christian Urban <urbanc@in.tum.de>
parents:
2809
diff
changeset
|
112 |
begin |
887d8bd4eb99
recursion combinator inside a locale
Christian Urban <urbanc@in.tum.de>
parents:
2809
diff
changeset
|
113 |
|
2819
4bd584ff4fab
added an option for an invariant (at the moment only a stub)
Christian Urban <urbanc@in.tum.de>
parents:
2816
diff
changeset
|
114 |
nominal_primrec |
2814
887d8bd4eb99
recursion combinator inside a locale
Christian Urban <urbanc@in.tum.de>
parents:
2809
diff
changeset
|
115 |
f :: "lam \<Rightarrow> ('a::pt)" |
2807
13af2c8d7329
a test with a recursion combinator defined on top of nominal_primrec
Christian Urban <urbanc@in.tum.de>
parents:
2803
diff
changeset
|
116 |
where |
2814
887d8bd4eb99
recursion combinator inside a locale
Christian Urban <urbanc@in.tum.de>
parents:
2809
diff
changeset
|
117 |
"f (Var x) = f1 x" |
887d8bd4eb99
recursion combinator inside a locale
Christian Urban <urbanc@in.tum.de>
parents:
2809
diff
changeset
|
118 |
| "f (App t1 t2) = f2 t1 t2 (f t1) (f t2)" |
2816
84c3929d2684
Finish and test the locale approach
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2814
diff
changeset
|
119 |
| "f (Lam [x].t) = f3 x t (f t)" |
2809
e67bb8dca324
finished the missing obligations
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2808
diff
changeset
|
120 |
apply (simp add: eqvt_def f_graph_def) |
2814
887d8bd4eb99
recursion combinator inside a locale
Christian Urban <urbanc@in.tum.de>
parents:
2809
diff
changeset
|
121 |
apply (perm_simp) |
887d8bd4eb99
recursion combinator inside a locale
Christian Urban <urbanc@in.tum.de>
parents:
2809
diff
changeset
|
122 |
apply(simp add: eq[simplified eqvt_def]) |
2821
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2819
diff
changeset
|
123 |
apply(rule TrueI) |
2816
84c3929d2684
Finish and test the locale approach
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2814
diff
changeset
|
124 |
apply(rule_tac y="x" in lam.exhaust) |
2809
e67bb8dca324
finished the missing obligations
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2808
diff
changeset
|
125 |
apply(auto simp add: fresh_star_def) |
e67bb8dca324
finished the missing obligations
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2808
diff
changeset
|
126 |
apply(erule Abs1_eq_fdest) |
e67bb8dca324
finished the missing obligations
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2808
diff
changeset
|
127 |
apply simp_all |
2814
887d8bd4eb99
recursion combinator inside a locale
Christian Urban <urbanc@in.tum.de>
parents:
2809
diff
changeset
|
128 |
apply(simp add: fcb) |
2816
84c3929d2684
Finish and test the locale approach
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2814
diff
changeset
|
129 |
apply (rule fresh_fun_eqvt_app3[OF eq(3)]) |
84c3929d2684
Finish and test the locale approach
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2814
diff
changeset
|
130 |
apply (simp add: fresh_at_base) |
84c3929d2684
Finish and test the locale approach
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2814
diff
changeset
|
131 |
apply assumption |
84c3929d2684
Finish and test the locale approach
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2814
diff
changeset
|
132 |
apply (erule fresh_eqvt_at) |
84c3929d2684
Finish and test the locale approach
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2814
diff
changeset
|
133 |
apply (simp add: finite_supp) |
84c3929d2684
Finish and test the locale approach
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2814
diff
changeset
|
134 |
apply assumption |
2814
887d8bd4eb99
recursion combinator inside a locale
Christian Urban <urbanc@in.tum.de>
parents:
2809
diff
changeset
|
135 |
apply (subgoal_tac "\<And>p y r. p \<bullet> (f3 x y r) = f3 (p \<bullet> x) (p \<bullet> y) (p \<bullet> r)") |
2816
84c3929d2684
Finish and test the locale approach
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2814
diff
changeset
|
136 |
apply (simp add: eqvt_at_def) |
84c3929d2684
Finish and test the locale approach
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2814
diff
changeset
|
137 |
apply (simp add: permute_fun_app_eq eq[unfolded eqvt_def]) |
84c3929d2684
Finish and test the locale approach
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2814
diff
changeset
|
138 |
done |
2807
13af2c8d7329
a test with a recursion combinator defined on top of nominal_primrec
Christian Urban <urbanc@in.tum.de>
parents:
2803
diff
changeset
|
139 |
|
2816
84c3929d2684
Finish and test the locale approach
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2814
diff
changeset
|
140 |
termination |
84c3929d2684
Finish and test the locale approach
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2814
diff
changeset
|
141 |
by (relation "measure size") (auto simp add: lam.size) |
2807
13af2c8d7329
a test with a recursion combinator defined on top of nominal_primrec
Christian Urban <urbanc@in.tum.de>
parents:
2803
diff
changeset
|
142 |
|
2821
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2819
diff
changeset
|
143 |
thm f.simps |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2819
diff
changeset
|
144 |
|
2814
887d8bd4eb99
recursion combinator inside a locale
Christian Urban <urbanc@in.tum.de>
parents:
2809
diff
changeset
|
145 |
end |
2807
13af2c8d7329
a test with a recursion combinator defined on top of nominal_primrec
Christian Urban <urbanc@in.tum.de>
parents:
2803
diff
changeset
|
146 |
|
2819
4bd584ff4fab
added an option for an invariant (at the moment only a stub)
Christian Urban <urbanc@in.tum.de>
parents:
2816
diff
changeset
|
147 |
|
2814
887d8bd4eb99
recursion combinator inside a locale
Christian Urban <urbanc@in.tum.de>
parents:
2809
diff
changeset
|
148 |
thm test.f.simps |
2819
4bd584ff4fab
added an option for an invariant (at the moment only a stub)
Christian Urban <urbanc@in.tum.de>
parents:
2816
diff
changeset
|
149 |
thm test.f.simps[simplified test_def] |
2814
887d8bd4eb99
recursion combinator inside a locale
Christian Urban <urbanc@in.tum.de>
parents:
2809
diff
changeset
|
150 |
|
887d8bd4eb99
recursion combinator inside a locale
Christian Urban <urbanc@in.tum.de>
parents:
2809
diff
changeset
|
151 |
thm test_def |
2807
13af2c8d7329
a test with a recursion combinator defined on top of nominal_primrec
Christian Urban <urbanc@in.tum.de>
parents:
2803
diff
changeset
|
152 |
|
2816
84c3929d2684
Finish and test the locale approach
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2814
diff
changeset
|
153 |
interpretation hei: test |
84c3929d2684
Finish and test the locale approach
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2814
diff
changeset
|
154 |
"%n. (1 :: nat)" |
84c3929d2684
Finish and test the locale approach
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2814
diff
changeset
|
155 |
"%t1 t2 r1 r2. (r1 + r2)" |
84c3929d2684
Finish and test the locale approach
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2814
diff
changeset
|
156 |
"%n t r. r + 1" |
84c3929d2684
Finish and test the locale approach
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2814
diff
changeset
|
157 |
apply default |
84c3929d2684
Finish and test the locale approach
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2814
diff
changeset
|
158 |
apply (auto simp add: pure_fresh supp_Pair) |
84c3929d2684
Finish and test the locale approach
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2814
diff
changeset
|
159 |
apply (simp_all add: fresh_def supp_def permute_fun_def permute_pure)[3] |
84c3929d2684
Finish and test the locale approach
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2814
diff
changeset
|
160 |
apply (simp_all add: eqvt_def permute_fun_def permute_pure) |
84c3929d2684
Finish and test the locale approach
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2814
diff
changeset
|
161 |
done |
84c3929d2684
Finish and test the locale approach
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2814
diff
changeset
|
162 |
|
84c3929d2684
Finish and test the locale approach
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2814
diff
changeset
|
163 |
thm hei.f.simps |
84c3929d2684
Finish and test the locale approach
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2814
diff
changeset
|
164 |
|
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
|
165 |
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
|
166 |
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
|
167 |
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
|
168 |
Var: "triv (Var x) n" |
2779
3c769bf10e63
added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents:
2777
diff
changeset
|
169 |
| App: "\<lbrakk>triv t1 n; triv t2 n\<rbrakk> \<Longrightarrow> triv (App t1 t2) n" |
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
|
170 |
|
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
|
171 |
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
|
172 |
"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
|
173 |
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
|
174 |
apply(perm_simp) |
2779
3c769bf10e63
added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents:
2777
diff
changeset
|
175 |
apply(rule refl) |
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
|
176 |
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
|
177 |
(*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
|
178 |
|
2779
3c769bf10e63
added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents:
2777
diff
changeset
|
179 |
ML {* |
3c769bf10e63
added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents:
2777
diff
changeset
|
180 |
Inductive.the_inductive @{context} "Lambda.triv" |
3c769bf10e63
added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents:
2777
diff
changeset
|
181 |
*} |
3c769bf10e63
added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents:
2777
diff
changeset
|
182 |
|
3c769bf10e63
added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents:
2777
diff
changeset
|
183 |
thm triv_def |
3c769bf10e63
added two mutual recursive inductive definitions
Christian Urban <urbanc@in.tum.de>
parents:
2777
diff
changeset
|
184 |
|
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
|
185 |
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
|
186 |
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
|
187 |
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
|
188 |
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
|
189 |
|
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
|
190 |
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
|
191 |
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
|
192 |
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
|
193 |
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
|
194 |
| 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
|
195 |
| 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
|
196 |
|
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
|
197 |
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
|
198 |
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
|
199 |
|
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
|
200 |
|
2683
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
201 |
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
|
202 |
|
2666
324a5d1289a3
added a few examples of functions to Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2664
diff
changeset
|
203 |
nominal_primrec |
2678
494b859bfc16
defined height as a function that returns an integer
Christian Urban <urbanc@in.tum.de>
parents:
2675
diff
changeset
|
204 |
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
|
205 |
where |
2678
494b859bfc16
defined height as a function that returns an integer
Christian Urban <urbanc@in.tum.de>
parents:
2675
diff
changeset
|
206 |
"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
|
207 |
| "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
|
208 |
| "height (Lam [x].t) = height t + 1" |
2791
5d0875b7ed3e
Simple eqvt proofs with perm_simps for clarity
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2789
diff
changeset
|
209 |
unfolding eqvt_def height_graph_def |
5d0875b7ed3e
Simple eqvt proofs with perm_simps for clarity
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2789
diff
changeset
|
210 |
apply (rule, perm_simp, rule) |
2822
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
parents:
2821
diff
changeset
|
211 |
apply(rule TrueI) |
2666
324a5d1289a3
added a few examples of functions to Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2664
diff
changeset
|
212 |
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
|
213 |
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
|
214 |
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
|
215 |
apply(simp_all add: fresh_def pure_supp eqvt_at_def) |
2666
324a5d1289a3
added a few examples of functions to Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2664
diff
changeset
|
216 |
done |
324a5d1289a3
added a few examples of functions to Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2664
diff
changeset
|
217 |
|
324a5d1289a3
added a few examples of functions to Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2664
diff
changeset
|
218 |
termination |
2683
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
219 |
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
|
220 |
|
2707
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
221 |
thm height.simps |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2685
diff
changeset
|
222 |
|
2683
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
223 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
224 |
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
|
225 |
|
324a5d1289a3
added a few examples of functions to Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2664
diff
changeset
|
226 |
nominal_primrec |
324a5d1289a3
added a few examples of functions to Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2664
diff
changeset
|
227 |
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
|
228 |
where |
324a5d1289a3
added a few examples of functions to Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2664
diff
changeset
|
229 |
"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
|
230 |
| "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
|
231 |
| "frees_lst (Lam [x]. t) = removeAll (atom x) (frees_lst t)" |
2791
5d0875b7ed3e
Simple eqvt proofs with perm_simps for clarity
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2789
diff
changeset
|
232 |
unfolding eqvt_def frees_lst_graph_def |
5d0875b7ed3e
Simple eqvt proofs with perm_simps for clarity
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2789
diff
changeset
|
233 |
apply (rule, perm_simp, rule) |
2822
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
parents:
2821
diff
changeset
|
234 |
apply(rule TrueI) |
2666
324a5d1289a3
added a few examples of functions to Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2664
diff
changeset
|
235 |
apply(rule_tac y="x" in lam.exhaust) |
2793
8042bf23af1c
map_term is not a function the way it is defined
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2792
diff
changeset
|
236 |
apply(auto) |
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
|
237 |
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
|
238 |
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
|
239 |
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
|
240 |
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
|
241 |
apply(auto simp add: fresh_def supp_removeAll eqvts eqvt_at_def) |
2666
324a5d1289a3
added a few examples of functions to Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2664
diff
changeset
|
242 |
done |
324a5d1289a3
added a few examples of functions to Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2664
diff
changeset
|
243 |
|
324a5d1289a3
added a few examples of functions to Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2664
diff
changeset
|
244 |
termination |
2793
8042bf23af1c
map_term is not a function the way it is defined
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2792
diff
changeset
|
245 |
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
|
246 |
|
2683
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
247 |
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
|
248 |
lemma |
2683
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
249 |
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
|
250 |
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
|
251 |
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
|
252 |
done |
324a5d1289a3
added a few examples of functions to Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2664
diff
changeset
|
253 |
|
2683
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
254 |
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
|
255 |
|
2675
68ccf847507d
defined properly substitution
Christian Urban <urbanc@in.tum.de>
parents:
2669
diff
changeset
|
256 |
nominal_primrec |
2683
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
257 |
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
|
258 |
where |
2683
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
259 |
"(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
|
260 |
| "(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
|
261 |
| "atom x \<sharp> (y, s) \<Longrightarrow> (Lam [x]. t)[y ::= s] = Lam [x].(t[y ::= s])" |
2791
5d0875b7ed3e
Simple eqvt proofs with perm_simps for clarity
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2789
diff
changeset
|
262 |
unfolding eqvt_def subst_graph_def |
5d0875b7ed3e
Simple eqvt proofs with perm_simps for clarity
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2789
diff
changeset
|
263 |
apply (rule, perm_simp, rule) |
2822
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
parents:
2821
diff
changeset
|
264 |
apply(rule TrueI) |
2683
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
265 |
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
|
266 |
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
|
267 |
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
|
268 |
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
|
269 |
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
|
270 |
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
|
271 |
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
|
272 |
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
|
273 |
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
|
274 |
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
|
275 |
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
|
276 |
apply(rule perm_supp_eq,simp add: fresh_star_def fresh_Pair supp_swap)+ |
2675
68ccf847507d
defined properly substitution
Christian Urban <urbanc@in.tum.de>
parents:
2669
diff
changeset
|
277 |
done |
68ccf847507d
defined properly substitution
Christian Urban <urbanc@in.tum.de>
parents:
2669
diff
changeset
|
278 |
|
2678
494b859bfc16
defined height as a function that returns an integer
Christian Urban <urbanc@in.tum.de>
parents:
2675
diff
changeset
|
279 |
termination |
2793
8042bf23af1c
map_term is not a function the way it is defined
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2792
diff
changeset
|
280 |
by (relation "measure (\<lambda>(t,_,_). size t)") (simp_all add: lam.size) |
2683
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
281 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
282 |
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
|
283 |
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
|
284 |
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
|
285 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
286 |
lemma forget: |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
287 |
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
|
288 |
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
|
289 |
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
|
290 |
done |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
291 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
292 |
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
|
293 |
lemma forget2: |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
294 |
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
|
295 |
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
|
296 |
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
|
297 |
done |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
298 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
299 |
lemma fresh_fact: |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
300 |
fixes z::"name" |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
301 |
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
|
302 |
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
|
303 |
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
|
304 |
using a b |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
305 |
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
|
306 |
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
|
307 |
done |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
308 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
309 |
lemma substitution_lemma: |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
310 |
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
|
311 |
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
|
312 |
using a |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
313 |
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
|
314 |
(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
|
315 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
316 |
lemma subst_rename: |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
317 |
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
|
318 |
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
|
319 |
using a |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
320 |
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
|
321 |
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
|
322 |
done |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
323 |
|
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
|
324 |
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
|
325 |
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
|
326 |
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
|
327 |
|
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2765
diff
changeset
|
328 |
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
|
329 |
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
|
330 |
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
|
331 |
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
|
332 |
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
|
333 |
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
|
334 |
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
|
335 |
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
|
336 |
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
|
337 |
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
|
338 |
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
|
339 |
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
|
340 |
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
|
341 |
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
|
342 |
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
|
343 |
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
|
344 |
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
|
345 |
qed |
2683
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
346 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
347 |
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
|
348 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
349 |
inductive |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
350 |
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
|
351 |
where |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
352 |
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
|
353 |
| 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
|
354 |
| 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
|
355 |
| 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
|
356 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
357 |
equivariance beta |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
358 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
359 |
nominal_inductive beta |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
360 |
avoids b4: "x" |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
361 |
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
|
362 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
363 |
text {* One-Reduction *} |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
364 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
365 |
inductive |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
366 |
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
|
367 |
where |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
368 |
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
|
369 |
| 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
|
370 |
| 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
|
371 |
| 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
|
372 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
373 |
equivariance One |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
374 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
375 |
nominal_inductive One |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
376 |
avoids o3: "x" |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
377 |
| o4: "x" |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
378 |
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
|
379 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
380 |
lemma One_refl: |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
381 |
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
|
382 |
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
|
383 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
384 |
lemma One_subst: |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
385 |
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
|
386 |
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
|
387 |
using a |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
388 |
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
|
389 |
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
|
390 |
done |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
391 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
392 |
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
|
393 |
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
|
394 |
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
|
395 |
proof - |
2685
1df873b63cb2
added obtain_fresh lemma; tuned Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2683
diff
changeset
|
396 |
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
|
397 |
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
|
398 |
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
|
399 |
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
|
400 |
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
|
401 |
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
|
402 |
qed |
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
403 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
404 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
405 |
|
42c0d011a177
ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents:
2678
diff
changeset
|
406 |
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
|
407 |
|
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
|
408 |
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
|
409 |
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
|
410 |
| 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
|
411 |
| 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
|
412 |
| 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
|
413 |
|
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
parents:
2667
diff
changeset
|
414 |
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
|
415 |
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
|
416 |
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
|
417 |
"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
|
418 |
| "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
|
419 |
|
2822
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
parents:
2821
diff
changeset
|
420 |
lemma supp_lookup: |
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
parents:
2821
diff
changeset
|
421 |
shows "supp (lookup xs n x) \<subseteq> supp x" |
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
parents:
2821
diff
changeset
|
422 |
apply(induct arbitrary: n rule: lookup.induct) |
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
parents:
2821
diff
changeset
|
423 |
apply(simp add: ln.supp) |
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
parents:
2821
diff
changeset
|
424 |
apply(simp add: ln.supp pure_supp) |
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
parents:
2821
diff
changeset
|
425 |
done |
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
parents:
2821
diff
changeset
|
426 |
|
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
parents:
2821
diff
changeset
|
427 |
|
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
|
428 |
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
|
429 |
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
|
430 |
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
|
431 |
|
2822
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
parents:
2821
diff
changeset
|
432 |
nominal_primrec (invariant "\<lambda>x y. supp y \<subseteq> supp x") |
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
|
433 |
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
|
434 |
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
|
435 |
"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
|
436 |
| "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
|
437 |
| "atom x \<sharp> xs \<Longrightarrow> trans (Lam [x]. t) xs = LNLam (trans t (x # xs))" |
2822
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
parents:
2821
diff
changeset
|
438 |
apply(simp add: eqvt_def trans_graph_def) |
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
parents:
2821
diff
changeset
|
439 |
apply (rule, perm_simp, rule) |
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
parents:
2821
diff
changeset
|
440 |
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
|
441 |
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
|
442 |
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
|
443 |
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
|
444 |
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
|
445 |
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
|
446 |
apply(blast) |
2822
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
parents:
2821
diff
changeset
|
447 |
apply(simp_all) |
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
|
448 |
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
|
449 |
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
|
450 |
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
|
451 |
apply (simp_all add: ln.fresh) |
2675
68ccf847507d
defined properly substitution
Christian Urban <urbanc@in.tum.de>
parents:
2669
diff
changeset
|
452 |
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
|
453 |
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
|
454 |
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
|
455 |
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
|
456 |
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
|
457 |
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
|
458 |
apply (metis atom_name_def swap_fresh_fresh) |
2822
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
parents:
2821
diff
changeset
|
459 |
apply(simp add: fresh_def) |
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
parents:
2821
diff
changeset
|
460 |
defer |
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
parents:
2821
diff
changeset
|
461 |
apply(erule trans_graph.induct) |
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
parents:
2821
diff
changeset
|
462 |
defer |
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
parents:
2821
diff
changeset
|
463 |
apply(simp add: lam.supp ln.supp) |
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
parents:
2821
diff
changeset
|
464 |
apply(blast) |
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
parents:
2821
diff
changeset
|
465 |
apply(simp add: lam.supp ln.supp) |
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
|
466 |
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
|
467 |
|
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
|
468 |
(* 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
|
469 |
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
|
470 |
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
|
471 |
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
|
472 |
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
|
473 |
|
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
|
474 |
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
|
475 |
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
|
476 |
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
|
477 |
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
|
478 |
|
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
|
479 |
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
|
480 |
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
|
481 |
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
|
482 |
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
|
483 |
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
|
484 |
|
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
|
485 |
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
|
486 |
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
|
487 |
|
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
|
488 |
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
|
489 |
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
|
490 |
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
|
491 |
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
|
492 |
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
|
493 |
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
|
494 |
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
|
495 |
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
|
496 |
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
|
497 |
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
|
498 |
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
|
499 |
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
|
500 |
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
|
501 |
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
|
502 |
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
|
503 |
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
|
504 |
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
|
505 |
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
|
506 |
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
|
507 |
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
|
508 |
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
|
509 |
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
|
510 |
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
|
511 |
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
|
512 |
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
|
513 |
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
|
514 |
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
|
515 |
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
|
516 |
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
|
517 |
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
|
518 |
|
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
|
519 |
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
|
520 |
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
|
521 |
*) |
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
|
522 |
|
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
|
523 |
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
|
524 |
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
|
525 |
| 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
|
526 |
| 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
|
527 |
|
2792
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2791
diff
changeset
|
528 |
fun dbapp_in where |
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2791
diff
changeset
|
529 |
"dbapp_in None _ = None" |
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2791
diff
changeset
|
530 |
| "dbapp_in (Some _ ) None = None" |
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2791
diff
changeset
|
531 |
| "dbapp_in (Some x) (Some y) = Some (DBApp x y)" |
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2791
diff
changeset
|
532 |
|
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2791
diff
changeset
|
533 |
fun dblam_in where |
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2791
diff
changeset
|
534 |
"dblam_in None = None" |
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2791
diff
changeset
|
535 |
| "dblam_in (Some x) = Some (DBLam x)" |
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2791
diff
changeset
|
536 |
|
2798
58eaa7fbf0e8
fixed previous commit
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2797
diff
changeset
|
537 |
lemma db_in_eqvt[eqvt]: |
2792
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2791
diff
changeset
|
538 |
"p \<bullet> (dbapp_in x y) = dbapp_in (p \<bullet> x) (p \<bullet> y)" |
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2791
diff
changeset
|
539 |
"p \<bullet> (dblam_in x) = dblam_in (p \<bullet> x)" |
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2791
diff
changeset
|
540 |
apply (case_tac [!] x) |
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2791
diff
changeset
|
541 |
apply (simp_all add: eqvts) |
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2791
diff
changeset
|
542 |
apply (case_tac y) |
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2791
diff
changeset
|
543 |
apply (simp_all add: eqvts) |
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2791
diff
changeset
|
544 |
done |
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2791
diff
changeset
|
545 |
|
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2791
diff
changeset
|
546 |
instance db :: pure |
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2791
diff
changeset
|
547 |
apply default |
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2791
diff
changeset
|
548 |
apply (induct_tac x rule: db.induct) |
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2791
diff
changeset
|
549 |
apply (simp_all add: permute_pure) |
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2791
diff
changeset
|
550 |
done |
2795
929bd2dd1ab2
DeBruijn translation in a simplifier friendly way
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2794
diff
changeset
|
551 |
|
929bd2dd1ab2
DeBruijn translation in a simplifier friendly way
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2794
diff
changeset
|
552 |
lemma fresh_at_list: "atom x \<sharp> xs \<longleftrightarrow> x \<notin> set xs" |
929bd2dd1ab2
DeBruijn translation in a simplifier friendly way
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2794
diff
changeset
|
553 |
unfolding fresh_def supp_set[symmetric] |
929bd2dd1ab2
DeBruijn translation in a simplifier friendly way
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2794
diff
changeset
|
554 |
apply (induct xs) |
929bd2dd1ab2
DeBruijn translation in a simplifier friendly way
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2794
diff
changeset
|
555 |
apply (simp add: supp_set_empty) |
929bd2dd1ab2
DeBruijn translation in a simplifier friendly way
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2794
diff
changeset
|
556 |
apply simp |
929bd2dd1ab2
DeBruijn translation in a simplifier friendly way
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2794
diff
changeset
|
557 |
apply auto |
929bd2dd1ab2
DeBruijn translation in a simplifier friendly way
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2794
diff
changeset
|
558 |
apply (simp_all add: insert_absorb UnI2 finite_set supp_of_finite_insert supp_at_base) |
929bd2dd1ab2
DeBruijn translation in a simplifier friendly way
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2794
diff
changeset
|
559 |
done |
929bd2dd1ab2
DeBruijn translation in a simplifier friendly way
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2794
diff
changeset
|
560 |
|
2800
6e518b436740
DB translation using index; easier to reason about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2799
diff
changeset
|
561 |
fun |
6e518b436740
DB translation using index; easier to reason about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2799
diff
changeset
|
562 |
vindex :: "name list \<Rightarrow> name \<Rightarrow> nat \<Rightarrow> db option" |
2792
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2791
diff
changeset
|
563 |
where |
2800
6e518b436740
DB translation using index; easier to reason about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2799
diff
changeset
|
564 |
"vindex [] v n = None" |
6e518b436740
DB translation using index; easier to reason about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2799
diff
changeset
|
565 |
| "vindex (h # t) v n = (if v = h then (Some (DBVar n)) else (vindex t v (Suc n)))" |
6e518b436740
DB translation using index; easier to reason about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2799
diff
changeset
|
566 |
|
6e518b436740
DB translation using index; easier to reason about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2799
diff
changeset
|
567 |
lemma vindex_eqvt[eqvt]: |
6e518b436740
DB translation using index; easier to reason about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2799
diff
changeset
|
568 |
"(p \<bullet> vindex l v n) = vindex (p \<bullet> l) (p \<bullet> v) (p \<bullet> n)" |
6e518b436740
DB translation using index; easier to reason about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2799
diff
changeset
|
569 |
by (induct l arbitrary: n) (simp_all add: permute_pure) |
6e518b436740
DB translation using index; easier to reason about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2799
diff
changeset
|
570 |
|
6e518b436740
DB translation using index; easier to reason about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2799
diff
changeset
|
571 |
nominal_primrec |
2822
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
parents:
2821
diff
changeset
|
572 |
transdb :: "lam \<Rightarrow> name list \<Rightarrow> db option" |
2800
6e518b436740
DB translation using index; easier to reason about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2799
diff
changeset
|
573 |
where |
2822
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
parents:
2821
diff
changeset
|
574 |
"transdb (Var x) l = vindex l x 0" |
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
parents:
2821
diff
changeset
|
575 |
| "transdb (App t1 t2) xs = dbapp_in (transdb t1 xs) (transdb t2 xs)" |
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
parents:
2821
diff
changeset
|
576 |
| "x \<notin> set xs \<Longrightarrow> transdb (Lam [x].t) xs = dblam_in (transdb t (x # xs))" |
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
parents:
2821
diff
changeset
|
577 |
unfolding eqvt_def transdb_graph_def |
2792
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2791
diff
changeset
|
578 |
apply (rule, perm_simp, rule) |
2822
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
parents:
2821
diff
changeset
|
579 |
apply(rule TrueI) |
2792
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2791
diff
changeset
|
580 |
apply (case_tac x) |
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2791
diff
changeset
|
581 |
apply (rule_tac y="a" and c="b" in lam.strong_exhaust) |
2795
929bd2dd1ab2
DeBruijn translation in a simplifier friendly way
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2794
diff
changeset
|
582 |
apply (auto simp add: fresh_star_def fresh_at_list) |
2792
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2791
diff
changeset
|
583 |
apply (rule_tac f="dblam_in" in arg_cong) |
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2791
diff
changeset
|
584 |
apply (erule Abs1_eq_fdest) |
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2791
diff
changeset
|
585 |
apply (simp_all add: pure_fresh) |
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2791
diff
changeset
|
586 |
apply (subgoal_tac "(atom x \<rightleftharpoons> atom xa) \<bullet> xsa = xsa") |
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2791
diff
changeset
|
587 |
apply (simp add: eqvt_at_def) |
2795
929bd2dd1ab2
DeBruijn translation in a simplifier friendly way
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2794
diff
changeset
|
588 |
apply (metis atom_name_def swap_fresh_fresh fresh_at_list) |
2792
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2791
diff
changeset
|
589 |
done |
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2791
diff
changeset
|
590 |
|
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2791
diff
changeset
|
591 |
termination |
2800
6e518b436740
DB translation using index; easier to reason about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2799
diff
changeset
|
592 |
by (relation "measure (\<lambda>(t,_). size t)") (simp_all add: lam.size) |
2792
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2791
diff
changeset
|
593 |
|
2822
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
parents:
2821
diff
changeset
|
594 |
lemma transdb_eqvt[eqvt]: |
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
parents:
2821
diff
changeset
|
595 |
"p \<bullet> transdb t l = transdb (p \<bullet>t) (p \<bullet>l)" |
2800
6e518b436740
DB translation using index; easier to reason about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2799
diff
changeset
|
596 |
apply (nominal_induct t avoiding: l p rule: lam.strong_induct) |
6e518b436740
DB translation using index; easier to reason about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2799
diff
changeset
|
597 |
apply (simp add: vindex_eqvt) |
6e518b436740
DB translation using index; easier to reason about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2799
diff
changeset
|
598 |
apply (simp_all add: permute_pure) |
2797
6750964a69bf
equivariance of db_trans
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2796
diff
changeset
|
599 |
apply (simp add: fresh_at_list) |
2822
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
parents:
2821
diff
changeset
|
600 |
apply (subst transdb.simps) |
2797
6750964a69bf
equivariance of db_trans
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2796
diff
changeset
|
601 |
apply (simp add: fresh_at_list[symmetric]) |
2800
6e518b436740
DB translation using index; easier to reason about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2799
diff
changeset
|
602 |
apply (drule_tac x="name # l" in meta_spec) |
6e518b436740
DB translation using index; easier to reason about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2799
diff
changeset
|
603 |
apply auto |
2797
6750964a69bf
equivariance of db_trans
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2796
diff
changeset
|
604 |
done |
6750964a69bf
equivariance of db_trans
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2796
diff
changeset
|
605 |
|
2802
3b9ef98a03d2
first test to fix the problem with free variables
Christian Urban <urbanc@in.tum.de>
parents:
2800
diff
changeset
|
606 |
(* |
2792
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2791
diff
changeset
|
607 |
lemma db_trans_test: |
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2791
diff
changeset
|
608 |
assumes a: "y \<noteq> x" |
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2791
diff
changeset
|
609 |
shows "trans (Lam [x]. Lam [y]. App (Var x) (Var y)) [] 0 = Some (DBLam (DBLam (DBApp (DBVar 1) (DBVar 0))))" |
2795
929bd2dd1ab2
DeBruijn translation in a simplifier friendly way
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2794
diff
changeset
|
610 |
using a by simp |
2802
3b9ef98a03d2
first test to fix the problem with free variables
Christian Urban <urbanc@in.tum.de>
parents:
2800
diff
changeset
|
611 |
*) |
2792
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2791
diff
changeset
|
612 |
|
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
|
613 |
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
|
614 |
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
|
615 |
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
|
616 |
"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
|
617 |
|
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
|
618 |
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
|
619 |
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
|
620 |
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
|
621 |
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
|
622 |
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
|
623 |
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
|
624 |
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
|
625 |
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
|
626 |
|
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
|
627 |
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
|
628 |
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
|
629 |
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
|
630 |
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
|
631 |
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
|
632 |
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
|
633 |
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
|
634 |
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
|
635 |
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
|
636 |
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
|
637 |
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
|
638 |
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
|
639 |
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
|
640 |
|
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
|
641 |
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
|
642 |
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
|
643 |
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
|
644 |
"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
|
645 |
| "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
|
646 |
|
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
|
647 |
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
|
648 |
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
|
649 |
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
|
650 |
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
|
651 |
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
|
652 |
|
2789
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
653 |
|
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
654 |
text {* tests of functions containing if and case *} |
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
655 |
|
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
656 |
consts P :: "lam \<Rightarrow> bool" |
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
657 |
|
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
658 |
nominal_primrec |
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
659 |
A :: "lam => lam" |
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
660 |
where |
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
661 |
"A (App M N) = (if (True \<or> P M) then (A M) else (A N))" |
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
662 |
| "A (Var x) = (Var x)" |
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
663 |
| "A (App M N) = (if True then M else A N)" |
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
664 |
oops |
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
665 |
|
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
666 |
nominal_primrec |
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
667 |
C :: "lam => lam" |
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
668 |
where |
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
669 |
"C (App M N) = (case (True \<or> P M) of True \<Rightarrow> (A M) | False \<Rightarrow> (A N))" |
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
670 |
| "C (Var x) = (Var x)" |
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
671 |
| "C (App M N) = (if True then M else C N)" |
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
672 |
oops |
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
673 |
|
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
674 |
nominal_primrec |
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
675 |
map_term :: "(lam \<Rightarrow> lam) \<Rightarrow> lam \<Rightarrow> lam" |
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
676 |
where |
2794
9bc46d04fb2c
map_term can be defined when equivariance is assumed
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2793
diff
changeset
|
677 |
"eqvt f \<Longrightarrow> map_term f (Var x) = f (Var x)" |
9bc46d04fb2c
map_term can be defined when equivariance is assumed
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2793
diff
changeset
|
678 |
| "eqvt f \<Longrightarrow> map_term f (App t1 t2) = App (f t1) (f t2)" |
9bc46d04fb2c
map_term can be defined when equivariance is assumed
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2793
diff
changeset
|
679 |
| "eqvt f \<Longrightarrow> map_term f (Lam [x].t) = Lam [x].(f t)" |
9bc46d04fb2c
map_term can be defined when equivariance is assumed
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2793
diff
changeset
|
680 |
| "\<not>eqvt f \<Longrightarrow> map_term f t = t" |
9bc46d04fb2c
map_term can be defined when equivariance is assumed
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2793
diff
changeset
|
681 |
apply (simp add: eqvt_def map_term_graph_def) |
9bc46d04fb2c
map_term can be defined when equivariance is assumed
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2793
diff
changeset
|
682 |
apply (rule, perm_simp, rule) |
2822
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
parents:
2821
diff
changeset
|
683 |
apply(rule TrueI) |
2794
9bc46d04fb2c
map_term can be defined when equivariance is assumed
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2793
diff
changeset
|
684 |
apply (case_tac x, case_tac "eqvt a", case_tac b rule: lam.exhaust) |
9bc46d04fb2c
map_term can be defined when equivariance is assumed
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2793
diff
changeset
|
685 |
apply auto |
2806
377bea405940
Use FCB to simplify proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2803
diff
changeset
|
686 |
apply (erule Abs1_eq_fdest) |
377bea405940
Use FCB to simplify proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2803
diff
changeset
|
687 |
apply (simp_all add: Abs_fresh_iff fresh_fun_eqvt_app) |
2794
9bc46d04fb2c
map_term can be defined when equivariance is assumed
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2793
diff
changeset
|
688 |
apply (simp add: eqvt_def permute_fun_app_eq) |
9bc46d04fb2c
map_term can be defined when equivariance is assumed
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2793
diff
changeset
|
689 |
done |
9bc46d04fb2c
map_term can be defined when equivariance is assumed
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2793
diff
changeset
|
690 |
|
9bc46d04fb2c
map_term can be defined when equivariance is assumed
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2793
diff
changeset
|
691 |
termination |
9bc46d04fb2c
map_term can be defined when equivariance is assumed
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2793
diff
changeset
|
692 |
by (relation "measure (\<lambda>(_,t). size t)") (simp_all add: lam.size) |
9bc46d04fb2c
map_term can be defined when equivariance is assumed
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2793
diff
changeset
|
693 |
|
2789
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
694 |
nominal_primrec |
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
695 |
A :: "lam => lam" |
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
696 |
where |
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
697 |
"A (Lam [x].M) = (Lam [x].M)" |
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
698 |
| "A (Var x) = (Var x)" |
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
699 |
| "A (App M N) = (if True then M else A N)" |
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
700 |
oops |
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
701 |
|
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
702 |
nominal_primrec |
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
703 |
B :: "lam => lam" |
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
704 |
where |
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
705 |
"B (Lam [x].M) = (Lam [x].M)" |
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
706 |
| "B (Var x) = (Var x)" |
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
707 |
| "B (App M N) = (if True then M else (B N))" |
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
708 |
unfolding eqvt_def |
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
709 |
unfolding B_graph_def |
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
710 |
apply(perm_simp) |
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
711 |
apply(rule allI) |
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
712 |
apply(rule refl) |
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
713 |
oops |
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
714 |
|
2796
3e341af86bbd
fixed the problem with cps-like functions
Christian Urban <urbanc@in.tum.de>
parents:
2795
diff
changeset
|
715 |
text {* "HO" functions *} |
2789
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
716 |
|
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
|
717 |
nominal_primrec |
2796
3e341af86bbd
fixed the problem with cps-like functions
Christian Urban <urbanc@in.tum.de>
parents:
2795
diff
changeset
|
718 |
trans2 :: "lam \<Rightarrow> atom list \<Rightarrow> db option" |
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
|
719 |
where |
2796
3e341af86bbd
fixed the problem with cps-like functions
Christian Urban <urbanc@in.tum.de>
parents:
2795
diff
changeset
|
720 |
"trans2 (Var x) xs = (index xs 0 (atom x) \<guillemotright>= (\<lambda>n. Some (DBVar n)))" |
3e341af86bbd
fixed the problem with cps-like functions
Christian Urban <urbanc@in.tum.de>
parents:
2795
diff
changeset
|
721 |
| "trans2 (App t1 t2) xs = ((trans2 t1 xs) \<guillemotright>= (\<lambda>db1. (trans2 t2 xs) \<guillemotright>= (\<lambda>db2. Some (DBApp db1 db2))))" |
3e341af86bbd
fixed the problem with cps-like functions
Christian Urban <urbanc@in.tum.de>
parents:
2795
diff
changeset
|
722 |
| "trans2 (Lam [x].t) xs = (trans2 t (atom x # xs) \<guillemotright>= (\<lambda>db. Some (DBLam db)))" |
3e341af86bbd
fixed the problem with cps-like functions
Christian Urban <urbanc@in.tum.de>
parents:
2795
diff
changeset
|
723 |
oops |
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
|
724 |
|
2789
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
725 |
nominal_primrec |
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
726 |
CPS :: "lam \<Rightarrow> (lam \<Rightarrow> lam) \<Rightarrow> lam" |
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
727 |
where |
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
728 |
"CPS (Var x) k = Var x" |
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
729 |
| "CPS (App M N) k = CPS M (\<lambda>m. CPS N (\<lambda>n. n))" |
2796
3e341af86bbd
fixed the problem with cps-like functions
Christian Urban <urbanc@in.tum.de>
parents:
2795
diff
changeset
|
730 |
oops |
2789
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
731 |
|
2799
c55aa6cb1518
Problem: free variables in the goal
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2798
diff
changeset
|
732 |
(* Problem: nominal_primrec generates non-quantified free variable "x" *) |
c55aa6cb1518
Problem: free variables in the goal
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2798
diff
changeset
|
733 |
consts b :: name |
c55aa6cb1518
Problem: free variables in the goal
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2798
diff
changeset
|
734 |
nominal_primrec |
c55aa6cb1518
Problem: free variables in the goal
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2798
diff
changeset
|
735 |
Z :: "lam \<Rightarrow> (lam \<Rightarrow> lam) \<Rightarrow> lam" |
c55aa6cb1518
Problem: free variables in the goal
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2798
diff
changeset
|
736 |
where |
c55aa6cb1518
Problem: free variables in the goal
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2798
diff
changeset
|
737 |
"Z (App M N) k = Z M (%m. (Z N (%n.(App m n))))" |
2806
377bea405940
Use FCB to simplify proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2803
diff
changeset
|
738 |
| "Z (App M N) k = Z M (%m. (Z N (%n.(App (App m n) (Abs b (k (Var b)))))))" |
2799
c55aa6cb1518
Problem: free variables in the goal
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2798
diff
changeset
|
739 |
unfolding eqvt_def Z_graph_def |
c55aa6cb1518
Problem: free variables in the goal
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2798
diff
changeset
|
740 |
apply (rule, perm_simp, rule) |
c55aa6cb1518
Problem: free variables in the goal
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2798
diff
changeset
|
741 |
oops |
2789
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
742 |
|
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
743 |
(* function tests *) |
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
744 |
|
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
745 |
(* similar problem with function package *) |
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
746 |
function |
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
747 |
f :: "int list \<Rightarrow> int" |
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
748 |
where |
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
749 |
"f [] = 0" |
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
750 |
| "f [e] = e" |
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
751 |
| "f (l @ m) = f l + f m" |
2806
377bea405940
Use FCB to simplify proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2803
diff
changeset
|
752 |
apply(simp_all) |
2789
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
753 |
oops |
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
754 |
|
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
755 |
|
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
756 |
|
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
parents:
2787
diff
changeset
|
757 |
|
2675
68ccf847507d
defined properly substitution
Christian Urban <urbanc@in.tum.de>
parents:
2669
diff
changeset
|
758 |
|
2666
324a5d1289a3
added a few examples of functions to Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents:
2664
diff
changeset
|
759 |
|
1594 | 760 |
end |
761 |
||
762 |
||
763 |