author | Cezary Kaliszyk <kaliszyk@in.tum.de> |
Sun, 23 Jan 2011 07:32:28 +0900 | |
changeset 2698 | 96f3ac5d11ad |
parent 2691 | abb6c3ac2df2 |
child 2701 | 7b2691911fbc |
permissions | -rw-r--r-- |
2691
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1 |
theory Tutorial5 |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
2 |
imports Tutorial4 |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
3 |
begin |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
4 |
|
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
5 |
|
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
6 |
section {* Type Preservation (fixme separate file) *} |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
7 |
|
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
8 |
|
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
9 |
lemma valid_elim: |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
10 |
assumes a: "valid ((x, T) # \<Gamma>)" |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
11 |
shows "atom x \<sharp> \<Gamma> \<and> valid \<Gamma>" |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
12 |
using a by (cases) (auto) |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
13 |
|
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
14 |
lemma valid_insert: |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
15 |
assumes a: "valid (\<Delta> @ [(x, T)] @ \<Gamma>)" |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
16 |
shows "valid (\<Delta> @ \<Gamma>)" |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
17 |
using a |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
18 |
by (induct \<Delta>) |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
19 |
(auto simp add: fresh_append fresh_Cons dest!: valid_elim) |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
20 |
|
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
21 |
lemma fresh_list: |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
22 |
shows "atom y \<sharp> xs = (\<forall>x \<in> set xs. atom y \<sharp> x)" |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
23 |
by (induct xs) (simp_all add: fresh_Nil fresh_Cons) |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
24 |
|
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
25 |
lemma context_unique: |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
26 |
assumes a1: "valid \<Gamma>" |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
27 |
and a2: "(x, T) \<in> set \<Gamma>" |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
28 |
and a3: "(x, U) \<in> set \<Gamma>" |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
29 |
shows "T = U" |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
30 |
using a1 a2 a3 |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
31 |
by (induct) (auto simp add: fresh_list fresh_Pair fresh_at_base) |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
32 |
|
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
33 |
lemma type_substitution_aux: |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
34 |
assumes a: "\<Delta> @ [(x, T')] @ \<Gamma> \<turnstile> e : T" |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
35 |
and b: "\<Gamma> \<turnstile> e' : T'" |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
36 |
shows "\<Delta> @ \<Gamma> \<turnstile> e[x ::= e'] : T" |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
37 |
using a b |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
38 |
proof (nominal_induct \<Gamma>'\<equiv>"\<Delta> @ [(x, T')] @ \<Gamma>" e T avoiding: x e' \<Delta> rule: typing.strong_induct) |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
39 |
case (t_Var y T x e' \<Delta>) |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
40 |
have a1: "valid (\<Delta> @ [(x, T')] @ \<Gamma>)" by fact |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
41 |
have a2: "(y,T) \<in> set (\<Delta> @ [(x, T')] @ \<Gamma>)" by fact |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
42 |
have a3: "\<Gamma> \<turnstile> e' : T'" by fact |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
43 |
from a1 have a4: "valid (\<Delta> @ \<Gamma>)" by (rule valid_insert) |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
44 |
{ assume eq: "x = y" |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
45 |
from a1 a2 have "T = T'" using eq by (auto intro: context_unique) |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
46 |
with a3 have "\<Delta> @ \<Gamma> \<turnstile> Var y[x ::= e'] : T" using eq a4 by (auto intro: weakening) |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
47 |
} |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
48 |
moreover |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
49 |
{ assume ineq: "x \<noteq> y" |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
50 |
from a2 have "(y, T) \<in> set (\<Delta> @ \<Gamma>)" using ineq by simp |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
51 |
then have "\<Delta> @ \<Gamma> \<turnstile> Var y[x ::= e'] : T" using ineq a4 by auto |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
52 |
} |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
53 |
ultimately show "\<Delta> @ \<Gamma> \<turnstile> Var y[x::=e'] : T" by blast |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
54 |
qed (force simp add: fresh_append fresh_Cons)+ |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
55 |
|
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
56 |
corollary type_substitution: |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
57 |
assumes a: "(x, T') # \<Gamma> \<turnstile> e : T" |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
58 |
and b: "\<Gamma> \<turnstile> e' : T'" |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
59 |
shows "\<Gamma> \<turnstile> e[x ::= e'] : T" |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
60 |
using a b type_substitution_aux[where \<Delta>="[]"] |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
61 |
by auto |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
62 |
|
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
63 |
lemma t_App_elim: |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
64 |
assumes a: "\<Gamma> \<turnstile> App t1 t2 : T" |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
65 |
obtains T' where "\<Gamma> \<turnstile> t1 : T' \<rightarrow> T" "\<Gamma> \<turnstile> t2 : T'" |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
66 |
using a |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
67 |
by (cases) (auto simp add: lam.eq_iff lam.distinct) |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
68 |
|
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
69 |
text {* we have not yet generated strong elimination rules *} |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
70 |
lemma t_Lam_elim: |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
71 |
assumes ty: "\<Gamma> \<turnstile> Lam [x].t : T" |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
72 |
and fc: "atom x \<sharp> \<Gamma>" |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
73 |
obtains T1 T2 where "T = T1 \<rightarrow> T2" "(x, T1) # \<Gamma> \<turnstile> t : T2" |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
74 |
using ty fc |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
75 |
apply(cases) |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
76 |
apply(auto simp add: lam.eq_iff lam.distinct ty.eq_iff) |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
77 |
apply(auto simp add: Abs1_eq_iff) |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
78 |
apply(rotate_tac 3) |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
79 |
apply(drule_tac p="(x \<leftrightarrow> xa)" in permute_boolI) |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
80 |
apply(perm_simp) |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
81 |
apply(auto simp add: flip_def swap_fresh_fresh ty_fresh) |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
82 |
done |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
83 |
|
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
84 |
theorem cbv_type_preservation: |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
85 |
assumes a: "t \<longrightarrow>cbv t'" |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
86 |
and b: "\<Gamma> \<turnstile> t : T" |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
87 |
shows "\<Gamma> \<turnstile> t' : T" |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
88 |
using a b |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
89 |
by (nominal_induct avoiding: \<Gamma> T rule: cbv.strong_induct) |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
90 |
(auto elim!: t_Lam_elim t_App_elim simp add: type_substitution ty.eq_iff) |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
91 |
|
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
92 |
corollary cbvs_type_preservation: |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
93 |
assumes a: "t \<longrightarrow>cbv* t'" |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
94 |
and b: "\<Gamma> \<turnstile> t : T" |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
95 |
shows "\<Gamma> \<turnstile> t' : T" |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
96 |
using a b |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
97 |
by (induct) (auto intro: cbv_type_preservation) |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
98 |
|
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
99 |
text {* |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
100 |
The type-preservation property for the machine and |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
101 |
evaluation relation. |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
102 |
*} |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
103 |
|
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
104 |
theorem machine_type_preservation: |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
105 |
assumes a: "<t, []> \<mapsto>* <t', []>" |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
106 |
and b: "\<Gamma> \<turnstile> t : T" |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
107 |
shows "\<Gamma> \<turnstile> t' : T" |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
108 |
proof - |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
109 |
have "t \<longrightarrow>cbv* t'" using a machines_implies_cbvs by simp |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
110 |
then show "\<Gamma> \<turnstile> t' : T" using b cbvs_type_preservation by simp |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
111 |
qed |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
112 |
|
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
113 |
theorem eval_type_preservation: |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
114 |
assumes a: "t \<Down> t'" |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
115 |
and b: "\<Gamma> \<turnstile> t : T" |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
116 |
shows "\<Gamma> \<turnstile> t' : T" |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
117 |
proof - |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
118 |
have "<t, []> \<mapsto>* <t', []>" using a eval_implies_machines by simp |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
119 |
then show "\<Gamma> \<turnstile> t' : T" using b machine_type_preservation by simp |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
120 |
qed |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
121 |
|
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
122 |
text {* The Progress Property *} |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
123 |
|
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
124 |
lemma canonical_tArr: |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
125 |
assumes a: "[] \<turnstile> t : T1 \<rightarrow> T2" |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
126 |
and b: "val t" |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
127 |
obtains x t' where "t = Lam [x].t'" |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
128 |
using b a by (induct) (auto) |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
129 |
|
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
130 |
theorem progress: |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
131 |
assumes a: "[] \<turnstile> t : T" |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
132 |
shows "(\<exists>t'. t \<longrightarrow>cbv t') \<or> (val t)" |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
133 |
using a |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
134 |
by (induct \<Gamma>\<equiv>"[]::ty_ctx" t T) |
2698 | 135 |
(auto elim: canonical_tArr simp add: val.simps) |
2691
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
136 |
|
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
137 |
text {* |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
138 |
Done! Congratulations! |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
139 |
*} |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
140 |
|
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
141 |
end |
abb6c3ac2df2
separated type preservation and progress into a separate file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
142 |