@@ -21,129 +21,6 @@ abbreviation Inj_FType_1 :: "'tyvar::var \<Rightarrow> 'tyvar FType" where "Inj_
2121abbreviation Sb_FType :: "('tyvar::var \<Rightarrow> 'tyvar FType) \<Rightarrow> 'tyvar FType \<Rightarrow> 'tyvar FType" where "Sb_FType \<equiv> tvsubst_FType"
2222abbreviation Vrs_FType_1 :: "'tyvar::var FType \<Rightarrow> 'tyvar set" where "Vrs_FType_1 \<equiv> FVars_FType"
2323
24- lemma VVr_eq_Var_FType : "tvVVr_tvsubst_FType = TyVar"
25- unfolding tvVVr_tvsubst_FType_def TyVar_def comp_def tv\<eta>_FType_tvsubst_FType_def by ( rule refl )
26-
27- lemma SSupp_Inj_FType [ simp ]: "SSupp_FType Inj_FType_1 = {}" unfolding SSupp_FType_def tvVVr_tvsubst_FType_def TyVar_def tv\<eta>_FType_tvsubst_FType_def by simp
28- lemma IImsupp_Inj_FType [ simp ]: "IImsupp_FType Inj_FType_1 = {}" unfolding IImsupp_FType_def by simp
29- lemma SSupp_IImsupp_bound [ simp ]:
30- fixes \<rho> :: "'tyvar::var \<Rightarrow> 'tyvar FType"
31- assumes "|SSupp_FType \<rho>| <o |UNIV::'tyvar set|"
32- shows "|IImsupp_FType \<rho>| <o |UNIV::'tyvar set|"
33- unfolding IImsupp_FType_def using assms by ( auto simp : FType.Un_bound FType.UN_bound FType.set_bd_UNIV )
34-
35- lemma SSupp_comp_subset_FType :
36- fixes \<rho> \<rho>' :: "'tyvar::var \<Rightarrow> 'tyvar FType"
37- assumes "|SSupp_FType \<rho>| <o |UNIV::'tyvar set|"
38- shows "SSupp_FType (tvsubst_FType \<rho> \<circ> \<rho>') \<subseteq> SSupp_FType \<rho> \<union> SSupp_FType \<rho>'"
39- unfolding SSupp_FType_def tvVVr_tvsubst_FType_def tv\<eta>_FType_tvsubst_FType_def comp_def
40- apply ( unfold TyVar_def [ symmetric ])
41- apply ( rule subsetI )
42- apply ( unfold mem_Collect_eq )
43- apply simp
44- using assms ( 1 ) by force
45- lemma SSupp_comp_bound_FType [ simp ]:
46- fixes \<rho> \<rho>' :: "'tyvar::var \<Rightarrow> 'tyvar FType"
47- assumes "|SSupp_FType \<rho>| <o |UNIV::'tyvar set|" "|SSupp_FType \<rho>'| <o |UNIV::'tyvar set|"
48- shows "|SSupp_FType (tvsubst_FType \<rho> \<circ> \<rho>')| <o |UNIV::'tyvar set|"
49- using assms SSupp_comp_subset_FType by ( metis card_of_subset_bound infinite_class.Un_bound )
50-
51- lemma Sb_Inj_FType : "Sb_FType Inj_FType_1 = id"
52- apply ( rule ext )
53- subgoal for x
54- apply ( induction x )
55- by auto
56- done
57- lemma Sb_comp_Inj_FType :
58- fixes \<rho> :: "'tyvar::var \<Rightarrow> 'tyvar FType"
59- assumes "|SSupp_FType \<rho>| <o |UNIV::'tyvar set|"
60- shows "Sb_FType \<rho> \<circ> Inj_FType_1 = \<rho>"
61- using assms by auto
62-
63- lemma Sb_comp_FType :
64- fixes \<rho>'' \<rho>' :: "'tyvar::var \<Rightarrow> 'tyvar FType"
65- assumes "|SSupp_FType \<rho>''| <o |UNIV::'tyvar set|" "|SSupp_FType \<rho>'| <o |UNIV::'tyvar set|"
66- shows "Sb_FType \<rho>'' \<circ> Sb_FType \<rho>' = Sb_FType (Sb_FType \<rho>'' \<circ> \<rho>')"
67- apply ( rule ext )
68- apply ( rule trans [ OF comp_apply ])
69- subgoal for x
70- apply ( binder_induction x avoiding : "IImsupp_FType \<rho>''" "IImsupp_FType \<rho>'" "IImsupp_FType (Sb_FType \<rho>'' \<circ> \<rho>')" rule : FType.strong_induct )
71- using assms by ( auto simp : IImsupp_FType_def FType.Un_bound FType.UN_bound FType.set_bd_UNIV )
72- done
73- thm Sb_comp_FType [ unfolded SSupp_FType_def tvVVr_tvsubst_FType_def [ unfolded comp_def ] tv\<eta>_FType_tvsubst_FType_def TyVar_def [ symmetric ]]
74- lemma Vrs_Inj_FType : "Vrs_FType_1 (Inj_FType_1 a) = {a}"
75- by simp
76-
77- lemma Vrs_Sb_FType :
78- fixes \<rho>' :: "'tyvar::var \<Rightarrow> 'tyvar FType"
79- assumes "|SSupp_FType \<rho>'| <o |UNIV::'tyvar set|"
80- shows "Vrs_FType_1 (Sb_FType \<rho>' x) = (\<Union>a\<in>Vrs_FType_1 x. Vrs_FType_1 (\<rho>' a))"
81- proof ( binder_induction x avoiding : "IImsupp_FType \<rho>'" rule : FType.strong_induct )
82- case ( TyAll x1 x2 )
83- then show ?case using assms by ( auto intro !: FType.IImsupp_Diff [ symmetric ])
84- qed ( auto simp : assms )
85-
86- lemma Sb_cong_FType :
87- fixes \<rho>'' \<rho>' :: "'tyvar::var \<Rightarrow> 'tyvar FType"
88- assumes "|SSupp_FType \<rho>''| <o |UNIV::'tyvar set|" "|SSupp_FType \<rho>'| <o |UNIV::'tyvar set|"
89- and "\<And>a. a \<in> Vrs_FType_1 t \<Longrightarrow> \<rho>'' a = \<rho>' a"
90- shows "Sb_FType \<rho>'' t = Sb_FType \<rho>' t"
91- using assms ( 3 ) proof ( binder_induction t avoiding : "IImsupp_FType \<rho>''" "IImsupp_FType \<rho>'" rule : FType.strong_induct )
92- case ( TyAll x1 x2 )
93- then show ?case using assms apply ( auto simp : FType.permute_id )
94- by ( metis ( mono_tags , lifting ) CollectI IImsupp_FType_def SSupp_FType_def Un_iff )
95- qed ( auto simp : assms ( 1 - 2 ))
96-
97- lemma map_is_Sb_FType :
98- fixes f :: "'tyvar::var \<Rightarrow> 'tyvar"
99- assumes "|supp f| <o |UNIV::'tyvar set|"
100- shows "vvsubst_FType f = Sb_FType (Inj_FType_1 \<circ> f)"
101- apply ( rule ext )
102- subgoal for x
103- proof ( binder_induction x avoiding : "imsupp f" rule : FType.strong_induct )
104- case Bound
105- then show ?case using imsupp_supp_bound infinite_UNIV assms by blast
106- next
107- case ( TyAll x1 x2 )
108- then have 1 : "x1 \<notin> SSupp_FType (Inj_FType_1 \<circ> f)"
109- by ( simp add : SSupp_FType_def VVr_eq_Var_FType not_in_imsupp_same )
110- then have "x1 \<notin> IImsupp_FType (Inj_FType_1 \<circ> f)"
111- unfolding IImsupp_FType_def Un_iff de_Morgan_disj
112- apply ( rule conjI )
113- apply ( insert 1 )
114- apply ( erule contrapos_nn )
115- apply ( erule UN_E )
116- by ( metis FType.set ( 1 ) TyAll.fresh comp_apply in_imsupp not_in_imsupp_same singletonD )
117- then show ?case using assms TyAll by ( auto simp : FType.SSupp_comp_bound_old )
118- qed ( auto simp : FType.SSupp_comp_bound_old assms )
119- done
120-
121- declare [[ ML_print_depth = 1000 ]]
122-
123- local_setup \<open>fold BMV_Monad_Def.register_mrbnf_as_pbmv_monad [@{type_name sum}, @{type_name prod}]\<close>
124-
125- pbmv_monad "'tv::var FType"
126- Sbs : tvsubst_FType
127- Injs : TyVar
128- Vrs : FVars_FType
129- bd : natLeq
130- apply ( rule infinite_regular_card_order_natLeq )
131- apply ( rule Sb_Inj_FType )
132- apply ( unfold SSupp_def SSupp_FType_def [ unfolded tvVVr_tvsubst_FType_def [ unfolded comp_def tv\<eta>_FType_tvsubst_FType_def TyVar_def [ symmetric ]], symmetric ])
133- apply ( rule Sb_comp_Inj_FType ; assumption )
134- apply ( rule Sb_comp_FType ; assumption )
135- apply ( rule FType.set_bd )
136- apply ( rule Vrs_Inj_FType )
137- apply ( rule Vrs_Sb_FType ; assumption )
138- apply ( rule Sb_cong_FType ; assumption )
139- done
140- print_theorems
141-
142- mrsbnf "'a::var FType"
143- apply ( rule map_is_Sb_FType ; assumption )
144- done
145- print_theorems
146-
14724binder_datatype 'a LM =
14825 Var 'a
14926 | Lst "'a list"
0 commit comments