Skip to content

Commit 0337333

Browse files
author
Andrei Popescu
committed
more
1 parent 08bac7e commit 0337333

File tree

3 files changed

+105
-107
lines changed

3 files changed

+105
-107
lines changed

thys/POPLmark/POPLmark_1A.thy

Lines changed: 35 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ begin
55
(********************* Actual formalization ************************)
66

77
lemma ty_refl: "\<lbrakk>wf \<Gamma> ; T closed_in \<Gamma> \<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> T <: T"
8-
proof (binder_induction T arbitrary: \<Gamma> avoiding: "dom \<Gamma>" rule: Type.strong_induct)
9-
case (TyVar x \<Gamma>)
8+
proof (binder_induction T arbitrary: \<Gamma> avoiding: "dom \<Gamma>" rule: sftypeP.strong_induct)
9+
case (TVr x \<Gamma>)
1010
then show ?case by blast
1111
qed (auto simp: Diff_single_insert SA_All wf_Cons)
1212

@@ -83,24 +83,22 @@ proof (induction \<Delta>)
8383
then show ?case unfolding 1 using Cons 2 by auto
8484
qed auto
8585

86-
(* todo for A: look at this and the next *)
87-
(* TODO: Automatically derive these from strong induction *)
8886
lemma SA_AllE1[consumes 2, case_names SA_Trans_TVar SA_All]:
8987
assumes "\<Gamma> \<turnstile> \<forall>X<:S\<^sub>1. S\<^sub>2 <: T" "X \<notin> dom \<Gamma>"
9088
and Top: "\<And>\<Gamma>. \<lbrakk>wf \<Gamma>; \<forall>X<:S\<^sub>1. S\<^sub>2 closed_in \<Gamma> \<rbrakk> \<Longrightarrow> R \<Gamma> (\<forall>X<:S\<^sub>1. S\<^sub>2) Top"
9189
and Forall: "\<And>\<Gamma> T\<^sub>1 T\<^sub>2. \<lbrakk> \<Gamma> \<turnstile> T\<^sub>1 <: S\<^sub>1 ; \<Gamma>,, X<:T\<^sub>1 \<turnstile> S\<^sub>2 <: T\<^sub>2 \<rbrakk> \<Longrightarrow> R \<Gamma> (\<forall>X<:S\<^sub>1. S\<^sub>2) (\<forall>X<:T\<^sub>1 . T\<^sub>2)"
9290
shows "R \<Gamma> (\<forall>X<:S\<^sub>1. S\<^sub>2) T"
9391
using assms(1,2) proof (binder_induction \<Gamma> "\<forall>X<:S\<^sub>1. S\<^sub>2" T avoiding: \<Gamma> "\<forall>X<:S\<^sub>1. S\<^sub>2" T rule: ty.strong_induct)
9492
case (SA_All \<Gamma> T\<^sub>1 R\<^sub>1 Y R\<^sub>2 T\<^sub>2)
95-
have 1: "\<forall>Y<:T\<^sub>1 . T\<^sub>2 = \<forall>X<:T\<^sub>1. rrename_Type (id(Y:=X,X:=Y)) T\<^sub>2"
93+
have 1: "\<forall>Y<:T\<^sub>1 . T\<^sub>2 = \<forall>X<:T\<^sub>1. rrename_sftypeP (id(Y:=X,X:=Y)) T\<^sub>2"
9694
apply (rule Forall_swap)
9795
using SA_All(6,9) well_scoped(2) by fastforce
98-
have fresh: "X \<notin> FFVars_Type T\<^sub>1"
96+
have fresh: "X \<notin> FFVars_sftypeP T\<^sub>1"
9997
by (meson SA_All(4,9) in_mono well_scoped(1))
100-
have same: "R\<^sub>1 = S\<^sub>1" using SA_All(8) Type_inject(3) by blast
101-
have x: "\<forall>Y<:S\<^sub>1. R\<^sub>2 = \<forall>X<:S\<^sub>1. rrename_Type (id(Y:=X,X:=Y)) R\<^sub>2"
98+
have same: "R\<^sub>1 = S\<^sub>1" using SA_All(8) sftypeP_inject(3) by blast
99+
have x: "\<forall>Y<:S\<^sub>1. R\<^sub>2 = \<forall>X<:S\<^sub>1. rrename_sftypeP (id(Y:=X,X:=Y)) R\<^sub>2"
102100
apply (rule Forall_swap)
103-
by (metis (no_types, lifting) SA_All(8) assms(1,2) in_mono sup.bounded_iff Type.set(4) well_scoped(1))
101+
by (metis (no_types, lifting) SA_All(8) assms(1,2) in_mono sup.bounded_iff sftypeP.set(4) well_scoped(1))
104102
show ?case unfolding 1
105103
apply (rule Forall)
106104
using same SA_All(4) apply simp
@@ -120,27 +118,27 @@ qed (auto simp: Top)
120118

