Skip to content

Commit 840f87b

Browse files
authored
Add data types (#13)
2 parents 3828d5d + 52a47f2 commit 840f87b

File tree

8 files changed

+769
-455
lines changed

8 files changed

+769
-455
lines changed

Defs.thy

Lines changed: 61 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
theory Defs
2-
imports Syntax Nominal2_Lemmas
2+
imports Syntax Nominal2_Lemmas "HOL-Library.Adhoc_Overloading"
33
begin
44

55
nominal_function isin :: "binder \<Rightarrow> \<Gamma> \<Rightarrow> bool" (infixr "\<in>" 80) where
@@ -27,28 +27,49 @@ proof goal_cases
2727
qed (auto simp: eqvt_def isin_graph_aux_def)
2828
nominal_termination (eqvt) by lexicographic_order
2929

30-
nominal_function
31-
is_value :: "term => bool"
32-
where
33-
"is_value (Var x) = False"
30+
nominal_function head_ctor :: "term \<Rightarrow> bool" where
31+
"head_ctor (Var _) = False"
32+
| "head_ctor (Lam _ _ _) = False"
33+
| "head_ctor (TyLam _ _ _) = False"
34+
| "head_ctor (App e1 e2) = head_ctor e1"
35+
| "head_ctor (TApp e _) = head_ctor e"
36+
| "head_ctor (Ctor _) = True"
37+
| "head_ctor (Let _ _ _ _) = False"
38+
proof goal_cases
39+
case (3 P x)
40+
then show ?case by (cases x rule: term.exhaust)
41+
qed (auto simp: eqvt_def head_ctor_graph_aux_def)
42+
nominal_termination (eqvt) by lexicographic_order
43+
44+
nominal_function is_value :: "term => bool" where
45+
"is_value (Var x) = False"
3446
| "is_value (\<lambda> x : \<tau> . e) = True"
35-
| "is_value (\<Lambda> a : k . e) = True"
36-
| "is_value (App e1 e2) = False"
37-
| "is_value (TyApp e \<tau>) = False"
38-
| "is_value Unit = True"
47+
| "is_value (\<Lambda> a : k . e) = is_value e"
48+
| "is_value (App e1 e2) = head_ctor e1"
49+
| "is_value (TApp e \<tau>) = head_ctor e"
50+
| "is_value (Ctor _) = True"
3951
| "is_value (Let x \<tau> e1 e2) = False"
40-
apply (auto simp: eqvt_def is_value_graph_aux_def)
41-
using term.exhaust by blast
52+
proof goal_cases
53+
case (3 P x)
54+
then show ?case by (cases x rule: term.exhaust)
55+
next
56+
case (17 a k e a' k' e')
57+
obtain c::tyvar where c: "atom c \<sharp> (a, e, a', e')" by (rule obtain_fresh)
58+
have 1: "is_value_sumC e' = (a' \<leftrightarrow> c) \<bullet> is_value_sumC e'" using permute_boolE permute_boolI by blast
59+
have 2: "is_value_sumC e = (a \<leftrightarrow> c) \<bullet> is_value_sumC e" using permute_boolE permute_boolI by blast
60+
from c have "(a \<leftrightarrow> c) \<bullet> e = (a' \<leftrightarrow> c) \<bullet> e'" using 17(5) by simp
61+
then show ?case using 1 2 17(1,2) eqvt_at_def by metis
62+
qed (auto simp: eqvt_def is_value_graph_aux_def)
4263
nominal_termination (eqvt) by lexicographic_order
4364

44-
nominal_function subst_term :: "term => term \<Rightarrow> var => term" ("_[_'/_]" [1000,0,0] 1000) where
45-
"(Var y)[e/x] = (if x = y then e else Var y)"
46-
| "(App e1 e2)[e/x] = App e1[e/x] e2[e/x]"
47-
| "(TyApp e1 \<tau>)[e/x] = TyApp e1[e/x] \<tau>"
48-
| "Unit[_/_] = Unit"
49-
| "atom y \<sharp> (e, x) \<Longrightarrow> (\<lambda> y:\<tau>. e2)[e/x] = (\<lambda> y:\<tau>. e2[e/x])"
50-
| "atom y \<sharp> (e, x) \<Longrightarrow> (\<Lambda> y:k. e2)[e/x] = (\<Lambda> y:k. e2[e/x])"
51-
| "atom y \<sharp> (e, x) \<Longrightarrow> (Let y \<tau> e1 e2)[e/x] = (Let y \<tau> e1[e/x] e2[e/x])"
65+
nominal_function subst_term :: "term => term \<Rightarrow> var => term" where
66+
"subst_term (Var y) e x = (if x = y then e else Var y)"
67+
| "subst_term (App e1 e2) e x = App (subst_term e1 e x) (subst_term e2 e x)"
68+
| "subst_term (TApp e1 \<tau>) e x = TApp (subst_term e1 e x) \<tau>"
69+
| "subst_term (Ctor D) _ _ = Ctor D"
70+
| "atom y \<sharp> (e, x) \<Longrightarrow> subst_term (\<lambda> y:\<tau>. e2) e x = (\<lambda> y:\<tau>. subst_term e2 e x)"
71+
| "atom y \<sharp> (e, x) \<Longrightarrow> subst_term (\<Lambda> y:k. e2) e x = (\<Lambda> y:k. subst_term e2 e x)"
72+
| "atom y \<sharp> (e, x) \<Longrightarrow> subst_term (Let y \<tau> e1 e2) e x = Let y \<tau> (subst_term e1 e x) (subst_term e2 e x)"
5273
proof (goal_cases)
5374
case (3 P x)
5475
then obtain t e y where P: "x = (t, e, y)" by (metis prod.exhaust)
@@ -68,12 +89,12 @@ next
6889
qed (auto simp: eqvt_def subst_term_graph_aux_def)
6990
nominal_termination (eqvt) by lexicographic_order
7091

71-
nominal_function subst_type :: "\<tau> \<Rightarrow> \<tau> \<Rightarrow> tyvar \<Rightarrow> \<tau>" ("_[_'/_]" [1000,0,0] 1000) where
72-
"TyUnit[_/_] = TyUnit"
73-
| "(TyVar b)[\<tau>/a] = (if a=b then \<tau> else TyVar b)"
74-
| "(\<tau>1 \<rightarrow> \<tau>2)[\<tau>/a] = (\<tau>1[\<tau>/a] \<rightarrow> \<tau>2[\<tau>/a])"
75-
| "(TyConApp \<tau>1 \<tau>2)[\<tau>/a] = TyConApp \<tau>1[\<tau>/a] \<tau>2[\<tau>/a]"
76-
| "atom b \<sharp> (\<tau>, a) \<Longrightarrow> (\<forall> b:k. \<sigma>)[\<tau>/a] = (\<forall>b:k. \<sigma>[\<tau>/a])"
92+
nominal_function subst_type :: "\<tau> \<Rightarrow> \<tau> \<Rightarrow> tyvar \<Rightarrow> \<tau>" where
93+
"subst_type (TyData T) _ _ = TyData T"
94+
| "subst_type (TyVar b) \<tau> a = (if a=b then \<tau> else TyVar b)"
95+
| "subst_type TyArrow _ _ = TyArrow"
96+
| "subst_type (TyApp \<tau>1 \<tau>2) \<tau> a = TyApp (subst_type \<tau>1 \<tau> a) (subst_type \<tau>2 \<tau> a)"
97+
| "atom b \<sharp> (\<tau>, a) \<Longrightarrow> subst_type (\<forall> b:k. \<sigma>) \<tau> a = (\<forall>b:k. subst_type \<sigma> \<tau> a)"
7798
proof goal_cases
7899
case (3 P x)
79100
then obtain t \<tau> a where P: "x = (t, \<tau>, a)" by (metis prod.exhaust)
@@ -87,14 +108,14 @@ next
87108
qed (auto simp: eqvt_def subst_type_graph_aux_def)
88109
nominal_termination (eqvt) by lexicographic_order
89110

90-
nominal_function subst_term_type :: "term \<Rightarrow> \<tau> \<Rightarrow> tyvar \<Rightarrow> term" ("_[_'/_]" [1000,0,0] 1000) where
111+
nominal_function subst_term_type :: "term \<Rightarrow> \<tau> \<Rightarrow> tyvar \<Rightarrow> term" where
91112
"subst_term_type (Var x) _ _ = Var x"
92-
| "subst_term_type Unit _ _ = Unit"
93-
| "subst_term_type (App e1 e2) \<tau> a = App e1[\<tau>/a] e2[\<tau>/a]"
94-
| "subst_term_type (TyApp e \<tau>2) \<tau> a = TyApp e[\<tau>/a] \<tau>2[\<tau>/a]"
95-
| "atom y \<sharp> (\<tau>, a) \<Longrightarrow> subst_term_type (\<lambda> y:\<tau>'. e2) \<tau> a = (\<lambda> y:\<tau>'[\<tau>/a]. e2[\<tau>/a])"
96-
| "atom b \<sharp> (\<tau>, a) \<Longrightarrow> subst_term_type (\<Lambda> b:k. e2) \<tau> a = (\<Lambda> b:k. e2[\<tau>/a])"
97-
| "atom y \<sharp> (\<tau>, a) \<Longrightarrow> subst_term_type (Let y \<tau>' e1 e2) \<tau> a = Let y \<tau>'[\<tau>/a] e1[\<tau>/a] e2[\<tau>/a]"
113+
| "subst_term_type (Ctor D) _ _ = Ctor D"
114+
| "subst_term_type (App e1 e2) \<tau> a = App (subst_term_type e1 \<tau> a) (subst_term_type e2 \<tau> a)"
115+
| "subst_term_type (TApp e \<tau>2) \<tau> a = TApp (subst_term_type e \<tau> a) (subst_type \<tau>2 \<tau> a)"
116+
| "atom y \<sharp> (\<tau>, a) \<Longrightarrow> subst_term_type (\<lambda> y:\<tau>'. e2) \<tau> a = (\<lambda> y:(subst_type \<tau>' \<tau> a). subst_term_type e2 \<tau> a)"
117+
| "atom b \<sharp> (\<tau>, a) \<Longrightarrow> subst_term_type (\<Lambda> b:k. e2) \<tau> a = (\<Lambda> b:k. subst_term_type e2 \<tau> a)"
118+
| "atom y \<sharp> (\<tau>, a) \<Longrightarrow> subst_term_type (Let y \<tau>' e1 e2) \<tau> a = Let y (subst_type \<tau>' \<tau> a) (subst_term_type e1 \<tau> a) (subst_term_type e2 \<tau> a)"
98119
proof goal_cases
99120
case (3 P x)
100121
then obtain t \<tau> a where P: "x = (t, \<tau>, a)" by (metis prod.exhaust)
@@ -114,9 +135,9 @@ next
114135
qed (auto simp: eqvt_def subst_term_type_graph_aux_def)
115136
nominal_termination (eqvt) by lexicographic_order
116137

117-
nominal_function subst_context :: "\<Gamma> \<Rightarrow> \<tau> \<Rightarrow> tyvar \<Rightarrow> \<Gamma>" ("_[_'/_]" [1000,0,0] 1000) where
138+
nominal_function subst_context :: "\<Gamma> \<Rightarrow> \<tau> \<Rightarrow> tyvar \<Rightarrow> \<Gamma>" where
118139
"subst_context [] _ _ = []"
119-
| "subst_context (BVar x \<tau> # \<Gamma>) \<tau>' a = BVar x \<tau>[\<tau>'/a] # subst_context \<Gamma> \<tau>' a"
140+
| "subst_context (BVar x \<tau> # \<Gamma>) \<tau>' a = BVar x (subst_type \<tau> \<tau>' a) # subst_context \<Gamma> \<tau>' a"
120141
| "subst_context (BTyVar b k # \<Gamma>) \<tau>' a = (if a = b then subst_context \<Gamma> \<tau>' a else BTyVar b k # subst_context \<Gamma> \<tau>' a)"
121142
proof goal_cases
122143
case (3 P x)
@@ -129,4 +150,10 @@ proof goal_cases
129150
qed (auto simp: eqvt_def subst_context_graph_aux_def)
130151
nominal_termination (eqvt) by lexicographic_order
131152

153+
no_notation inverse_divide (infixl "'/" 70)
154+
consts subst :: "'a \<Rightarrow> 'b \<Rightarrow> 'c \<Rightarrow> 'a" ("_[_'/_]" [1000,0,0] 1000)
155+
156+
adhoc_overloading
157+
subst subst_term subst_type subst_term_type subst_context
158+
132159
end

Determinancy.thy

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,36 @@ theory Determinancy
22
imports Typing Typing_Lemmas
33
begin
44

5-
lemma unique_ty: "\<lbrakk> \<Gamma> \<turnstile>\<^sub>t\<^sub>y \<tau> : k1 ; \<Gamma> \<turnstile>\<^sub>t\<^sub>y \<tau> : k2 \<rbrakk> \<Longrightarrow> k1 = k2"
5+
lemma unique_ty: "\<lbrakk> \<Gamma> , \<Delta> \<turnstile>\<^sub>t\<^sub>y \<tau> : k1 ; \<Gamma> , \<Delta> \<turnstile>\<^sub>t\<^sub>y \<tau> : k2 \<rbrakk> \<Longrightarrow> k1 = k2"
66
proof (nominal_induct \<tau> arbitrary: k1 k2 rule: \<tau>.strong_induct)
77
case (TyVar x)
88
then show ?case using isin_split isin_same(1) by blast
99
next
10-
case (TyConApp \<tau>1 \<tau>2)
10+
case (TyData x)
11+
then show ?case using axiom_isin_split axiom_isin_same(1) axioms_valid(2)[OF TyData(2)] by blast
12+
next
13+
case (TyApp \<tau>1 \<tau>2)
1114
then show ?case by fastforce
1215
next
1316
case (TyForall x1 x2a x3)
1417
then show ?case by (metis Ty_Forall_Inv_2)
1518
qed auto
1619

17-
lemma unique_tm: "\<lbrakk> \<Gamma> \<turnstile> e : \<tau>1 ; \<Gamma> \<turnstile> e : \<tau>2 \<rbrakk> \<Longrightarrow> \<tau>1 = \<tau>2"
20+
lemma unique_tm: "\<lbrakk> \<Gamma> , \<Delta> \<turnstile> e : \<tau>1 ; \<Gamma> , \<Delta> \<turnstile> e : \<tau>2 \<rbrakk> \<Longrightarrow> \<tau>1 = \<tau>2"
1821
proof (nominal_induct e avoiding: \<Gamma> \<tau>1 \<tau>2 rule: term.strong_induct)
1922
case (Var x)
2023
then show ?case using isin_split isin_same(2) by blast
2124
next
22-
case (TyApp e1 \<tau>)
23-
obtain a1 k1 \<sigma>1 where 1: "\<Gamma> \<turnstile> e1 : \<forall> a1:k1. \<sigma>1" "\<tau>1 = \<sigma>1[\<tau>/a1]" by (cases rule: Tm.cases[OF TyApp(2)]) auto
24-
obtain a2 k2 \<sigma>2 where 2: "\<Gamma> \<turnstile> e1 : \<forall> a2:k2. \<sigma>2" "\<tau>2 = \<sigma>2[\<tau>/a2]" by (cases rule: Tm.cases[OF TyApp(3)]) auto
25-
show ?case using TyApp(1)[OF 1(1) 2(1)] subst_type_same 1(2) 2(2) by simp
25+
case (App e1 e2)
26+
then show ?case by fastforce
27+
next
28+
case (TApp e1 \<tau>)
29+
obtain a1 k1 \<sigma>1 where 1: "\<Gamma> , \<Delta> \<turnstile> e1 : \<forall> a1:k1. \<sigma>1" "\<tau>1 = \<sigma>1[\<tau>/a1]" by (cases rule: Tm.cases[OF TApp(2)]) auto
30+
obtain a2 k2 \<sigma>2 where 2: "\<Gamma> , \<Delta> \<turnstile> e1 : \<forall> a2:k2. \<sigma>2" "\<tau>2 = \<sigma>2[\<tau>/a2]" by (cases rule: Tm.cases[OF TApp(3)]) auto
31+
show ?case using TApp(1)[OF 1(1) 2(1)] subst_type_same 1(2) 2(2) by simp
32+
next
33+
case (Ctor x)
34+
then show ?case using axiom_isin_split axiom_isin_same(2) axioms_valid(3)[OF Ctor(2)] by blast
2635
next
2736
case (Lam x \<tau> e)
2837
then show ?case by (metis T_Abs_Inv)
@@ -32,6 +41,6 @@ next
3241
next
3342
case (Let x \<tau> e1 e2)
3443
then show ?case using T_Let_Inv by blast
35-
qed fastforce+
44+
qed
3645

3746
end

Lemmas.thy

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ lemma subst_type_same: "[[atom a]]lst. e = [[atom a']]lst. e' \<Longrightarrow>
8282
by (metis Abs1_eq_iff(3) flip_commute subst_type_var_name)
8383
lemma subst_term_type_same: "[[atom a]]lst. e = [[atom a']]lst. e' \<Longrightarrow> subst_term_type e \<tau> a = subst_term_type e' \<tau> a'"
8484
by (metis Abs1_eq_iff(3) flip_commute subst_term_type_var_name)
85+
lemmas subst_same = subst_term_same subst_type_same subst_term_type_same
8586

8687
(* atom x \<sharp> \<Gamma> \<Longrightarrow> \<not>isin (B x _) \<Gamma> *)
8788
lemma fresh_not_isin_tyvar: "atom a \<sharp> \<Gamma> \<Longrightarrow> \<not>isin (BTyVar a k) \<Gamma>"
@@ -134,4 +135,7 @@ lemmas subst_subst = subst_subst_term subst_subst_type subst_subst_term_type sub
134135
lemma fv_supp_subset: "fv_\<tau> \<tau> \<subseteq> supp \<tau>"
135136
by (induction \<tau> rule: \<tau>.induct) (auto simp: \<tau>.supp \<tau>.fv_defs)
136137

138+
lemma head_ctor_is_value: "head_ctor e \<Longrightarrow> is_value e"
139+
by (induction e rule: term.induct) auto
140+
137141
end

Semantics.thy

Lines changed: 92 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,18 @@ no_notation HOL.implies (infixr "\<longrightarrow>" 25)
66

77
inductive Step :: "term \<Rightarrow> term \<Rightarrow> bool" ("_ \<longrightarrow> _" 25) where
88

9-
ST_BetaI: "App (\<lambda> x : \<tau> . e) e2 \<longrightarrow> e[e2/x]"
9+
ST_Beta: "App (\<lambda> x : \<tau> . e) e2 \<longrightarrow> e[e2/x]"
1010

11-
| ST_AppI: "e1 \<longrightarrow> e2 \<Longrightarrow> App e1 e \<longrightarrow> App e2 e"
11+
| ST_TBeta: "is_value e \<Longrightarrow> TApp (\<Lambda> a : k . e) \<tau> \<longrightarrow> e[\<tau>/a]"
1212

13-
| ST_SubstI: "Let x \<tau> e1 e2 \<longrightarrow> e2[e1/x]"
13+
| ST_TAbs: "e \<longrightarrow> e' \<Longrightarrow> (\<Lambda> a:k. e) \<longrightarrow> (\<Lambda> a:k. e')"
1414

15-
| ST_BetaTI: "TyApp (\<Lambda> a : k . e) \<tau> \<longrightarrow> e[\<tau>/a]"
15+
| ST_App: "e1 \<longrightarrow> e1' \<Longrightarrow> App e1 e2 \<longrightarrow> App e1' e2"
16+
17+
| ST_TApp: "e \<longrightarrow> e' \<Longrightarrow> TApp e \<tau> \<longrightarrow> TApp e' \<tau>"
18+
19+
| ST_Let: "Let x \<tau> e1 e2 \<longrightarrow> e2[e1/x]"
1620

17-
| ST_AppTI: "e1 \<longrightarrow> e2 \<Longrightarrow> TyApp e1 \<tau> \<longrightarrow> TyApp e2 \<tau>"
1821
equivariance Step
1922
nominal_inductive Step .
2023

@@ -29,47 +32,112 @@ definition stuck :: "term \<Rightarrow> bool" where
2932
"stuck e \<equiv> \<not>is_value e \<and> beta_nf e"
3033

3134
lemma value_beta_nf: "is_value v \<Longrightarrow> beta_nf v"
32-
apply (cases v rule: term.exhaust)
33-
using Step.cases beta_nf_def by fastforce+
35+
proof (induction v rule: term.induct)
36+
case (App e1 e2)
37+
show ?case
38+
proof (rule ccontr)
39+
assume "\<not>beta_nf (App e1 e2)"
40+
then obtain e' where "App e1 e2 \<longrightarrow> e'" using beta_nf_def by blast
41+
then show "False" using App head_ctor_is_value beta_nf_def by cases auto
42+
qed
43+
next
44+
case (TApp e \<tau>)
45+
show ?case
46+
proof (rule ccontr)
47+
assume "\<not>beta_nf (TApp e \<tau>)"
48+
then obtain e' where "TApp e \<tau> \<longrightarrow> e'" using beta_nf_def by blast
49+
then show "False" using TApp head_ctor_is_value beta_nf_def by cases auto
50+
qed
51+
next
52+
case (Ctor D)
53+
then show ?case using Step.cases beta_nf_def by fastforce
54+
next
55+
case (Lam x \<tau> e)
56+
then show ?case using Step.cases beta_nf_def by fastforce
57+
next
58+
case (TyLam a k e)
59+
show ?case
60+
proof (rule ccontr)
61+
assume "\<not>beta_nf (\<Lambda> a:k. e)"
62+
then obtain e' where "(\<Lambda> a:k. e) \<longrightarrow> e'" using beta_nf_def by blast
63+
then show "False"
64+
proof cases
65+
case (ST_TAbs e2 e2' b)
66+
obtain c::tyvar where c:"atom c \<sharp> (a, e, b, e2)" by (rule obtain_fresh)
67+
then obtain e3 where 1: "[[atom b]]lst. e2 = [[atom c]]lst. e3" by (metis Abs_lst_rename fresh_PairD(2))
68+
then have 2: "e = (c \<leftrightarrow> a) \<bullet> e3" using ST_TAbs(1) c by (metis Abs_rename_body)
69+
from 1 have "e3 = (b \<leftrightarrow> c) \<bullet> e2" using Abs_rename_body by blast
70+
then have "e3 \<longrightarrow> (b \<leftrightarrow> c) \<bullet> e2'" using ST_TAbs(3) Step.eqvt by blast
71+
then have "e \<longrightarrow> (c \<leftrightarrow> a) \<bullet> (b \<leftrightarrow> c) \<bullet> e2'" using 2 Step.eqvt by blast
72+
then show ?thesis using TyLam beta_nf_def by auto
73+
qed
74+
qed
75+
qed auto
3476

3577
lemma Step_deterministic: "\<lbrakk> e \<longrightarrow> e1 ; e \<longrightarrow> e2 \<rbrakk> \<Longrightarrow> e1 = e2"
3678
proof (induction e e1 arbitrary: e2 rule: Step.induct)
37-
case (ST_BetaI v x \<tau> e)
79+
case (ST_Beta v x \<tau> e)
3880
then show ?case
3981
proof cases
40-
case (ST_BetaI y e')
82+
case (ST_Beta y e')
4183
then show ?thesis using subst_term_same by blast
4284
next
43-
case (ST_AppI e')
85+
case (ST_App e')
4486
then show ?thesis using Step.cases by fastforce
4587
qed
4688
next
47-
case (ST_AppI e1 e2 e)
48-
from ST_AppI(3) show ?case
49-
apply cases
50-
using ST_AppI Step.cases value_beta_nf beta_nf_def by fastforce+
89+
case outer: (ST_TAbs e e' a k)
90+
from outer(3) show ?case
91+
proof cases
92+
case (ST_TAbs e3 e3' b)
93+
obtain c::tyvar where "atom c \<sharp> (a, e, b, e3, e', e3')" by (rule obtain_fresh)
94+
then have c: "atom c \<sharp> (a, e, b, e3)" "atom c \<sharp> e'" "atom c \<sharp> e3'" by auto
95+
then obtain e4 where 1: "[[atom b]]lst. e3 = [[atom c]]lst. e4" by (metis Abs_lst_rename fresh_PairD(2))
96+
then have 2: "e = (c \<leftrightarrow> a) \<bullet> e4" using ST_TAbs(1) c by (metis Abs_rename_body)
97+
from 1 have 3: "e4 = (b \<leftrightarrow> c) \<bullet> e3" using c by (metis Abs_rename_body)
98+
99+
have x1: "(\<Lambda> a : k . e') = (\<Lambda> c : k . (a \<leftrightarrow> c) \<bullet> e')" using c(2) Abs_lst_rename by fastforce
100+
have x2: "(\<Lambda> b : k . e3') = (\<Lambda> c : k. (b \<leftrightarrow> c) \<bullet> e3')" using c(3) Abs_lst_rename by fastforce
101+
102+
let ?e4' = "(c \<leftrightarrow> a) \<bullet> (b \<leftrightarrow> c) \<bullet> e3'"
103+
from 3 have "e4 \<longrightarrow> (b \<leftrightarrow> c) \<bullet> e3'" using Step.eqvt ST_TAbs(3) by blast
104+
then have "e \<longrightarrow> ?e4'" using Step.eqvt 2 by blast
105+
then have "e' = ?e4'" using outer(2) by blast
106+
then have "(a \<leftrightarrow> c) \<bullet> e' = (b \<leftrightarrow> c) \<bullet> e3'" by (simp add: flip_commute)
107+
then show ?thesis using x1 x2 ST_TAbs(2) by argo
108+
qed
51109
next
52-
case (ST_SubstI v x e)
110+
case (ST_App e1 e2 e)
111+
from ST_App(3) show ?case
112+
proof cases
113+
case (ST_Beta x \<tau> e)
114+
then show ?thesis using ST_App.hyps beta_nf_def is_value.simps(2) value_beta_nf by blast
115+
next
116+
case (ST_App e2)
117+
then show ?thesis by (simp add: ST_App.IH)
118+
qed
119+
next
120+
case (ST_Let v x e)
53121
then show ?case
54122
proof cases
55-
case (ST_SubstI x e)
123+
case (ST_Let x e)
56124
then show ?thesis using subst_term_same by blast
57125
qed
58126
next
59-
case (ST_BetaTI a e \<tau>)
60-
then show ?case
127+
case (ST_TBeta a e \<tau>)
128+
from ST_TBeta(2) show ?case
61129
proof cases
62-
case (ST_BetaTI b e')
130+
case (ST_TBeta b e')
63131
then show ?thesis using subst_term_type_same by blast
64132
next
65-
case (ST_AppTI e2)
66-
then show ?thesis using is_value.simps(3) value_beta_nf beta_nf_def by blast
133+
case (ST_TApp e2)
134+
then show ?thesis using is_value.simps(3) value_beta_nf beta_nf_def ST_TBeta(1) by blast
67135
qed
68136
next
69-
case (ST_AppTI e1 e2 \<tau>)
70-
from ST_AppTI(3) show ?case
137+
case (ST_TApp e1 e2 \<tau>)
138+
from ST_TApp(3) show ?case
71139
apply cases
72-
using ST_AppTI value_beta_nf beta_nf_def by auto
140+
using ST_TApp value_beta_nf beta_nf_def by auto
73141
qed
74142

75143
end

0 commit comments

Comments
 (0)