119 end |
119 end |
120 |
120 |
121 lemma identity_quotient: "Quotient (op =) id id (op =)" |
121 lemma identity_quotient: "Quotient (op =) id id (op =)" |
122 unfolding Quotient_def by simp |
122 unfolding Quotient_def by simp |
123 |
123 |
124 lemma reflp_equality: "reflp (op =)" |
|
125 by (auto intro: reflpI) |
|
126 |
|
127 text {* TODO: Use one of these alternatives as the real definition. *} |
124 text {* TODO: Use one of these alternatives as the real definition. *} |
128 |
125 |
129 lemma Quotient_alt_def: |
126 lemma Quotient_alt_def: |
130 "Quotient R Abs Rep T \<longleftrightarrow> |
127 "Quotient R Abs Rep T \<longleftrightarrow> |
131 (\<forall>a b. T a b \<longrightarrow> Abs a = b) \<and> |
128 (\<forall>a b. T a b \<longrightarrow> Abs a = b) \<and> |
378 lemma Quotient_to_transfer: |
375 lemma Quotient_to_transfer: |
379 assumes "Quotient R Abs Rep T" and "R c c" and "c' \<equiv> Abs c" |
376 assumes "Quotient R Abs Rep T" and "R c c" and "c' \<equiv> Abs c" |
380 shows "T c c'" |
377 shows "T c c'" |
381 using assms by (auto dest: Quotient_cr_rel) |
378 using assms by (auto dest: Quotient_cr_rel) |
382 |
379 |
|
380 text {* Proving reflexivity *} |
|
381 |
|
382 definition left_total :: "('a \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> bool" |
|
383 where "left_total R \<longleftrightarrow> (\<forall>x. \<exists>y. R x y)" |
|
384 |
|
385 lemma left_totalI: |
|
386 "(\<And>x. \<exists>y. R x y) \<Longrightarrow> left_total R" |
|
387 unfolding left_total_def by blast |
|
388 |
|
389 lemma left_totalE: |
|
390 assumes "left_total R" |
|
391 obtains "(\<And>x. \<exists>y. R x y)" |
|
392 using assms unfolding left_total_def by blast |
|
393 |
|
394 lemma Quotient_to_left_total: |
|
395 assumes q: "Quotient R Abs Rep T" |
|
396 and r_R: "reflp R" |
|
397 shows "left_total T" |
|
398 using r_R Quotient_cr_rel[OF q] unfolding left_total_def by (auto elim: reflpE) |
|
399 |
|
400 lemma reflp_Quotient_composition: |
|
401 assumes lt_R1: "left_total R1" |
|
402 and r_R2: "reflp R2" |
|
403 shows "reflp (R1 OO R2 OO R1\<inverse>\<inverse>)" |
|
404 using assms |
|
405 proof - |
|
406 { |
|
407 fix x |
|
408 from lt_R1 obtain y where "R1 x y" unfolding left_total_def by blast |
|
409 moreover then have "R1\<inverse>\<inverse> y x" by simp |
|
410 moreover have "R2 y y" using r_R2 by (auto elim: reflpE) |
|
411 ultimately have "(R1 OO R2 OO R1\<inverse>\<inverse>) x x" by auto |
|
412 } |
|
413 then show ?thesis by (auto intro: reflpI) |
|
414 qed |
|
415 |
|
416 lemma reflp_equality: "reflp (op =)" |
|
417 by (auto intro: reflpI) |
|
418 |
383 subsection {* ML setup *} |
419 subsection {* ML setup *} |
384 |
420 |
385 use "Tools/Lifting/lifting_util.ML" |
421 use "Tools/Lifting/lifting_util.ML" |
386 |
422 |
387 use "Tools/Lifting/lifting_info.ML" |
423 use "Tools/Lifting/lifting_info.ML" |
388 setup Lifting_Info.setup |
424 setup Lifting_Info.setup |
389 |
425 |
390 declare fun_quotient[quot_map] |
426 declare fun_quotient[quot_map] |
391 declare reflp_equality[reflp_preserve] |
427 lemmas [reflexivity_rule] = reflp_equality reflp_Quotient_composition |
392 |
428 |
393 use "Tools/Lifting/lifting_term.ML" |
429 use "Tools/Lifting/lifting_term.ML" |
394 |
430 |
395 use "Tools/Lifting/lifting_def.ML" |
431 use "Tools/Lifting/lifting_def.ML" |
396 |
432 |