121119
lemma SA_AllE2[consumes 2, case_names SA_Trans_TVar SA_All]:
122120
assumes "\<Gamma> \<turnstile> S <: \<forall>X<:T\<^sub>1. T\<^sub>2" "X \<notin> dom \<Gamma>"
123-
and TyVar: "\<And>\<Gamma> x U. \<lbrakk> x<:U \<in> \<Gamma> ; \<Gamma> \<turnstile> U <: \<forall> X <: T\<^sub>1 . T\<^sub>2 ; R \<Gamma> U (\<forall>X<:T\<^sub>1. T\<^sub>2) \<rbrakk> \<Longrightarrow> R \<Gamma> (TyVar x) (\<forall> X <: T\<^sub>1 . T\<^sub>2)"
121+
and TVr: "\<And>\<Gamma> x U. \<lbrakk> x<:U \<in> \<Gamma> ; \<Gamma> \<turnstile> U <: \<forall> X <: T\<^sub>1 . T\<^sub>2 ; R \<Gamma> U (\<forall>X<:T\<^sub>1. T\<^sub>2) \<rbrakk> \<Longrightarrow> R \<Gamma> (TVr x) (\<forall> X <: T\<^sub>1 . T\<^sub>2)"
124122
and Forall: "\<And>\<Gamma> S\<^sub>1 S\<^sub>2. \<lbrakk> \<Gamma> \<turnstile> T\<^sub>1 <: S\<^sub>1 ; \<Gamma>,, X<:T\<^sub>1 \<turnstile> S\<^sub>2 <: T\<^sub>2 \<rbrakk> \<Longrightarrow> R \<Gamma> (\<forall>X<:S\<^sub>1. S\<^sub>2) (\<forall> X <: T\<^sub>1 . T\<^sub>2)"
125123
shows "R \<Gamma> S (\<forall>X<:T\<^sub>1. T\<^sub>2)"
126124
using assms(1,2) proof (binder_induction \<Gamma> S "\<forall>X<:T\<^sub>1. T\<^sub>2" avoiding: \<Gamma> S "\<forall>X<:T\<^sub>1. T\<^sub>2" rule: ty.strong_induct)
127125
case (SA_All \<Gamma> R\<^sub>1 S\<^sub>1 Y S\<^sub>2 R\<^sub>2)
128-
have 1: "\<forall>Y<:S\<^sub>1. S\<^sub>2 = \<forall>X<:S\<^sub>1. rrename_Type (id(Y:=X,X:=Y)) S\<^sub>2"
126+
have 1: "\<forall>Y<:S\<^sub>1. S\<^sub>2 = \<forall>X<:S\<^sub>1. rrename_sftypeP (id(Y:=X,X:=Y)) S\<^sub>2"
129127
apply (rule Forall_swap)
130128
using SA_All(6,9) well_scoped(1) by fastforce
131129
have fresh: "X \<notin> dom \<Gamma>" "Y \<notin> dom \<Gamma>"
132130
using SA_All(9) apply blast
133131
by (metis SA_All(6) fst_conv wf_ConsE wf_context)
134-
have fresh2: "X \<notin> FFVars_Type T\<^sub>1" "Y \<notin> FFVars_Type T\<^sub>1"
135-
apply (metis SA_All(4,8) in_mono fresh(1) Type_inject(3) well_scoped(1))
136-
by (metis SA_All(4,8) in_mono fresh(2) Type_inject(3) well_scoped(1))
137-
have same: "R\<^sub>1 = T\<^sub>1" using SA_All(8) Type_inject(3) by blast
138-
have x: "\<forall>Y<:T\<^sub>1 . R\<^sub>2 = \<forall>X<:T\<^sub>1. rrename_Type (id(Y:=X,X:=Y)) R\<^sub>2"
132+
have fresh2: "X \<notin> FFVars_sftypeP T\<^sub>1" "Y \<notin> FFVars_sftypeP T\<^sub>1"
133+
apply (metis SA_All(4,8) in_mono fresh(1) sftypeP_inject(3) well_scoped(1))
134+
by (metis SA_All(4,8) in_mono fresh(2) sftypeP_inject(3) well_scoped(1))
135+
have same: "R\<^sub>1 = T\<^sub>1" using SA_All(8) sftypeP_inject(3) by blast
136+
have x: "\<forall>Y<:T\<^sub>1 . R\<^sub>2 = \<forall>X<:T\<^sub>1. rrename_sftypeP (id(Y:=X,X:=Y)) R\<^sub>2"
139137
apply (rule Forall_swap)
140-
by (metis SA_All(8) Un_iff assms(1,2) in_mono Type.set(4) well_scoped(2))
138+
by (metis SA_All(8) Un_iff assms(1,2) in_mono sftypeP.set(4) well_scoped(2))
141139
show ?case unfolding 1
142140
apply (rule Forall)
143-
apply (metis SA_All(4,8) Type_inject(3))
141+
apply (metis SA_All(4,8) sftypeP_inject(3))
144142
apply (rule iffD2[OF arg_cong3[OF _ refl, of _ _ _ _ ty], rotated -1])
145143
apply (rule ty.equiv)
146144
apply (rule bij_swap supp_swap_bound infinite_var)+
@@ -151,9 +149,9 @@ using assms(1,2) proof (binder_induction \<Gamma> S "\<forall>X<:T\<^sub>1. T\<^
151149
apply (rule arg_cong3[of _ _ _ _ _ _ extend])
152150
using fresh apply (metis bij_swap SA_All(4) Un_iff context_map_cong_id fun_upd_apply id_apply infinite_var supp_swap_bound wf_FFVars wf_context)
153151
apply simp
154-
using fresh2 unfolding same apply (metis bij_swap fun_upd_apply id_apply infinite_var supp_swap_bound Type.rrename_cong_ids)
152+
using fresh2 unfolding same apply (metis bij_swap fun_upd_apply id_apply infinite_var supp_swap_bound sftypeP.rrename_cong_ids)
155153
using SA_All(8) x Forall_inject_same unfolding same by simp
156-
qed (auto simp: TyVar)
154+
qed (auto simp: TVr)
157155

158156
lemma ty_transitivity : "\<lbrakk> \<Gamma> \<turnstile> S <: Q ; \<Gamma> \<turnstile> Q <: T \<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> S <: T"
159157
and ty_narrowing : "\<lbrakk> (\<Gamma> ,, X <: Q),, \<Delta> \<turnstile> M <: N ; \<Gamma> \<turnstile> R <: Q \<rbrakk> \<Longrightarrow> (\<Gamma>,, X <: R),, \<Delta> \<turnstile> M <: N"
@@ -162,25 +160,25 @@ proof -
162160
ty_trans: "\<lbrakk> \<Gamma> \<turnstile> S <: Q ; \<Gamma> \<turnstile> Q <: T \<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> S <: T"
163161
and ty_narrow: "\<lbrakk> (\<Gamma>,, X <: Q),, \<Delta> \<turnstile> M <: N ; \<Gamma> \<turnstile> R <: Q ; wf (\<Gamma>,, X <: R,, \<Delta>) ;
164162
M closed_in (\<Gamma>,, X <: R,, \<Delta>) ; N closed_in (\<Gamma>,, X <: R,, \<Delta>) \<rbrakk> \<Longrightarrow> (\<Gamma>,, X <: R),, \<Delta> \<turnstile> M <: N"
165-
proof (binder_induction Q arbitrary: \<Gamma> \<Delta> S T M N X R avoiding: X "dom \<Gamma>" "dom \<Delta>" rule: Type.strong_induct)
166-
case (TyVar Y \<Gamma> \<Delta> S T M N X R)
163+
proof (binder_induction Q arbitrary: \<Gamma> \<Delta> S T M N X R avoiding: X "dom \<Gamma>" "dom \<Delta>" rule: sftypeP.strong_induct)
164+
case (TVr Y \<Gamma> \<Delta> S T M N X R)
167165
{
168166
fix \<Gamma> S T
169-
show ty_trans: "\<Gamma> \<turnstile> S <: TyVar Y \<Longrightarrow> \<Gamma> \<turnstile> TyVar Y <: T \<Longrightarrow> \<Gamma> \<turnstile> S <: T"
170-
by (induction \<Gamma> S "TyVar Y" rule: ty.induct) auto
167+
show ty_trans: "\<Gamma> \<turnstile> S <: TVr Y \<Longrightarrow> \<Gamma> \<turnstile> TVr Y <: T \<Longrightarrow> \<Gamma> \<turnstile> S <: T"
168+
by (induction \<Gamma> S "TVr Y" rule: ty.induct) auto
171169
} note ty_trans = this
172170
{
173171
case 2
174172
then show ?case
175-
proof (binder_induction "\<Gamma>,, X <: TyVar Y,, \<Delta>" M N arbitrary: \<Delta> avoiding: X "dom \<Gamma>" "dom \<Delta>" rule: ty.strong_induct)
173+
proof (binder_induction "\<Gamma>,, X <: TVr Y,, \<Delta>" M N arbitrary: \<Delta> avoiding: X "dom \<Gamma>" "dom \<Delta>" rule: ty.strong_induct)
176174
case (SA_Trans_TVar Z U T \<Delta>')
177175
show ?case
178176
proof (cases "X = Z")
179177
case True
180-
then have u: "U = TyVar Y" using SA_Trans_TVar(1,2) context_determ wf_context by blast
181-
have "TyVar Y closed_in (\<Gamma>,, Z <: R,, \<Delta>')" using SA_Trans_TVar(2) True u well_scoped(1) by fastforce
182-
then have "\<Gamma>,, Z <: R ,, \<Delta>' \<turnstile> TyVar Y <: T" using SA_Trans_TVar True u by auto
183-
moreover have "\<Gamma>,, Z <: R,, \<Delta>' \<turnstile> R <: TyVar Y" using ty_weakening[OF ty_weakening_extend[OF SA_Trans_TVar(4)]]
178+
then have u: "U = TVr Y" using SA_Trans_TVar(1,2) context_determ wf_context by blast
179+
have "TVr Y closed_in (\<Gamma>,, Z <: R,, \<Delta>')" using SA_Trans_TVar(2) True u well_scoped(1) by fastforce
180+
then have "\<Gamma>,, Z <: R ,, \<Delta>' \<turnstile> TVr Y <: T" using SA_Trans_TVar True u by auto
181+
moreover have "\<Gamma>,, Z <: R,, \<Delta>' \<turnstile> R <: TVr Y" using ty_weakening[OF ty_weakening_extend[OF SA_Trans_TVar(4)]]
184182
by (metis SA_Trans_TVar(5) True wf_ConsE wf_concatD)
185183
ultimately have "\<Gamma>,, Z <: R,, \<Delta>' \<turnstile> R <: T" using ty_trans by blast
186184
then show ?thesis unfolding True u using ty.SA_Trans_TVar by auto
@@ -254,7 +252,7 @@ proof -
254252
then show ?thesis by (meson left(1,3) ty.SA_Arrow ty.SA_Top well_scoped(1))
255253
next
256254
case right: (SA_Arrow U\<^sub>1 R\<^sub>1 R\<^sub>2 U\<^sub>2)
257-
then show ?thesis using left by (metis Fun(1,3) SA_Arrow Type_inject(2))
255+
then show ?thesis using left by (metis Fun(1,3) SA_Arrow sftypeP_inject(2))
258256
qed auto
259257
qed auto
260258
} note ty_trans = this
@@ -396,10 +394,10 @@ proof -
396394
qed
397395

398396
theorem ty_transitivity2: "\<lbrakk> \<Gamma> \<turnstile> S <: Q ; \<Gamma> \<turnstile> Q <: T \<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> S <: T"
399-
proof (binder_induction Q arbitrary: \<Gamma> S T avoiding: "dom \<Gamma>" rule: Type.strong_induct)
400-
case (TyVar x \<Gamma> S T)
397+
proof (binder_induction Q arbitrary: \<Gamma> S T avoiding: "dom \<Gamma>" rule: sftypeP.strong_induct)
398+
case (TVr x \<Gamma> S T)
401399
then show ?case
402-
by (induction \<Gamma> S "TyVar x") auto
400+
by (induction \<Gamma> S "TVr x") auto
403401
next
404402
case (Fun x1 x2 \<Gamma> S T)
405403
from Fun(4,3) show ?case
@@ -413,8 +411,8 @@ next
413411
case (SA_Arrow \<Gamma> U\<^sub>1 R\<^sub>1 R\<^sub>2 U\<^sub>2)
414412
show ?case
415413
apply (rule ty.SA_Arrow)
416-
apply (metis Fun(1) SA_Arrow(1,5,6,8) Type_inject(2))
417-
by (metis Fun(2) SA_Arrow(3,5,7,8) Type_inject(2))
414+
apply (metis Fun(1) SA_Arrow(1,5,6,8) sftypeP_inject(2))
415+
by (metis Fun(2) SA_Arrow(3,5,7,8) sftypeP_inject(2))
418416
qed auto
419417
qed auto
420418
next
@@ -437,9 +435,9 @@ next
437435
qed blast
438436
qed auto
439437

440-
(*
438+
441439
corollary ty_narrowing2: "\<lbrakk> \<Gamma>,, X <: Q,, \<Delta> \<turnstile> M <: N ; \<Gamma> \<turnstile> R <: Q \<rbrakk> \<Longrightarrow> \<Gamma>,, X <: R,, \<Delta> \<turnstile> M <: N"
442440
using ty_narrowing_aux ty_transitivity2 by blast
443-
*)
441+
444442

445443
end

thys/POPLmark/SystemFSub.thy

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
(* System F with SubTypeing *)
1+
(* System F with SubsftypePing *)
22
theory SystemFSub
33
imports "SystemFSub_Types"
44
begin
55

6-
abbreviation in_context :: "var \<Rightarrow> type \<Rightarrow> \<Gamma>\<^sub>\<tau> \<Rightarrow> bool" ("_ <: _ \<in> _" [55,55,55] 60) where
6+
abbreviation in_context :: "var \<Rightarrow> sftype \<Rightarrow> \<Gamma>\<^sub>\<tau> \<Rightarrow> bool" ("_ <: _ \<in> _" [55,55,55] 60) where
77
"x <: t \<in> \<Gamma> \<equiv> (x, t) \<in> set \<Gamma>"
8-
abbreviation well_scoped :: "type \<Rightarrow> \<Gamma>\<^sub>\<tau> \<Rightarrow> bool" ("_ closed'_in _" [55, 55] 60) where
9-
"well_scoped S \<Gamma> \<equiv> FFVars_Type S \<subseteq> dom \<Gamma>"
8+
abbreviation well_scoped :: "sftype \<Rightarrow> \<Gamma>\<^sub>\<tau> \<Rightarrow> bool" ("_ closed'_in _" [55, 55] 60) where
9+
"well_scoped S \<Gamma> \<equiv> FFVars_sftypeP S \<subseteq> dom \<Gamma>"
1010

1111
inductive wf :: "\<Gamma>\<^sub>\<tau> \<Rightarrow> bool" where
1212
wf_Nil[intro]: "wf []"
@@ -19,18 +19,18 @@ print_theorems
1919

2020
lemma in_context_eqvt:
2121
assumes "bij f" "|supp f| <o |UNIV::var set|"
22-
shows "x <: T \<in> \<Gamma> \<Longrightarrow> f x <: rrename_Type f T \<in> map_context f \<Gamma>"
22+
shows "x <: T \<in> \<Gamma> \<Longrightarrow> f x <: rrename_sftypeP f T \<in> map_context f \<Gamma>"
2323
using assms unfolding map_context_def by auto
2424

2525
lemma extend_eqvt:
2626
assumes "bij f" "|supp f| <o |UNIV::var set|"
27-
shows "map_context f (\<Gamma>,,x<:T) = map_context f \<Gamma>,,f x <: rrename_Type f T"
27+
shows "map_context f (\<Gamma>,,x<:T) = map_context f \<Gamma>,,f x <: rrename_sftypeP f T"
2828
using assms unfolding map_context_def by simp
2929

3030
lemma closed_in_eqvt:
3131
assumes "bij f" "|supp f| <o |UNIV::var set|"
32-
shows "S closed_in \<Gamma> \<Longrightarrow> rrename_Type f S closed_in map_context f \<Gamma>"
33-
using assms by (auto simp: Type.FFVars_rrenames)
32+
shows "S closed_in \<Gamma> \<Longrightarrow> rrename_sftypeP f S closed_in map_context f \<Gamma>"
33+
using assms by (auto simp: sftypeP.FFVars_rrenames)
3434

3535
lemma wf_eqvt:
3636
assumes "bij f" "|supp f| <o |UNIV::var set|"
@@ -42,11 +42,11 @@ unfolding map_context_def proof (induction \<Gamma>)
4242
using closed_in_eqvt map_context_def by fastforce
4343
qed simp
4444

45-
abbreviation Tsupp :: "\<Gamma>\<^sub>\<tau> \<Rightarrow> type \<Rightarrow> type \<Rightarrow> var set" where
46-
"Tsupp \<Gamma> T\<^sub>1 T\<^sub>2 \<equiv> dom \<Gamma> \<union> FFVars_ctxt \<Gamma> \<union> FFVars_Type T\<^sub>1 \<union> FFVars_Type T\<^sub>2"
45+
abbreviation Tsupp :: "\<Gamma>\<^sub>\<tau> \<Rightarrow> sftype \<Rightarrow> sftype \<Rightarrow> var set" where
46+
"Tsupp \<Gamma> T\<^sub>1 T\<^sub>2 \<equiv> dom \<Gamma> \<union> FFVars_ctxt \<Gamma> \<union> FFVars_sftypeP T\<^sub>1 \<union> FFVars_sftypeP T\<^sub>2"
4747

4848
lemma small_Tsupp: "small (Tsupp \<Gamma> T\<^sub>1 T\<^sub>2)"
49-
by (auto simp: small_def Type.card_of_FFVars_bounds Type.Un_bound var_Type_pre_class.UN_bound set_bd_UNIV Type.set_bd)
49+
by (auto simp: small_def sftypeP.card_of_FFVars_bounds sftypeP.Un_bound var_sftypeP_pre_class.UN_bound set_bd_UNIV sftypeP.set_bd)
5050

5151
lemma fresh: "\<exists>xx. xx \<notin> Tsupp \<Gamma> T\<^sub>1 T\<^sub>2"
5252
by (metis emp_bound equals0D imageI inf.commute inf_absorb2 small_Tsupp small_def small_isPerm subsetI)
@@ -73,17 +73,17 @@ qed
7373

7474
(* *)
7575

76-
inductive ty :: "\<Gamma>\<^sub>\<tau> \<Rightarrow> type \<Rightarrow> type \<Rightarrow> bool" ("_ \<turnstile> _ <: _" [55,55,55] 60) where
76+
inductive ty :: "\<Gamma>\<^sub>\<tau> \<Rightarrow> sftype \<Rightarrow> sftype \<Rightarrow> bool" ("_ \<turnstile> _ <: _" [55,55,55] 60) where
7777
SA_Top: "\<lbrakk>wf \<Gamma>; S closed_in \<Gamma> \<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> S <: Top"
78-
| SA_Refl_TVar: "\<lbrakk>wf \<Gamma>; TyVar x closed_in \<Gamma> \<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> TyVar x <: TyVar x"
79-
| SA_Trans_TVar: "\<lbrakk> X<:U \<in> \<Gamma> ; \<Gamma> \<turnstile> U <: T \<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> TyVar X <: T"
78+
| SA_Refl_TVar: "\<lbrakk>wf \<Gamma>; TVr x closed_in \<Gamma> \<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> TVr x <: TVr x"
79+
| SA_Trans_TVar: "\<lbrakk> X<:U \<in> \<Gamma> ; \<Gamma> \<turnstile> U <: T \<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> TVr X <: T"
8080
| SA_Arrow: "\<lbrakk> \<Gamma> \<turnstile> T\<^sub>1 <: S\<^sub>1 ; \<Gamma> \<turnstile> S\<^sub>2 <: T\<^sub>2 \<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> S\<^sub>1 \<rightarrow> S\<^sub>2 <: T\<^sub>1 \<rightarrow> T\<^sub>2"
8181
| SA_All: "\<lbrakk> \<Gamma> \<turnstile> T\<^sub>1 <: S\<^sub>1 ; \<Gamma>,, X<:T\<^sub>1 \<turnstile> S\<^sub>2 <: T\<^sub>2 \<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> \<forall>X<:S\<^sub>1. S\<^sub>2 <: \<forall>X<:T\<^sub>1 .T\<^sub>2"
8282

8383
inductive_cases
8484
SA_TopE[elim!]: "\<Gamma> \<turnstile> Top <: T"
8585
and
86-
SA_TVarE: "\<Gamma> \<turnstile> S <: TyVar Z"
86+
SA_TVarE: "\<Gamma> \<turnstile> S <: TVr Z"
8787
and
8888
SA_ArrER: "\<Gamma> \<turnstile> S <: T\<^sub>1 \<rightarrow> T\<^sub>2"
8989
and
@@ -102,24 +102,24 @@ lemma well_scoped:
102102
using assms proof (induction \<Gamma> S T rule: ty.induct)
103103
case (SA_Trans_TVar x U \<Gamma> T) {
104104
case 1 then show ?case using SA_Trans_TVar
105-
by (metis fst_conv imageI singletonD subsetI Type.set(1))
105+
by (metis fst_conv imageI singletonD subsetI sftypeP.set(1))
106106
next
107107
case 2 then show ?case using SA_Trans_TVar by simp
108108
} qed auto
109109

110110
declare ty.intros[intro]
111111

112-
lemma ty_fresh_extend: "\<Gamma>,, x <: U \<turnstile> S <: T \<Longrightarrow> x \<notin> dom \<Gamma> \<union> FFVars_ctxt \<Gamma> \<and> x \<notin> FFVars_Type U"
112+
lemma ty_fresh_extend: "\<Gamma>,, x <: U \<turnstile> S <: T \<Longrightarrow> x \<notin> dom \<Gamma> \<union> FFVars_ctxt \<Gamma> \<and> x \<notin> FFVars_sftypeP U"
113113
by (metis (no_types, lifting) UnE fst_conv snd_conv subsetD wf_ConsE wf_FFVars wf_context)
114114

115115
make_binder_inductive ty
116116
subgoal for R B \<sigma> \<Gamma> T1 T2
117117
unfolding split_beta
118118
by (elim disj_forward exE)
119-
(auto simp add: isPerm_def supp_inv_bound map_context_def[symmetric] Type_vvsubst_rrename
120-
Type.rrename_comps Type.FFVars_rrenames wf_eqvt extend_eqvt
119+
(auto simp add: isPerm_def supp_inv_bound map_context_def[symmetric] sftypeP_vvsubst_rrename
120+
sftypeP.rrename_comps sftypeP.FFVars_rrenames wf_eqvt extend_eqvt
121121
| ((rule exI[of _ "\<sigma> _"] exI)+, (rule conjI)?, rule refl)
122-
| ((rule exI[of _ "rrename_Type \<sigma> _"])+, (rule conjI)?, rule in_context_eqvt))+
122+
| ((rule exI[of _ "rrename_sftypeP \<sigma> _"])+, (rule conjI)?, rule in_context_eqvt))+
123123
subgoal premises prems for R B \<Gamma> T1 T2
124124
using prems
125125
unfolding ex_push_inwards conj_disj_distribL ex_disj_distrib
@@ -144,7 +144,7 @@ make_binder_inductive ty
144144
apply (drule prems(2)[rule_format, of "id(X := Z, Z := X)" "\<Gamma>,, X <: T\<^sub>1" "S\<^sub>2" "T\<^sub>2", rotated 2])
145145
apply (auto simp: extend_eqvt)
146146
apply(rule cong[OF cong[OF cong], THEN iffD1, of R , OF refl, rotated -1,
147-
of _ "rrename_Type (id(X := Z, Z := X)) S\<^sub>2"])
147+
of _ "rrename_sftypeP (id(X := Z, Z := X)) S\<^sub>2"])
148148
apply (drule ty_fresh_extend)
149149
apply (simp_all add: supp_swap_bound)
150150
by (metis (no_types, opaque_lifting) image_iff map_context_def map_context_swap_FFVars)

0 commit comments

Comments
 (0)