author | Cezary Kaliszyk <kaliszyk@in.tum.de> |
Wed, 21 Dec 2011 15:43:58 +0900 | |
changeset 3087 | c95afd0dc594 |
parent 2898 | a95a497e1f4f |
child 3088 | 5e74bd87bcda |
permissions | -rw-r--r-- |
2893
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
1 |
header {* Utilities for defining constants and functions *} |
2898
a95a497e1f4f
Make examples work with non-precompiled image
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2893
diff
changeset
|
2 |
|
3087
c95afd0dc594
SFT: Rename Lambda to LambdaTerms, rename constants to match Lambda, remove smt proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2898
diff
changeset
|
3 |
theory Utils imports LambdaTerms begin |
2893
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
4 |
|
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
5 |
lemma beta_app: |
3087
c95afd0dc594
SFT: Rename Lambda to LambdaTerms, rename constants to match Lambda, remove smt proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2898
diff
changeset
|
6 |
"(\<integral> x. M) \<cdot> Var x \<approx> M" |
2893
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
7 |
by (rule b3, rule bI) |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
8 |
(simp add: b1) |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
9 |
|
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
10 |
lemma lam1_fast_app: |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
11 |
assumes leq: "\<And>a. (L = \<integral> a. (F (V a)))" |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
12 |
and su: "\<And>x. atom x \<sharp> A \<Longrightarrow> F (V x) [x ::= A] = F A" |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
13 |
shows "L \<cdot> A \<approx> F A" |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
14 |
proof - |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
15 |
obtain x :: var where a: "atom x \<sharp> A" using obtain_fresh by blast |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
16 |
show ?thesis |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
17 |
by (simp add: leq[of x], rule b3, rule bI, simp add: su b1 a) |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
18 |
qed |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
19 |
|
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
20 |
lemma lam2_fast_app: |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
21 |
assumes leq: "\<And>a b. a \<noteq> b \<Longrightarrow> L = \<integral> a. \<integral> b. (F (V a) (V b))" |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
22 |
and su: "\<And>x y. atom x \<sharp> A \<Longrightarrow> atom y \<sharp> A \<Longrightarrow> atom x \<sharp> B \<Longrightarrow> atom y \<sharp> B \<Longrightarrow> |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
23 |
x \<noteq> y \<Longrightarrow> F (V x) (V y) [x ::= A] [y ::= B] = F A B" |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
24 |
shows "L \<cdot> A \<cdot> B \<approx> F A B" |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
25 |
proof - |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
26 |
obtain x :: var where a: "atom x \<sharp> (A, B)" using obtain_fresh by blast |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
27 |
obtain y :: var where b: "atom y \<sharp> (x, A, B)" using obtain_fresh by blast |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
28 |
obtain z :: var where c: "atom z \<sharp> (x, y, A, B)" using obtain_fresh by blast |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
29 |
have *: "x \<noteq> y" "x \<noteq> z" "y \<noteq> z" |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
30 |
using a b c by (simp_all add: fresh_Pair fresh_at_base) blast+ |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
31 |
have ** : "atom y \<sharp> z" "atom x \<sharp> z" "atom y \<sharp> x" |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
32 |
"atom z \<sharp> y" "atom z \<sharp> x" "atom x \<sharp> y" |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
33 |
"atom x \<sharp> A" "atom y \<sharp> A" "atom z \<sharp> A" |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
34 |
"atom x \<sharp> B" "atom y \<sharp> B" "atom z \<sharp> B" |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
35 |
using a b c by (simp_all add: fresh_Pair fresh_at_base) blast+ |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
36 |
show ?thesis |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
37 |
apply (simp add: leq[OF *(1)]) |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
38 |
apply (rule b3) apply (rule b5) apply (rule bI) |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
39 |
apply (simp add: ** fresh_Pair) |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
40 |
apply (rule b3) apply (rule bI) apply (simp add: su b1 ** *) |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
41 |
done |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
42 |
qed |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
43 |
|
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
44 |
lemma lam3_fast_app: |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
45 |
assumes leq: "\<And>a b c. a \<noteq> b \<Longrightarrow> b \<noteq> c \<Longrightarrow> c \<noteq> a \<Longrightarrow> |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
46 |
L = \<integral> a. \<integral> b. \<integral> c. (F (V a) (V b) (V c))" |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
47 |
and su: "\<And>x y z. atom x \<sharp> A \<Longrightarrow> atom y \<sharp> A \<Longrightarrow> atom z \<sharp> A \<Longrightarrow> |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
48 |
atom x \<sharp> B \<Longrightarrow> atom y \<sharp> B \<Longrightarrow> atom z \<sharp> B \<Longrightarrow> |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
49 |
atom y \<sharp> B \<Longrightarrow> atom y \<sharp> B \<Longrightarrow> atom z \<sharp> B \<Longrightarrow> |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
50 |
x \<noteq> y \<Longrightarrow> y \<noteq> z \<Longrightarrow> z \<noteq> x \<Longrightarrow> |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
51 |
((F (V x) (V y) (V z))[x ::= A] [y ::= B] [z ::= C] = F A B C)" |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
52 |
shows "L \<cdot> A \<cdot> B \<cdot> C \<approx> F A B C" |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
53 |
proof - |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
54 |
obtain x :: var where a: "atom x \<sharp> (A, B, C)" using obtain_fresh by blast |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
55 |
obtain y :: var where b: "atom y \<sharp> (x, A, B, C)" using obtain_fresh by blast |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
56 |
obtain z :: var where c: "atom z \<sharp> (x, y, A, B, C)" using obtain_fresh by blast |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
57 |
have *: "x \<noteq> y" "y \<noteq> z" "z \<noteq> x" |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
58 |
using a b c by (simp_all add: fresh_Pair fresh_at_base) blast+ |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
59 |
have ** : "atom y \<sharp> z" "atom x \<sharp> z" "atom y \<sharp> x" |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
60 |
"atom z \<sharp> y" "atom z \<sharp> x" "atom x \<sharp> y" |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
61 |
"atom x \<sharp> A" "atom y \<sharp> A" "atom z \<sharp> A" |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
62 |
"atom x \<sharp> B" "atom y \<sharp> B" "atom z \<sharp> B" |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
63 |
"atom x \<sharp> C" "atom y \<sharp> C" "atom z \<sharp> C" |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
64 |
using a b c by (simp_all add: fresh_Pair fresh_at_base) blast+ |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
65 |
show ?thesis |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
66 |
apply (simp add: leq[OF *(1) *(2) *(3)]) |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
67 |
apply (rule b3) apply (rule b5) apply (rule b5) apply (rule bI) |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
68 |
apply (simp add: ** fresh_Pair) |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
69 |
apply (rule b3) apply (rule b5) apply (rule bI) |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
70 |
apply (simp add: ** fresh_Pair) |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
71 |
apply (rule b3) apply (rule bI) apply (simp add: su b1 ** *) |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
72 |
done |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
73 |
qed |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
74 |
|
3087
c95afd0dc594
SFT: Rename Lambda to LambdaTerms, rename constants to match Lambda, remove smt proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2898
diff
changeset
|
75 |
definition cn :: "nat \<Rightarrow> var" where "cn n \<equiv> Abs_var (Atom (Sort ''LambdaTerms.var'' []) n)" |
2893
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
76 |
|
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
77 |
lemma cnd[simp]: "m \<noteq> n \<Longrightarrow> cn m \<noteq> cn n" |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
78 |
unfolding cn_def using Abs_var_inject by simp |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
79 |
|
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
80 |
definition cx :: var where "cx \<equiv> cn 0" |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
81 |
definition cy :: var where "cy \<equiv> cn 1" |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
82 |
definition cz :: var where "cz \<equiv> cn 2" |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
83 |
|
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
84 |
lemma cx_cy_cz[simp]: |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
85 |
"cx \<noteq> cy" "cx \<noteq> cz" "cz \<noteq> cy" |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
86 |
unfolding cx_def cy_def cz_def |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
87 |
by simp_all |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
88 |
|
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
89 |
lemma noteq_fresh: "atom x \<sharp> y = (x \<noteq> y)" |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
90 |
by (simp add: fresh_at_base(2)) |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
91 |
|
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
92 |
lemma fresh_fun_eqvt_app2: |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
93 |
assumes a: "eqvt f" |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
94 |
and b: "a \<sharp> x" "a \<sharp> y" |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
95 |
shows "a \<sharp> f x y" |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
96 |
using fresh_fun_eqvt_app[OF a b(1)] a b |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
97 |
by (metis fresh_fun_app) |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
98 |
|
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
99 |
end |
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
100 |
|
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
101 |
|
589b1a0c75e6
Second Fixed Point Theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
102 |