159 lemma Quotient_alt_def4: |
159 lemma Quotient_alt_def4: |
160 "Quotient R Abs Rep T \<longleftrightarrow> |
160 "Quotient R Abs Rep T \<longleftrightarrow> |
161 (\<forall>a b. T a b \<longrightarrow> Abs a = b) \<and> (\<forall>b. T (Rep b) b) \<and> R = T OO conversep T" |
161 (\<forall>a b. T a b \<longrightarrow> Abs a = b) \<and> (\<forall>b. T (Rep b) b) \<and> R = T OO conversep T" |
162 unfolding Quotient_alt_def3 fun_eq_iff by auto |
162 unfolding Quotient_alt_def3 fun_eq_iff by auto |
163 |
163 |
|
164 lemma Quotient_alt_def5: |
|
165 "Quotient R Abs Rep T \<longleftrightarrow> |
|
166 T \<le> BNF_Util.Grp UNIV Abs \<and> BNF_Util.Grp UNIV Rep \<le> T\<inverse>\<inverse> \<and> R = T OO T\<inverse>\<inverse>" |
|
167 unfolding Quotient_alt_def4 Grp_def by blast |
|
168 |
164 lemma fun_quotient: |
169 lemma fun_quotient: |
165 assumes 1: "Quotient R1 abs1 rep1 T1" |
170 assumes 1: "Quotient R1 abs1 rep1 T1" |
166 assumes 2: "Quotient R2 abs2 rep2 T2" |
171 assumes 2: "Quotient R2 abs2 rep2 T2" |
167 shows "Quotient (R1 ===> R2) (rep1 ---> abs2) (abs1 ---> rep2) (T1 ===> T2)" |
172 shows "Quotient (R1 ===> R2) (rep1 ---> abs2) (abs1 ---> rep2) (T1 ===> T2)" |
168 using assms unfolding Quotient_alt_def2 |
173 using assms unfolding Quotient_alt_def2 |
207 definition Respects :: "('a \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> 'a set" |
212 definition Respects :: "('a \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> 'a set" |
208 where "Respects R = {x. R x x}" |
213 where "Respects R = {x. R x x}" |
209 |
214 |
210 lemma in_respects: "x \<in> Respects R \<longleftrightarrow> R x x" |
215 lemma in_respects: "x \<in> Respects R \<longleftrightarrow> R x x" |
211 unfolding Respects_def by simp |
216 unfolding Respects_def by simp |
212 |
|
213 subsection {* Invariant *} |
|
214 |
|
215 definition eq_onp :: "('a \<Rightarrow> bool) \<Rightarrow> 'a \<Rightarrow> 'a \<Rightarrow> bool" |
|
216 where "eq_onp R = (\<lambda>x y. R x \<and> x = y)" |
|
217 |
|
218 lemma eq_onp_to_eq: |
|
219 assumes "eq_onp P x y" |
|
220 shows "x = y" |
|
221 using assms by (simp add: eq_onp_def) |
|
222 |
|
223 lemma rel_fun_eq_eq_onp: "(op= ===> eq_onp P) = eq_onp (\<lambda>f. \<forall>x. P(f x))" |
|
224 unfolding eq_onp_def rel_fun_def by auto |
|
225 |
|
226 lemma rel_fun_eq_onp_rel: |
|
227 shows "((eq_onp R) ===> S) = (\<lambda>f g. \<forall>x. R x \<longrightarrow> S (f x) (g x))" |
|
228 by (auto simp add: eq_onp_def rel_fun_def) |
|
229 |
|
230 lemma eq_onp_same_args: |
|
231 shows "eq_onp P x x \<equiv> P x" |
|
232 using assms by (auto simp add: eq_onp_def) |
|
233 |
|
234 lemma eq_onp_transfer [transfer_rule]: |
|
235 assumes [transfer_rule]: "bi_unique A" |
|
236 shows "((A ===> op=) ===> A ===> A ===> op=) eq_onp eq_onp" |
|
237 unfolding eq_onp_def[abs_def] by transfer_prover |
|
238 |
217 |
239 lemma UNIV_typedef_to_Quotient: |
218 lemma UNIV_typedef_to_Quotient: |
240 assumes "type_definition Rep Abs UNIV" |
219 assumes "type_definition Rep Abs UNIV" |
241 and T_def: "T \<equiv> (\<lambda>x y. x = Rep y)" |
220 and T_def: "T \<equiv> (\<lambda>x y. x = Rep y)" |
242 shows "Quotient (op =) Abs Rep T" |
221 shows "Quotient (op =) Abs Rep T" |
572 (* setup for the function type *) |
551 (* setup for the function type *) |
573 declare fun_quotient[quot_map] |
552 declare fun_quotient[quot_map] |
574 declare fun_mono[relator_mono] |
553 declare fun_mono[relator_mono] |
575 lemmas [relator_distr] = pos_fun_distr neg_fun_distr1 neg_fun_distr2 |
554 lemmas [relator_distr] = pos_fun_distr neg_fun_distr1 neg_fun_distr2 |
576 |
555 |
|
556 ML_file "Tools/Lifting/lifting_bnf.ML" |
|
557 |
577 ML_file "Tools/Lifting/lifting_term.ML" |
558 ML_file "Tools/Lifting/lifting_term.ML" |
578 |
559 |
579 ML_file "Tools/Lifting/lifting_def.ML" |
560 ML_file "Tools/Lifting/lifting_def.ML" |
580 |
561 |
581 ML_file "Tools/Lifting/lifting_setup.ML" |
562 ML_file "Tools/Lifting/lifting_setup.ML" |