Skip to content

Commit 217ceb9

Browse files
committed
Prove progress
1 parent 42c5162 commit 217ceb9

File tree

2 files changed

+16
-25
lines changed

2 files changed

+16
-25
lines changed

Soundness.thy

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,50 +2,39 @@ theory Soundness
22
imports Typing Semantics Typing_Lemmas
33
begin
44

5-
no_notation Set.member ("(_/ \<in> _)" [51, 51] 50)
65
no_notation Set.member ("(_/ : _)" [51, 51] 50)
76

87
declare term.fv_defs[simp]
98
declare \<tau>.fv_defs[simp]
109

11-
theorem progress: "[] \<turnstile> e : \<tau> \<Longrightarrow> is_value e \<or> (\<exists>e'. e \<longrightarrow> e')"
12-
proof (induction "[] :: \<Gamma>" e \<tau> rule: Tm.induct)
13-
case (Tm_App e1 \<tau>1 \<tau>2 e2)
14-
note IH1 = Tm_App(2)
15-
note IH2 = Tm_App(4)
16-
17-
from IH1 show ?case
10+
theorem progress: "\<lbrakk> \<Gamma> , \<Delta> \<turnstile> e : \<tau> ; \<nexists>x \<sigma>. BVar x \<sigma> \<in> \<Gamma> \<rbrakk> \<Longrightarrow> is_value e \<or> (\<exists>e'. e \<longrightarrow> e')"
11+
proof (induction \<Gamma> \<Delta> e \<tau> rule: Tm.induct)
12+
case (Tm_App \<Gamma> \<Delta> e1 \<tau>1 \<tau>2 e2)
13+
from Tm_App(3)[OF Tm_App(5)] show ?case
1814
proof (elim disjE)
1915
assume "is_value e1"
20-
from IH2 show ?thesis
21-
proof (elim disjE)
22-
assume "is_value e2"
23-
from \<open>is_value e1\<close> Tm_App(1) have "\<exists>x e. e1 = (\<lambda>x:\<tau>1. e)" by (simp add: fun_ty_lam)
24-
then have "\<exists>e'. Step (App e1 e2) e'" using \<open>is_value e2\<close> ST_BetaI by blast
25-
then show ?thesis by simp
26-
next
27-
assume "\<exists>e2'. Step e2 e2'"
28-
then show ?thesis using ST_BetaI Tm_App.hyps(1) \<open>is_value e1\<close> fun_ty_lam by blast
29-
qed
16+
then show ?thesis using ST_Beta Tm_App(1) fun_ty_val is_value.simps(4) by blast
3017
next
3118
assume "\<exists>e1'. Step e1 e1'"
3219
then obtain e1' where "Step e1 e1'" by blast
33-
then have "Step (App e1 e2) (App e1' e2)" by (rule ST_AppI)
20+
then have "Step (App e1 e2) (App e1' e2)" by (rule ST_App)
3421
then show ?thesis by blast
3522
qed
3623
next
3724
case (Tm_Let e1 \<tau>1 x e2 \<tau>2)
38-
then show ?case using ST_SubstI by blast
25+
then show ?case using ST_Let by blast
3926
next
40-
case (Tm_TApp e a k \<sigma> \<tau>)
41-
from Tm_TApp(2) show ?case
27+
case (Tm_TAbs a k \<Gamma> \<Delta> e \<sigma>)
28+
then show ?case using ST_TAbs by fastforce
29+
next
30+
case (Tm_TApp \<Gamma> \<Delta> e a k \<sigma> \<tau>)
31+
from Tm_TApp(3)[OF Tm_TApp(4)] show ?case
4232
proof (elim disjE)
4333
assume "is_value e"
44-
then obtain b k e1 where "e = (\<Lambda> b : k . e1)" using Tm_TApp.hyps(1) forall_ty_lam by blast
45-
then show ?thesis using Step.ST_BetaTI Tm_TApp by blast
34+
then show ?thesis by (metis ST_TBeta Tm_TApp.hyps(1) forall_ty_val head_ctor.simps(5) head_ctor_is_value is_value.simps(3))
4635
next
4736
assume "\<exists>e'. Step e e'"
48-
then show ?thesis using ST_AppTI by fast
37+
then show ?thesis using ST_TApp by fast
4938
qed
5039
qed auto
5140

Typing_Lemmas.thy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ no_notation Set.member ("(_/ : _)" [51, 51] 50)
66

77
lemma fun_ty_val: "\<lbrakk> \<Gamma> , \<Delta> \<turnstile> e : \<tau>1 \<rightarrow> \<tau>2 ; is_value e \<rbrakk> \<Longrightarrow> (\<exists>x e'. e = (\<lambda>x:\<tau>1. e')) \<or> head_ctor e"
88
by (induction \<Gamma> \<Delta> e "\<tau>1 \<rightarrow> \<tau>2" rule: Tm.induct) auto
9+
lemma forall_ty_val: "\<lbrakk> \<Gamma> , \<Delta> \<turnstile> e : \<forall>a:k. \<sigma> ; is_value e \<rbrakk> \<Longrightarrow> (\<exists>x e'. e = (\<Lambda> x:k. e')) \<or> head_ctor e"
10+
by (induction \<Gamma> \<Delta> e "\<forall>a:k. \<sigma>" rule: Tm.induct) auto
911

1012
lemma context_cons_valid[elim]: "(\<Delta>::\<Delta>) \<turnstile> bndr # \<Gamma> \<Longrightarrow> (\<Delta> \<turnstile> \<Gamma> \<Longrightarrow> P) \<Longrightarrow> P"
1113
by (cases rule: Ctx.cases) (auto simp: context_valid(1))

0 commit comments

Comments
 (0)