Skip to content

Commit 78dd3e6

Browse files
committed
Prove type safety of System F
1 parent c804dba commit 78dd3e6

File tree

2 files changed

+255
-166
lines changed

2 files changed

+255
-166
lines changed

Defs.thy

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,15 @@ nominal_termination (eqvt) by lexicographic_order
285285
lemma fresh_subst_term: "\<lbrakk> atom z \<sharp> s ; atom z \<sharp> t \<rbrakk> \<Longrightarrow> atom z \<sharp> subst_term s y t"
286286
by (nominal_induct t avoiding: z y s rule: term.strong_induct) auto
287287

288+
lemma fresh_subst_type: "\<lbrakk> atom z \<sharp> \<tau> ; atom z \<sharp> \<sigma> \<rbrakk> \<Longrightarrow> atom z \<sharp> subst_type \<tau> a \<sigma>"
289+
by (nominal_induct \<sigma> avoiding: z a \<tau> rule: \<tau>.strong_induct) auto
290+
291+
lemma fresh_subst_term_type: "\<lbrakk> atom z \<sharp> \<tau> ; atom z \<sharp> e \<rbrakk> \<Longrightarrow> atom z \<sharp> subst_term_type \<tau> a e"
292+
by (nominal_induct e avoiding: z a \<tau> rule: term.strong_induct) (auto simp: fresh_subst_type)
293+
294+
lemma fresh_after_subst_type: "\<lbrakk> atom a \<sharp> \<tau> \<rbrakk> \<Longrightarrow> atom a \<sharp> subst_type \<tau> a \<sigma>"
295+
by (nominal_induct \<sigma> avoiding: a \<tau> rule: \<tau>.strong_induct) auto
296+
288297
lemma subst_term_var_name: "atom c \<sharp> (a, e) \<Longrightarrow> subst_term e' a e = subst_term e' c ((a \<leftrightarrow> c) \<bullet> e)"
289298
proof (nominal_induct e avoiding: c a e' rule: term.strong_induct)
290299
case (Var x)
@@ -397,9 +406,9 @@ where
397406

398407
| T_LetI: "\<lbrakk> atom x \<sharp> (\<Gamma>, e1) ; \<Gamma> \<turnstile>\<^sub>t\<^sub>y \<tau>1 ; BVar x \<tau>1 # \<Gamma> \<turnstile> e2 : \<tau>2 ; \<Gamma> \<turnstile> e1 : \<tau>1 \<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> Let x \<tau>1 e1 e2 : \<tau>2"
399408

400-
| T_AppTI: "\<lbrakk> \<Gamma> \<turnstile> e : (\<forall>a . \<sigma>) \<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> TyApp e \<tau> : subst_type \<tau> a \<sigma>"
409+
| T_AppTI: "\<lbrakk> \<Gamma> \<turnstile> e : (\<forall>a . \<sigma>) ; \<Gamma> \<turnstile>\<^sub>t\<^sub>y \<tau> \<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> TyApp e \<tau> : subst_type \<tau> a \<sigma>"
401410

402-
| T_AbsTI: "\<lbrakk> BTyVar a # \<Gamma> \<turnstile> e : \<sigma> ; atom a \<sharp> (e, \<Gamma>) \<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> (\<Lambda> a . e) : (\<forall> a . \<sigma>)"
411+
| T_AbsTI: "\<lbrakk> BTyVar a # \<Gamma> \<turnstile> e : \<sigma> ; atom a \<sharp> \<Gamma> \<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> (\<Lambda> a . e) : (\<forall> a . \<sigma>)"
403412

404413
lemma fresh_not_isin_tyvar: "atom a \<sharp> \<Gamma> \<Longrightarrow> \<not>isin (BTyVar a) \<Gamma>"
405414
apply (induction \<Gamma>)

0 commit comments

Comments
 (0)