Skip to content

Commit 0a630fa

Browse files
authored
Remove is_value from small step relation (#8)
1 parent 8be3490 commit 0a630fa

File tree

2 files changed

+8
-47
lines changed

2 files changed

+8
-47
lines changed

Semantics.thy

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,16 @@ begin
55
no_notation HOL.implies (infixr "\<longrightarrow>" 25)
66

77
inductive Step :: "term \<Rightarrow> term \<Rightarrow> bool" ("_ \<longrightarrow> _" 25) where
8-
ST_BetaI: "\<lbrakk> is_value v \<rbrakk> \<Longrightarrow> App (\<lambda> x : \<tau> . e) v \<longrightarrow> subst_term v x e"
98

10-
| ST_AppI: "\<lbrakk> e1 \<longrightarrow> e2 \<rbrakk> \<Longrightarrow> App e1 e \<longrightarrow> App e2 e"
9+
ST_BetaI: "App (\<lambda> x : \<tau> . e) v \<longrightarrow> subst_term v x e"
1110

12-
| ST_App2I: "\<lbrakk> is_value v ; e1 \<longrightarrow> e2 \<rbrakk> \<Longrightarrow> App v e1 \<longrightarrow> App v e2"
11+
| ST_AppI: "e1 \<longrightarrow> e2 \<Longrightarrow> App e1 e \<longrightarrow> App e2 e"
1312

14-
| ST_SubstI: "\<lbrakk> is_value v \<rbrakk> \<Longrightarrow> Let x \<tau> v e \<longrightarrow> subst_term v x e"
15-
16-
| ST_LetI: "\<lbrakk> e1 \<longrightarrow> e2 \<rbrakk> \<Longrightarrow> Let x \<tau> e1 e \<longrightarrow> Let x \<tau> e2 e"
13+
| ST_SubstI: "Let x \<tau> v e \<longrightarrow> subst_term v x e"
1714

1815
| ST_BetaTI: "TyApp (\<Lambda> a . e) \<tau> \<longrightarrow> subst_term_type \<tau> a e"
1916

20-
| ST_AppTI: "\<lbrakk> e1 \<longrightarrow> e2 \<rbrakk> \<Longrightarrow> TyApp e1 \<tau> \<longrightarrow> TyApp e2 \<tau>"
17+
| ST_AppTI: "e1 \<longrightarrow> e2 \<Longrightarrow> TyApp e1 \<tau> \<longrightarrow> TyApp e2 \<tau>"
2118
equivariance Step
2219
nominal_inductive Step .
2320

@@ -38,44 +35,26 @@ lemma value_beta_nf: "is_value v \<Longrightarrow> beta_nf v"
3835
lemma Step_deterministic: "\<lbrakk> e \<longrightarrow> e1 ; e \<longrightarrow> e2 \<rbrakk> \<Longrightarrow> e1 = e2"
3936
proof (induction e e1 arbitrary: e2 rule: Step.induct)
4037
case (ST_BetaI v x \<tau> e)
41-
from ST_BetaI(2) show ?case
38+
then show ?case
4239
proof cases
4340
case (ST_BetaI y e')
4441
then show ?thesis using subst_term_same by blast
4542
next
4643
case (ST_AppI e')
4744
then show ?thesis using Step.cases by fastforce
48-
next
49-
case (ST_App2I e')
50-
then show ?thesis using ST_BetaI value_beta_nf beta_nf_def by blast
5145
qed
5246
next
5347
case (ST_AppI e1 e2 e)
5448
from ST_AppI(3) show ?case
5549
apply cases
5650
using ST_AppI Step.cases value_beta_nf beta_nf_def by fastforce+
57-
next
58-
case (ST_App2I v e1 e2)
59-
from ST_App2I(4) show ?case
60-
apply cases
61-
using ST_App2I.hyps(2) value_beta_nf beta_nf_def apply blast
62-
using ST_App2I.hyps(1) value_beta_nf beta_nf_def apply blast
63-
using ST_App2I value_beta_nf beta_nf_def by auto
6451
next
6552
case (ST_SubstI v x e)
66-
from ST_SubstI(2) show ?case
53+
then show ?case
6754
proof cases
6855
case (ST_SubstI x e)
6956
then show ?thesis using subst_term_same by blast
70-
next
71-
case (ST_LetI e2 x e)
72-
then show ?thesis using ST_SubstI.hyps value_beta_nf beta_nf_def by blast
7357
qed
74-
next
75-
case (ST_LetI t1 t2 x \<tau> e)
76-
from ST_LetI(3) show ?case
77-
apply cases
78-
using ST_LetI value_beta_nf beta_nf_def by auto
7958
next
8059
case (ST_BetaTI a e \<tau>)
8160
then show ?case

Soundness.thy

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ case (T_AppI e1 \<tau>1 \<tau>2 e2)
2424
then show ?thesis by simp
2525
next
2626
assume "\<exists>e2'. Step e2 e2'"
27-
then show ?thesis using ST_App2I \<open>is_value e1\<close> by blast
27+
then show ?thesis using ST_BetaI T_AppI.hyps(1) \<open>is_value e1\<close> fun_ty_lam by blast
2828
qed
2929
next
3030
assume "\<exists>e1'. Step e1 e1'"
@@ -34,7 +34,7 @@ case (T_AppI e1 \<tau>1 \<tau>2 e2)
3434
qed
3535
next
3636
case (T_LetI x e1 \<tau>1 e2 \<tau>2)
37-
then show ?case using ST_SubstI ST_LetI by blast
37+
then show ?case using ST_SubstI by blast
3838
next
3939
case (T_AppTI e a \<sigma> \<tau>)
4040
from T_AppTI(2) show ?case
@@ -281,9 +281,6 @@ next
281281
next
282282
case (ST_AppI e2)
283283
then show ?thesis using T_AppI T.T_AppI by blast
284-
next
285-
case (ST_App2I e2)
286-
then show ?thesis using T_AppI T.T_AppI by blast
287284
qed
288285
next
289286
case (T_LetI x e1 \<tau>1 e2 \<tau>2)
@@ -302,21 +299,6 @@ next
302299
then have "[BVar y \<tau>1] \<turnstile> e : \<tau>2" using T.eqvt by (metis T_AbsI T_Abs_Inv T_LetI.hyps(3) T_LetI.hyps(4) \<tau>.eq_iff(3) fresh_Nil local.ST_SubstI(1) term.eq_iff(5))
303300
then show ?thesis using T_LetI ST_SubstI substitution by auto
304301
qed
305-
next
306-
case (ST_LetI e1' x' e2')
307-
308-
have "atom x' \<sharp> e1'" using T_LetI.hyps(6) fresh_Nil fresh_term_var local.ST_LetI(3) by blast
309-
then have 1: "atom x' \<sharp> ([], e1')" using fresh_Pair fresh_Nil by auto
310-
311-
have swap: "(x \<leftrightarrow> x') \<bullet> e2' = e2"
312-
by (metis Abs1_eq_iff(3) Nominal2_Base.swap_self add_flip_cancel flip_def local.ST_LetI(1) permute_flip_cancel permute_plus)
313-
314-
have "(x \<leftrightarrow> x') \<bullet> ([BVar x \<tau>1] \<turnstile> e2 : \<tau>2)" by (simp add: T_LetI.hyps(4))
315-
then have "((x \<leftrightarrow> x') \<bullet> [BVar x \<tau>1]) \<turnstile> e2' : \<tau>2" by (metis (full_types) T.eqvt T_LetI.hyps(4) flip_commute flip_fresh_fresh local.swap no_vars_in_ty permute_flip_cancel2)
316-
then have 2: "[BVar x' \<tau>1] \<turnstile> e2' : \<tau>2" by (simp add: flip_fresh_fresh)
317-
have 3: "[] \<turnstile>\<^sub>t\<^sub>y \<tau>1" by (simp add: T_LetI.hyps(3))
318-
319-
show ?thesis using ST_LetI(2) T.T_LetI[OF 1 3 2 T_LetI(6)[OF ST_LetI(3)]] by simp
320302
qed
321303
next
322304
case (T_AppTI e a \<sigma> \<tau>)

0 commit comments

Comments
 (0)