author | haftmann |
Wed, 08 Jul 2015 14:01:39 +0200 | |
changeset 60686 | ea5bc46c11e6 |
parent 59028 | df7476e79558 |
child 60758 | d8d85a8172b5 |
permissions | -rw-r--r-- |
41959 | 1 |
(* Title: HOL/Quotient.thy |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
2 |
Author: Cezary Kaliszyk and Christian Urban |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
3 |
*) |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
4 |
|
58889 | 5 |
section {* Definition of Quotient Types *} |
35294 | 6 |
|
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
7 |
theory Quotient |
54555 | 8 |
imports Lifting |
46950
d0181abdbdac
declare command keywords via theory header, including strict checking outside Pure;
wenzelm
parents:
46947
diff
changeset
|
9 |
keywords |
47308 | 10 |
"print_quotmapsQ3" "print_quotientsQ3" "print_quotconsts" :: diag and |
46950
d0181abdbdac
declare command keywords via theory header, including strict checking outside Pure;
wenzelm
parents:
46947
diff
changeset
|
11 |
"quotient_type" :: thy_goal and "/" and |
47091
d5cd13aca90b
respectfulness theorem has to be proved if a new constant is lifted by quotient_definition
kuncar
parents:
46950
diff
changeset
|
12 |
"quotient_definition" :: thy_goal |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
13 |
begin |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
14 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
15 |
text {* |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
16 |
Basic definition for equivalence relations |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
17 |
that are represented by predicates. |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
18 |
*} |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
19 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
20 |
text {* Composition of Relations *} |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
21 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
22 |
abbreviation |
40818
b117df72e56b
reorienting iff in Quotient_rel prevents simplifier looping;
haftmann
parents:
40814
diff
changeset
|
23 |
rel_conj :: "('a \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> ('b \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> 'a \<Rightarrow> 'b \<Rightarrow> bool" (infixr "OOO" 75) |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
24 |
where |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
25 |
"r1 OOO r2 \<equiv> r1 OO r2 OO r1" |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
26 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
27 |
lemma eq_comp_r: |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
28 |
shows "((op =) OOO R) = R" |
39302
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
nipkow
parents:
39198
diff
changeset
|
29 |
by (auto simp add: fun_eq_iff) |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
30 |
|
53011
aeee0a4be6cf
introduce locale with syntax for fun_rel and map_fun and make thus ===> and ---> local
kuncar
parents:
51112
diff
changeset
|
31 |
context |
aeee0a4be6cf
introduce locale with syntax for fun_rel and map_fun and make thus ===> and ---> local
kuncar
parents:
51112
diff
changeset
|
32 |
begin |
aeee0a4be6cf
introduce locale with syntax for fun_rel and map_fun and make thus ===> and ---> local
kuncar
parents:
51112
diff
changeset
|
33 |
interpretation lifting_syntax . |
aeee0a4be6cf
introduce locale with syntax for fun_rel and map_fun and make thus ===> and ---> local
kuncar
parents:
51112
diff
changeset
|
34 |
|
35294 | 35 |
subsection {* Quotient Predicate *} |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
36 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
37 |
definition |
47308 | 38 |
"Quotient3 R Abs Rep \<longleftrightarrow> |
40814
fa64f6278568
moved generic definitions about (partial) equivalence relations from Quotient to Equiv_Relations;
haftmann
parents:
40615
diff
changeset
|
39 |
(\<forall>a. Abs (Rep a) = a) \<and> (\<forall>a. R (Rep a) (Rep a)) \<and> |
40818
b117df72e56b
reorienting iff in Quotient_rel prevents simplifier looping;
haftmann
parents:
40814
diff
changeset
|
40 |
(\<forall>r s. R r s \<longleftrightarrow> R r r \<and> R s s \<and> Abs r = Abs s)" |
b117df72e56b
reorienting iff in Quotient_rel prevents simplifier looping;
haftmann
parents:
40814
diff
changeset
|
41 |
|
47308 | 42 |
lemma Quotient3I: |
40818
b117df72e56b
reorienting iff in Quotient_rel prevents simplifier looping;
haftmann
parents:
40814
diff
changeset
|
43 |
assumes "\<And>a. Abs (Rep a) = a" |
b117df72e56b
reorienting iff in Quotient_rel prevents simplifier looping;
haftmann
parents:
40814
diff
changeset
|
44 |
and "\<And>a. R (Rep a) (Rep a)" |
b117df72e56b
reorienting iff in Quotient_rel prevents simplifier looping;
haftmann
parents:
40814
diff
changeset
|
45 |
and "\<And>r s. R r s \<longleftrightarrow> R r r \<and> R s s \<and> Abs r = Abs s" |
47308 | 46 |
shows "Quotient3 R Abs Rep" |
47 |
using assms unfolding Quotient3_def by blast |
|
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
48 |
|
54867
c21a2465cac1
prefer ephemeral interpretation over interpretation in proof contexts;
haftmann
parents:
54555
diff
changeset
|
49 |
context |
c21a2465cac1
prefer ephemeral interpretation over interpretation in proof contexts;
haftmann
parents:
54555
diff
changeset
|
50 |
fixes R Abs Rep |
47308 | 51 |
assumes a: "Quotient3 R Abs Rep" |
54867
c21a2465cac1
prefer ephemeral interpretation over interpretation in proof contexts;
haftmann
parents:
54555
diff
changeset
|
52 |
begin |
c21a2465cac1
prefer ephemeral interpretation over interpretation in proof contexts;
haftmann
parents:
54555
diff
changeset
|
53 |
|
c21a2465cac1
prefer ephemeral interpretation over interpretation in proof contexts;
haftmann
parents:
54555
diff
changeset
|
54 |
lemma Quotient3_abs_rep: |
c21a2465cac1
prefer ephemeral interpretation over interpretation in proof contexts;
haftmann
parents:
54555
diff
changeset
|
55 |
"Abs (Rep a) = a" |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
56 |
using a |
47308 | 57 |
unfolding Quotient3_def |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
58 |
by simp |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
59 |
|
47308 | 60 |
lemma Quotient3_rep_reflp: |
54867
c21a2465cac1
prefer ephemeral interpretation over interpretation in proof contexts;
haftmann
parents:
54555
diff
changeset
|
61 |
"R (Rep a) (Rep a)" |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
62 |
using a |
47308 | 63 |
unfolding Quotient3_def |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
64 |
by blast |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
65 |
|
47308 | 66 |
lemma Quotient3_rel: |
54867
c21a2465cac1
prefer ephemeral interpretation over interpretation in proof contexts;
haftmann
parents:
54555
diff
changeset
|
67 |
"R r r \<and> R s s \<and> Abs r = Abs s \<longleftrightarrow> R r s" -- {* orientation does not loop on rewriting *} |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
68 |
using a |
47308 | 69 |
unfolding Quotient3_def |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
70 |
by blast |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
71 |
|
47308 | 72 |
lemma Quotient3_refl1: |
54867
c21a2465cac1
prefer ephemeral interpretation over interpretation in proof contexts;
haftmann
parents:
54555
diff
changeset
|
73 |
"R r s \<Longrightarrow> R r r" |
47308 | 74 |
using a unfolding Quotient3_def |
47096
3ea48c19673e
generation of a code certificate from a respectfulness theorem for constants lifted by the quotient_definition command & setup_lifting command: setups Quotient infrastructure from a typedef theorem
kuncar
parents:
47094
diff
changeset
|
75 |
by fast |
3ea48c19673e
generation of a code certificate from a respectfulness theorem for constants lifted by the quotient_definition command & setup_lifting command: setups Quotient infrastructure from a typedef theorem
kuncar
parents:
47094
diff
changeset
|
76 |
|
47308 | 77 |
lemma Quotient3_refl2: |
54867
c21a2465cac1
prefer ephemeral interpretation over interpretation in proof contexts;
haftmann
parents:
54555
diff
changeset
|
78 |
"R r s \<Longrightarrow> R s s" |
47308 | 79 |
using a unfolding Quotient3_def |
47096
3ea48c19673e
generation of a code certificate from a respectfulness theorem for constants lifted by the quotient_definition command & setup_lifting command: setups Quotient infrastructure from a typedef theorem
kuncar
parents:
47094
diff
changeset
|
80 |
by fast |
3ea48c19673e
generation of a code certificate from a respectfulness theorem for constants lifted by the quotient_definition command & setup_lifting command: setups Quotient infrastructure from a typedef theorem
kuncar
parents:
47094
diff
changeset
|
81 |
|
47308 | 82 |
lemma Quotient3_rel_rep: |
54867
c21a2465cac1
prefer ephemeral interpretation over interpretation in proof contexts;
haftmann
parents:
54555
diff
changeset
|
83 |
"R (Rep a) (Rep b) \<longleftrightarrow> a = b" |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
84 |
using a |
47308 | 85 |
unfolding Quotient3_def |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
86 |
by metis |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
87 |
|
47308 | 88 |
lemma Quotient3_rep_abs: |
54867
c21a2465cac1
prefer ephemeral interpretation over interpretation in proof contexts;
haftmann
parents:
54555
diff
changeset
|
89 |
"R r r \<Longrightarrow> R (Rep (Abs r)) r" |
47308 | 90 |
using a unfolding Quotient3_def |
91 |
by blast |
|
92 |
||
93 |
lemma Quotient3_rel_abs: |
|
54867
c21a2465cac1
prefer ephemeral interpretation over interpretation in proof contexts;
haftmann
parents:
54555
diff
changeset
|
94 |
"R r s \<Longrightarrow> Abs r = Abs s" |
47308 | 95 |
using a unfolding Quotient3_def |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
96 |
by blast |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
97 |
|
47308 | 98 |
lemma Quotient3_symp: |
54867
c21a2465cac1
prefer ephemeral interpretation over interpretation in proof contexts;
haftmann
parents:
54555
diff
changeset
|
99 |
"symp R" |
47308 | 100 |
using a unfolding Quotient3_def using sympI by metis |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
101 |
|
47308 | 102 |
lemma Quotient3_transp: |
54867
c21a2465cac1
prefer ephemeral interpretation over interpretation in proof contexts;
haftmann
parents:
54555
diff
changeset
|
103 |
"transp R" |
47308 | 104 |
using a unfolding Quotient3_def using transpI by (metis (full_types)) |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
105 |
|
47308 | 106 |
lemma Quotient3_part_equivp: |
54867
c21a2465cac1
prefer ephemeral interpretation over interpretation in proof contexts;
haftmann
parents:
54555
diff
changeset
|
107 |
"part_equivp R" |
c21a2465cac1
prefer ephemeral interpretation over interpretation in proof contexts;
haftmann
parents:
54555
diff
changeset
|
108 |
by (metis Quotient3_rep_reflp Quotient3_symp Quotient3_transp part_equivpI) |
c21a2465cac1
prefer ephemeral interpretation over interpretation in proof contexts;
haftmann
parents:
54555
diff
changeset
|
109 |
|
c21a2465cac1
prefer ephemeral interpretation over interpretation in proof contexts;
haftmann
parents:
54555
diff
changeset
|
110 |
lemma abs_o_rep: |
c21a2465cac1
prefer ephemeral interpretation over interpretation in proof contexts;
haftmann
parents:
54555
diff
changeset
|
111 |
"Abs o Rep = id" |
c21a2465cac1
prefer ephemeral interpretation over interpretation in proof contexts;
haftmann
parents:
54555
diff
changeset
|
112 |
unfolding fun_eq_iff |
c21a2465cac1
prefer ephemeral interpretation over interpretation in proof contexts;
haftmann
parents:
54555
diff
changeset
|
113 |
by (simp add: Quotient3_abs_rep) |
c21a2465cac1
prefer ephemeral interpretation over interpretation in proof contexts;
haftmann
parents:
54555
diff
changeset
|
114 |
|
c21a2465cac1
prefer ephemeral interpretation over interpretation in proof contexts;
haftmann
parents:
54555
diff
changeset
|
115 |
lemma equals_rsp: |
c21a2465cac1
prefer ephemeral interpretation over interpretation in proof contexts;
haftmann
parents:
54555
diff
changeset
|
116 |
assumes b: "R xa xb" "R ya yb" |
c21a2465cac1
prefer ephemeral interpretation over interpretation in proof contexts;
haftmann
parents:
54555
diff
changeset
|
117 |
shows "R xa ya = R xb yb" |
c21a2465cac1
prefer ephemeral interpretation over interpretation in proof contexts;
haftmann
parents:
54555
diff
changeset
|
118 |
using b Quotient3_symp Quotient3_transp |
c21a2465cac1
prefer ephemeral interpretation over interpretation in proof contexts;
haftmann
parents:
54555
diff
changeset
|
119 |
by (blast elim: sympE transpE) |
c21a2465cac1
prefer ephemeral interpretation over interpretation in proof contexts;
haftmann
parents:
54555
diff
changeset
|
120 |
|
c21a2465cac1
prefer ephemeral interpretation over interpretation in proof contexts;
haftmann
parents:
54555
diff
changeset
|
121 |
lemma rep_abs_rsp: |
c21a2465cac1
prefer ephemeral interpretation over interpretation in proof contexts;
haftmann
parents:
54555
diff
changeset
|
122 |
assumes b: "R x1 x2" |
c21a2465cac1
prefer ephemeral interpretation over interpretation in proof contexts;
haftmann
parents:
54555
diff
changeset
|
123 |
shows "R x1 (Rep (Abs x2))" |
c21a2465cac1
prefer ephemeral interpretation over interpretation in proof contexts;
haftmann
parents:
54555
diff
changeset
|
124 |
using b Quotient3_rel Quotient3_abs_rep Quotient3_rep_reflp |
c21a2465cac1
prefer ephemeral interpretation over interpretation in proof contexts;
haftmann
parents:
54555
diff
changeset
|
125 |
by metis |
c21a2465cac1
prefer ephemeral interpretation over interpretation in proof contexts;
haftmann
parents:
54555
diff
changeset
|
126 |
|
c21a2465cac1
prefer ephemeral interpretation over interpretation in proof contexts;
haftmann
parents:
54555
diff
changeset
|
127 |
lemma rep_abs_rsp_left: |
c21a2465cac1
prefer ephemeral interpretation over interpretation in proof contexts;
haftmann
parents:
54555
diff
changeset
|
128 |
assumes b: "R x1 x2" |
c21a2465cac1
prefer ephemeral interpretation over interpretation in proof contexts;
haftmann
parents:
54555
diff
changeset
|
129 |
shows "R (Rep (Abs x1)) x2" |
c21a2465cac1
prefer ephemeral interpretation over interpretation in proof contexts;
haftmann
parents:
54555
diff
changeset
|
130 |
using b Quotient3_rel Quotient3_abs_rep Quotient3_rep_reflp |
c21a2465cac1
prefer ephemeral interpretation over interpretation in proof contexts;
haftmann
parents:
54555
diff
changeset
|
131 |
by metis |
c21a2465cac1
prefer ephemeral interpretation over interpretation in proof contexts;
haftmann
parents:
54555
diff
changeset
|
132 |
|
c21a2465cac1
prefer ephemeral interpretation over interpretation in proof contexts;
haftmann
parents:
54555
diff
changeset
|
133 |
end |
47308 | 134 |
|
135 |
lemma identity_quotient3: |
|
54867
c21a2465cac1
prefer ephemeral interpretation over interpretation in proof contexts;
haftmann
parents:
54555
diff
changeset
|
136 |
"Quotient3 (op =) id id" |
47308 | 137 |
unfolding Quotient3_def id_def |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
138 |
by blast |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
139 |
|
47308 | 140 |
lemma fun_quotient3: |
141 |
assumes q1: "Quotient3 R1 abs1 rep1" |
|
142 |
and q2: "Quotient3 R2 abs2 rep2" |
|
143 |
shows "Quotient3 (R1 ===> R2) (rep1 ---> abs2) (abs1 ---> rep2)" |
|
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
144 |
proof - |
47308 | 145 |
have "\<And>a.(rep1 ---> abs2) ((abs1 ---> rep2) a) = a" |
146 |
using q1 q2 by (simp add: Quotient3_def fun_eq_iff) |
|
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
147 |
moreover |
47308 | 148 |
have "\<And>a.(R1 ===> R2) ((abs1 ---> rep2) a) ((abs1 ---> rep2) a)" |
55945 | 149 |
by (rule rel_funI) |
47308 | 150 |
(insert q1 q2 Quotient3_rel_abs [of R1 abs1 rep1] Quotient3_rel_rep [of R2 abs2 rep2], |
151 |
simp (no_asm) add: Quotient3_def, simp) |
|
152 |
||
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
153 |
moreover |
47308 | 154 |
{ |
155 |
fix r s |
|
156 |
have "(R1 ===> R2) r s = ((R1 ===> R2) r r \<and> (R1 ===> R2) s s \<and> |
|
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
157 |
(rep1 ---> abs2) r = (rep1 ---> abs2) s)" |
47308 | 158 |
proof - |
159 |
||
55945 | 160 |
have "(R1 ===> R2) r s \<Longrightarrow> (R1 ===> R2) r r" unfolding rel_fun_def |
47308 | 161 |
using Quotient3_part_equivp[OF q1] Quotient3_part_equivp[OF q2] |
162 |
by (metis (full_types) part_equivp_def) |
|
55945 | 163 |
moreover have "(R1 ===> R2) r s \<Longrightarrow> (R1 ===> R2) s s" unfolding rel_fun_def |
47308 | 164 |
using Quotient3_part_equivp[OF q1] Quotient3_part_equivp[OF q2] |
165 |
by (metis (full_types) part_equivp_def) |
|
166 |
moreover have "(R1 ===> R2) r s \<Longrightarrow> (rep1 ---> abs2) r = (rep1 ---> abs2) s" |
|
55945 | 167 |
apply(auto simp add: rel_fun_def fun_eq_iff) using q1 q2 unfolding Quotient3_def by metis |
47308 | 168 |
moreover have "((R1 ===> R2) r r \<and> (R1 ===> R2) s s \<and> |
169 |
(rep1 ---> abs2) r = (rep1 ---> abs2) s) \<Longrightarrow> (R1 ===> R2) r s" |
|
55945 | 170 |
apply(auto simp add: rel_fun_def fun_eq_iff) using q1 q2 unfolding Quotient3_def |
47308 | 171 |
by (metis map_fun_apply) |
172 |
||
173 |
ultimately show ?thesis by blast |
|
174 |
qed |
|
175 |
} |
|
176 |
ultimately show ?thesis by (intro Quotient3I) (assumption+) |
|
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
177 |
qed |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
178 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
179 |
lemma lambda_prs: |
47308 | 180 |
assumes q1: "Quotient3 R1 Abs1 Rep1" |
181 |
and q2: "Quotient3 R2 Abs2 Rep2" |
|
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
182 |
shows "(Rep1 ---> Abs2) (\<lambda>x. Rep2 (f (Abs1 x))) = (\<lambda>x. f x)" |
39302
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
nipkow
parents:
39198
diff
changeset
|
183 |
unfolding fun_eq_iff |
47308 | 184 |
using Quotient3_abs_rep[OF q1] Quotient3_abs_rep[OF q2] |
40814
fa64f6278568
moved generic definitions about (partial) equivalence relations from Quotient to Equiv_Relations;
haftmann
parents:
40615
diff
changeset
|
185 |
by simp |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
186 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
187 |
lemma lambda_prs1: |
47308 | 188 |
assumes q1: "Quotient3 R1 Abs1 Rep1" |
189 |
and q2: "Quotient3 R2 Abs2 Rep2" |
|
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
190 |
shows "(Rep1 ---> Abs2) (\<lambda>x. (Abs1 ---> Rep2) f x) = (\<lambda>x. f x)" |
39302
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
nipkow
parents:
39198
diff
changeset
|
191 |
unfolding fun_eq_iff |
47308 | 192 |
using Quotient3_abs_rep[OF q1] Quotient3_abs_rep[OF q2] |
40814
fa64f6278568
moved generic definitions about (partial) equivalence relations from Quotient to Equiv_Relations;
haftmann
parents:
40615
diff
changeset
|
193 |
by simp |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
194 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
195 |
text{* |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
196 |
In the following theorem R1 can be instantiated with anything, |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
197 |
but we know some of the types of the Rep and Abs functions; |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
198 |
so by solving Quotient assumptions we can get a unique R1 that |
35236
fd8231b16203
quote the constant and theorem name with @{text}
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
35222
diff
changeset
|
199 |
will be provable; which is why we need to use @{text apply_rsp} and |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
200 |
not the primed version *} |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
201 |
|
47308 | 202 |
lemma apply_rspQ3: |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
203 |
fixes f g::"'a \<Rightarrow> 'c" |
47308 | 204 |
assumes q: "Quotient3 R1 Abs1 Rep1" |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
205 |
and a: "(R1 ===> R2) f g" "R1 x y" |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
206 |
shows "R2 (f x) (g y)" |
55945 | 207 |
using a by (auto elim: rel_funE) |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
208 |
|
47308 | 209 |
lemma apply_rspQ3'': |
210 |
assumes "Quotient3 R Abs Rep" |
|
47096
3ea48c19673e
generation of a code certificate from a respectfulness theorem for constants lifted by the quotient_definition command & setup_lifting command: setups Quotient infrastructure from a typedef theorem
kuncar
parents:
47094
diff
changeset
|
211 |
and "(R ===> S) f f" |
3ea48c19673e
generation of a code certificate from a respectfulness theorem for constants lifted by the quotient_definition command & setup_lifting command: setups Quotient infrastructure from a typedef theorem
kuncar
parents:
47094
diff
changeset
|
212 |
shows "S (f (Rep x)) (f (Rep x))" |
3ea48c19673e
generation of a code certificate from a respectfulness theorem for constants lifted by the quotient_definition command & setup_lifting command: setups Quotient infrastructure from a typedef theorem
kuncar
parents:
47094
diff
changeset
|
213 |
proof - |
47308 | 214 |
from assms(1) have "R (Rep x) (Rep x)" by (rule Quotient3_rep_reflp) |
47096
3ea48c19673e
generation of a code certificate from a respectfulness theorem for constants lifted by the quotient_definition command & setup_lifting command: setups Quotient infrastructure from a typedef theorem
kuncar
parents:
47094
diff
changeset
|
215 |
then show ?thesis using assms(2) by (auto intro: apply_rsp') |
3ea48c19673e
generation of a code certificate from a respectfulness theorem for constants lifted by the quotient_definition command & setup_lifting command: setups Quotient infrastructure from a typedef theorem
kuncar
parents:
47094
diff
changeset
|
216 |
qed |
3ea48c19673e
generation of a code certificate from a respectfulness theorem for constants lifted by the quotient_definition command & setup_lifting command: setups Quotient infrastructure from a typedef theorem
kuncar
parents:
47094
diff
changeset
|
217 |
|
35294 | 218 |
subsection {* lemmas for regularisation of ball and bex *} |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
219 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
220 |
lemma ball_reg_eqv: |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
221 |
fixes P :: "'a \<Rightarrow> bool" |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
222 |
assumes a: "equivp R" |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
223 |
shows "Ball (Respects R) P = (All P)" |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
224 |
using a |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
225 |
unfolding equivp_def |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
226 |
by (auto simp add: in_respects) |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
227 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
228 |
lemma bex_reg_eqv: |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
229 |
fixes P :: "'a \<Rightarrow> bool" |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
230 |
assumes a: "equivp R" |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
231 |
shows "Bex (Respects R) P = (Ex P)" |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
232 |
using a |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
233 |
unfolding equivp_def |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
234 |
by (auto simp add: in_respects) |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
235 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
236 |
lemma ball_reg_right: |
44553
4d39b032a021
avoid intermixing set and predicates; dropped lemmas mem_rsp and mem_prs (now in Quotient_Set.thy)
haftmann
parents:
44413
diff
changeset
|
237 |
assumes a: "\<And>x. x \<in> R \<Longrightarrow> P x \<longrightarrow> Q x" |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
238 |
shows "All P \<longrightarrow> Ball R Q" |
44921 | 239 |
using a by fast |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
240 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
241 |
lemma bex_reg_left: |
44553
4d39b032a021
avoid intermixing set and predicates; dropped lemmas mem_rsp and mem_prs (now in Quotient_Set.thy)
haftmann
parents:
44413
diff
changeset
|
242 |
assumes a: "\<And>x. x \<in> R \<Longrightarrow> Q x \<longrightarrow> P x" |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
243 |
shows "Bex R Q \<longrightarrow> Ex P" |
44921 | 244 |
using a by fast |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
245 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
246 |
lemma ball_reg_left: |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
247 |
assumes a: "equivp R" |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
248 |
shows "(\<And>x. (Q x \<longrightarrow> P x)) \<Longrightarrow> Ball (Respects R) Q \<longrightarrow> All P" |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
249 |
using a by (metis equivp_reflp in_respects) |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
250 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
251 |
lemma bex_reg_right: |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
252 |
assumes a: "equivp R" |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
253 |
shows "(\<And>x. (Q x \<longrightarrow> P x)) \<Longrightarrow> Ex Q \<longrightarrow> Bex (Respects R) P" |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
254 |
using a by (metis equivp_reflp in_respects) |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
255 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
256 |
lemma ball_reg_eqv_range: |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
257 |
fixes P::"'a \<Rightarrow> bool" |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
258 |
and x::"'a" |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
259 |
assumes a: "equivp R2" |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
260 |
shows "(Ball (Respects (R1 ===> R2)) (\<lambda>f. P (f x)) = All (\<lambda>f. P (f x)))" |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
261 |
apply(rule iffI) |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
262 |
apply(rule allI) |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
263 |
apply(drule_tac x="\<lambda>y. f x" in bspec) |
55945 | 264 |
apply(simp add: in_respects rel_fun_def) |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
265 |
apply(rule impI) |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
266 |
using a equivp_reflp_symp_transp[of "R2"] |
40814
fa64f6278568
moved generic definitions about (partial) equivalence relations from Quotient to Equiv_Relations;
haftmann
parents:
40615
diff
changeset
|
267 |
apply (auto elim: equivpE reflpE) |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
268 |
done |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
269 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
270 |
lemma bex_reg_eqv_range: |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
271 |
assumes a: "equivp R2" |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
272 |
shows "(Bex (Respects (R1 ===> R2)) (\<lambda>f. P (f x)) = Ex (\<lambda>f. P (f x)))" |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
273 |
apply(auto) |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
274 |
apply(rule_tac x="\<lambda>y. f x" in bexI) |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
275 |
apply(simp) |
55945 | 276 |
apply(simp add: Respects_def in_respects rel_fun_def) |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
277 |
apply(rule impI) |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
278 |
using a equivp_reflp_symp_transp[of "R2"] |
40814
fa64f6278568
moved generic definitions about (partial) equivalence relations from Quotient to Equiv_Relations;
haftmann
parents:
40615
diff
changeset
|
279 |
apply (auto elim: equivpE reflpE) |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
280 |
done |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
281 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
282 |
(* Next four lemmas are unused *) |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
283 |
lemma all_reg: |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
284 |
assumes a: "!x :: 'a. (P x --> Q x)" |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
285 |
and b: "All P" |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
286 |
shows "All Q" |
44921 | 287 |
using a b by fast |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
288 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
289 |
lemma ex_reg: |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
290 |
assumes a: "!x :: 'a. (P x --> Q x)" |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
291 |
and b: "Ex P" |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
292 |
shows "Ex Q" |
44921 | 293 |
using a b by fast |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
294 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
295 |
lemma ball_reg: |
44553
4d39b032a021
avoid intermixing set and predicates; dropped lemmas mem_rsp and mem_prs (now in Quotient_Set.thy)
haftmann
parents:
44413
diff
changeset
|
296 |
assumes a: "!x :: 'a. (x \<in> R --> P x --> Q x)" |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
297 |
and b: "Ball R P" |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
298 |
shows "Ball R Q" |
44921 | 299 |
using a b by fast |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
300 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
301 |
lemma bex_reg: |
44553
4d39b032a021
avoid intermixing set and predicates; dropped lemmas mem_rsp and mem_prs (now in Quotient_Set.thy)
haftmann
parents:
44413
diff
changeset
|
302 |
assumes a: "!x :: 'a. (x \<in> R --> P x --> Q x)" |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
303 |
and b: "Bex R P" |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
304 |
shows "Bex R Q" |
44921 | 305 |
using a b by fast |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
306 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
307 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
308 |
lemma ball_all_comm: |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
309 |
assumes "\<And>y. (\<forall>x\<in>P. A x y) \<longrightarrow> (\<forall>x. B x y)" |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
310 |
shows "(\<forall>x\<in>P. \<forall>y. A x y) \<longrightarrow> (\<forall>x. \<forall>y. B x y)" |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
311 |
using assms by auto |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
312 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
313 |
lemma bex_ex_comm: |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
314 |
assumes "(\<exists>y. \<exists>x. A x y) \<longrightarrow> (\<exists>y. \<exists>x\<in>P. B x y)" |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
315 |
shows "(\<exists>x. \<exists>y. A x y) \<longrightarrow> (\<exists>x\<in>P. \<exists>y. B x y)" |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
316 |
using assms by auto |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
317 |
|
35294 | 318 |
subsection {* Bounded abstraction *} |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
319 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
320 |
definition |
40466
c6587375088e
type annotations in specifications; fun_rel_def is no simp rule by default; slightly changed fun_map_def; more on predicates on relation functions; proper HOL equations in definitions
haftmann
parents:
40031
diff
changeset
|
321 |
Babs :: "'a set \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> 'a \<Rightarrow> 'b" |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
322 |
where |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
323 |
"x \<in> p \<Longrightarrow> Babs p m x = m x" |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
324 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
325 |
lemma babs_rsp: |
47308 | 326 |
assumes q: "Quotient3 R1 Abs1 Rep1" |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
327 |
and a: "(R1 ===> R2) f g" |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
328 |
shows "(R1 ===> R2) (Babs (Respects R1) f) (Babs (Respects R1) g)" |
55945 | 329 |
apply (auto simp add: Babs_def in_respects rel_fun_def) |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
330 |
apply (subgoal_tac "x \<in> Respects R1 \<and> y \<in> Respects R1") |
55945 | 331 |
using a apply (simp add: Babs_def rel_fun_def) |
332 |
apply (simp add: in_respects rel_fun_def) |
|
47308 | 333 |
using Quotient3_rel[OF q] |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
334 |
by metis |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
335 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
336 |
lemma babs_prs: |
47308 | 337 |
assumes q1: "Quotient3 R1 Abs1 Rep1" |
338 |
and q2: "Quotient3 R2 Abs2 Rep2" |
|
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
339 |
shows "((Rep1 ---> Abs2) (Babs (Respects R1) ((Abs1 ---> Rep2) f))) = f" |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
340 |
apply (rule ext) |
40466
c6587375088e
type annotations in specifications; fun_rel_def is no simp rule by default; slightly changed fun_map_def; more on predicates on relation functions; proper HOL equations in definitions
haftmann
parents:
40031
diff
changeset
|
341 |
apply (simp add:) |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
342 |
apply (subgoal_tac "Rep1 x \<in> Respects R1") |
47308 | 343 |
apply (simp add: Babs_def Quotient3_abs_rep[OF q1] Quotient3_abs_rep[OF q2]) |
344 |
apply (simp add: in_respects Quotient3_rel_rep[OF q1]) |
|
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
345 |
done |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
346 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
347 |
lemma babs_simp: |
47308 | 348 |
assumes q: "Quotient3 R1 Abs Rep" |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
349 |
shows "((R1 ===> R2) (Babs (Respects R1) f) (Babs (Respects R1) g)) = ((R1 ===> R2) f g)" |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
350 |
apply(rule iffI) |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
351 |
apply(simp_all only: babs_rsp[OF q]) |
55945 | 352 |
apply(auto simp add: Babs_def rel_fun_def) |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
353 |
apply (subgoal_tac "x \<in> Respects R1 \<and> y \<in> Respects R1") |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
354 |
apply(metis Babs_def) |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
355 |
apply (simp add: in_respects) |
47308 | 356 |
using Quotient3_rel[OF q] |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
357 |
by metis |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
358 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
359 |
(* If a user proves that a particular functional relation |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
360 |
is an equivalence this may be useful in regularising *) |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
361 |
lemma babs_reg_eqv: |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
362 |
shows "equivp R \<Longrightarrow> Babs (Respects R) P = P" |
39302
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
nipkow
parents:
39198
diff
changeset
|
363 |
by (simp add: fun_eq_iff Babs_def in_respects equivp_reflp) |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
364 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
365 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
366 |
(* 3 lemmas needed for proving repabs_inj *) |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
367 |
lemma ball_rsp: |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
368 |
assumes a: "(R ===> (op =)) f g" |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
369 |
shows "Ball (Respects R) f = Ball (Respects R) g" |
55945 | 370 |
using a by (auto simp add: Ball_def in_respects elim: rel_funE) |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
371 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
372 |
lemma bex_rsp: |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
373 |
assumes a: "(R ===> (op =)) f g" |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
374 |
shows "(Bex (Respects R) f = Bex (Respects R) g)" |
55945 | 375 |
using a by (auto simp add: Bex_def in_respects elim: rel_funE) |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
376 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
377 |
lemma bex1_rsp: |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
378 |
assumes a: "(R ===> (op =)) f g" |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
379 |
shows "Ex1 (\<lambda>x. x \<in> Respects R \<and> f x) = Ex1 (\<lambda>x. x \<in> Respects R \<and> g x)" |
55945 | 380 |
using a by (auto elim: rel_funE simp add: Ex1_def in_respects) |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
381 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
382 |
(* 2 lemmas needed for cleaning of quantifiers *) |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
383 |
lemma all_prs: |
47308 | 384 |
assumes a: "Quotient3 R absf repf" |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
385 |
shows "Ball (Respects R) ((absf ---> id) f) = All f" |
47308 | 386 |
using a unfolding Quotient3_def Ball_def in_respects id_apply comp_def map_fun_def |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
387 |
by metis |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
388 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
389 |
lemma ex_prs: |
47308 | 390 |
assumes a: "Quotient3 R absf repf" |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
391 |
shows "Bex (Respects R) ((absf ---> id) f) = Ex f" |
47308 | 392 |
using a unfolding Quotient3_def Bex_def in_respects id_apply comp_def map_fun_def |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
393 |
by metis |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
394 |
|
35294 | 395 |
subsection {* @{text Bex1_rel} quantifier *} |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
396 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
397 |
definition |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
398 |
Bex1_rel :: "('a \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> ('a \<Rightarrow> bool) \<Rightarrow> bool" |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
399 |
where |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
400 |
"Bex1_rel R P \<longleftrightarrow> (\<exists>x \<in> Respects R. P x) \<and> (\<forall>x \<in> Respects R. \<forall>y \<in> Respects R. ((P x \<and> P y) \<longrightarrow> (R x y)))" |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
401 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
402 |
lemma bex1_rel_aux: |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
403 |
"\<lbrakk>\<forall>xa ya. R xa ya \<longrightarrow> x xa = y ya; Bex1_rel R x\<rbrakk> \<Longrightarrow> Bex1_rel R y" |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
404 |
unfolding Bex1_rel_def |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
405 |
apply (erule conjE)+ |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
406 |
apply (erule bexE) |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
407 |
apply rule |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
408 |
apply (rule_tac x="xa" in bexI) |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
409 |
apply metis |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
410 |
apply metis |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
411 |
apply rule+ |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
412 |
apply (erule_tac x="xaa" in ballE) |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
413 |
prefer 2 |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
414 |
apply (metis) |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
415 |
apply (erule_tac x="ya" in ballE) |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
416 |
prefer 2 |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
417 |
apply (metis) |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
418 |
apply (metis in_respects) |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
419 |
done |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
420 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
421 |
lemma bex1_rel_aux2: |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
422 |
"\<lbrakk>\<forall>xa ya. R xa ya \<longrightarrow> x xa = y ya; Bex1_rel R y\<rbrakk> \<Longrightarrow> Bex1_rel R x" |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
423 |
unfolding Bex1_rel_def |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
424 |
apply (erule conjE)+ |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
425 |
apply (erule bexE) |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
426 |
apply rule |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
427 |
apply (rule_tac x="xa" in bexI) |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
428 |
apply metis |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
429 |
apply metis |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
430 |
apply rule+ |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
431 |
apply (erule_tac x="xaa" in ballE) |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
432 |
prefer 2 |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
433 |
apply (metis) |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
434 |
apply (erule_tac x="ya" in ballE) |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
435 |
prefer 2 |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
436 |
apply (metis) |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
437 |
apply (metis in_respects) |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
438 |
done |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
439 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
440 |
lemma bex1_rel_rsp: |
47308 | 441 |
assumes a: "Quotient3 R absf repf" |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
442 |
shows "((R ===> op =) ===> op =) (Bex1_rel R) (Bex1_rel R)" |
55945 | 443 |
apply (simp add: rel_fun_def) |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
444 |
apply clarify |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
445 |
apply rule |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
446 |
apply (simp_all add: bex1_rel_aux bex1_rel_aux2) |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
447 |
apply (erule bex1_rel_aux2) |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
448 |
apply assumption |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
449 |
done |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
450 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
451 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
452 |
lemma ex1_prs: |
47308 | 453 |
assumes a: "Quotient3 R absf repf" |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
454 |
shows "((absf ---> id) ---> id) (Bex1_rel R) f = Ex1 f" |
40466
c6587375088e
type annotations in specifications; fun_rel_def is no simp rule by default; slightly changed fun_map_def; more on predicates on relation functions; proper HOL equations in definitions
haftmann
parents:
40031
diff
changeset
|
455 |
apply (simp add:) |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
456 |
apply (subst Bex1_rel_def) |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
457 |
apply (subst Bex_def) |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
458 |
apply (subst Ex1_def) |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
459 |
apply simp |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
460 |
apply rule |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
461 |
apply (erule conjE)+ |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
462 |
apply (erule_tac exE) |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
463 |
apply (erule conjE) |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
464 |
apply (subgoal_tac "\<forall>y. R y y \<longrightarrow> f (absf y) \<longrightarrow> R x y") |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
465 |
apply (rule_tac x="absf x" in exI) |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
466 |
apply (simp) |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
467 |
apply rule+ |
47308 | 468 |
using a unfolding Quotient3_def |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
469 |
apply metis |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
470 |
apply rule+ |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
471 |
apply (erule_tac x="x" in ballE) |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
472 |
apply (erule_tac x="y" in ballE) |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
473 |
apply simp |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
474 |
apply (simp add: in_respects) |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
475 |
apply (simp add: in_respects) |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
476 |
apply (erule_tac exE) |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
477 |
apply rule |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
478 |
apply (rule_tac x="repf x" in exI) |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
479 |
apply (simp only: in_respects) |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
480 |
apply rule |
47308 | 481 |
apply (metis Quotient3_rel_rep[OF a]) |
482 |
using a unfolding Quotient3_def apply (simp) |
|
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
483 |
apply rule+ |
47308 | 484 |
using a unfolding Quotient3_def in_respects |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
485 |
apply metis |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
486 |
done |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
487 |
|
38702
72fd257f4343
Quotient Package / lemma for regularization of bex1_rel for equivalence relations
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
38317
diff
changeset
|
488 |
lemma bex1_bexeq_reg: |
72fd257f4343
Quotient Package / lemma for regularization of bex1_rel for equivalence relations
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
38317
diff
changeset
|
489 |
shows "(\<exists>!x\<in>Respects R. P x) \<longrightarrow> (Bex1_rel R (\<lambda>x. P x))" |
56073
29e308b56d23
enhanced simplifier solver for preconditions of rewrite rule, can now deal with conjunctions
nipkow
parents:
55945
diff
changeset
|
490 |
by (auto simp add: Ex1_def Bex1_rel_def Bex_def Ball_def in_respects) |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
491 |
|
38702
72fd257f4343
Quotient Package / lemma for regularization of bex1_rel for equivalence relations
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
38317
diff
changeset
|
492 |
lemma bex1_bexeq_reg_eqv: |
72fd257f4343
Quotient Package / lemma for regularization of bex1_rel for equivalence relations
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
38317
diff
changeset
|
493 |
assumes a: "equivp R" |
72fd257f4343
Quotient Package / lemma for regularization of bex1_rel for equivalence relations
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
38317
diff
changeset
|
494 |
shows "(\<exists>!x. P x) \<longrightarrow> Bex1_rel R P" |
72fd257f4343
Quotient Package / lemma for regularization of bex1_rel for equivalence relations
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
38317
diff
changeset
|
495 |
using equivp_reflp[OF a] |
72fd257f4343
Quotient Package / lemma for regularization of bex1_rel for equivalence relations
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
38317
diff
changeset
|
496 |
apply (intro impI) |
72fd257f4343
Quotient Package / lemma for regularization of bex1_rel for equivalence relations
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
38317
diff
changeset
|
497 |
apply (elim ex1E) |
72fd257f4343
Quotient Package / lemma for regularization of bex1_rel for equivalence relations
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
38317
diff
changeset
|
498 |
apply (rule mp[OF bex1_bexeq_reg]) |
72fd257f4343
Quotient Package / lemma for regularization of bex1_rel for equivalence relations
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
38317
diff
changeset
|
499 |
apply (rule_tac a="x" in ex1I) |
72fd257f4343
Quotient Package / lemma for regularization of bex1_rel for equivalence relations
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
38317
diff
changeset
|
500 |
apply (subst in_respects) |
72fd257f4343
Quotient Package / lemma for regularization of bex1_rel for equivalence relations
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
38317
diff
changeset
|
501 |
apply (rule conjI) |
72fd257f4343
Quotient Package / lemma for regularization of bex1_rel for equivalence relations
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
38317
diff
changeset
|
502 |
apply assumption |
72fd257f4343
Quotient Package / lemma for regularization of bex1_rel for equivalence relations
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
38317
diff
changeset
|
503 |
apply assumption |
72fd257f4343
Quotient Package / lemma for regularization of bex1_rel for equivalence relations
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
38317
diff
changeset
|
504 |
apply clarify |
72fd257f4343
Quotient Package / lemma for regularization of bex1_rel for equivalence relations
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
38317
diff
changeset
|
505 |
apply (erule_tac x="xa" in allE) |
72fd257f4343
Quotient Package / lemma for regularization of bex1_rel for equivalence relations
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
38317
diff
changeset
|
506 |
apply simp |
72fd257f4343
Quotient Package / lemma for regularization of bex1_rel for equivalence relations
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
38317
diff
changeset
|
507 |
done |
72fd257f4343
Quotient Package / lemma for regularization of bex1_rel for equivalence relations
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
38317
diff
changeset
|
508 |
|
35294 | 509 |
subsection {* Various respects and preserve lemmas *} |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
510 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
511 |
lemma quot_rel_rsp: |
47308 | 512 |
assumes a: "Quotient3 R Abs Rep" |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
513 |
shows "(R ===> R ===> op =) R R" |
55945 | 514 |
apply(rule rel_funI)+ |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
515 |
apply(rule equals_rsp[OF a]) |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
516 |
apply(assumption)+ |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
517 |
done |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
518 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
519 |
lemma o_prs: |
47308 | 520 |
assumes q1: "Quotient3 R1 Abs1 Rep1" |
521 |
and q2: "Quotient3 R2 Abs2 Rep2" |
|
522 |
and q3: "Quotient3 R3 Abs3 Rep3" |
|
36215
88ff48884d26
respectfullness and preservation of function composition
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
36123
diff
changeset
|
523 |
shows "((Abs2 ---> Rep3) ---> (Abs1 ---> Rep2) ---> (Rep1 ---> Abs3)) op \<circ> = op \<circ>" |
88ff48884d26
respectfullness and preservation of function composition
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
36123
diff
changeset
|
524 |
and "(id ---> (Abs1 ---> id) ---> Rep1 ---> id) op \<circ> = op \<circ>" |
47308 | 525 |
using Quotient3_abs_rep[OF q1] Quotient3_abs_rep[OF q2] Quotient3_abs_rep[OF q3] |
40466
c6587375088e
type annotations in specifications; fun_rel_def is no simp rule by default; slightly changed fun_map_def; more on predicates on relation functions; proper HOL equations in definitions
haftmann
parents:
40031
diff
changeset
|
526 |
by (simp_all add: fun_eq_iff) |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
527 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
528 |
lemma o_rsp: |
36215
88ff48884d26
respectfullness and preservation of function composition
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
36123
diff
changeset
|
529 |
"((R2 ===> R3) ===> (R1 ===> R2) ===> (R1 ===> R3)) op \<circ> op \<circ>" |
88ff48884d26
respectfullness and preservation of function composition
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
36123
diff
changeset
|
530 |
"(op = ===> (R1 ===> op =) ===> R1 ===> op =) op \<circ> op \<circ>" |
55945 | 531 |
by (force elim: rel_funE)+ |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
532 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
533 |
lemma cond_prs: |
47308 | 534 |
assumes a: "Quotient3 R absf repf" |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
535 |
shows "absf (if a then repf b else repf c) = (if a then b else c)" |
47308 | 536 |
using a unfolding Quotient3_def by auto |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
537 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
538 |
lemma if_prs: |
47308 | 539 |
assumes q: "Quotient3 R Abs Rep" |
36123
7f877bbad5b2
add If respectfullness and preservation to Quotient package database
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
36116
diff
changeset
|
540 |
shows "(id ---> Rep ---> Rep ---> Abs) If = If" |
47308 | 541 |
using Quotient3_abs_rep[OF q] |
39302
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
nipkow
parents:
39198
diff
changeset
|
542 |
by (auto simp add: fun_eq_iff) |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
543 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
544 |
lemma if_rsp: |
47308 | 545 |
assumes q: "Quotient3 R Abs Rep" |
36123
7f877bbad5b2
add If respectfullness and preservation to Quotient package database
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
36116
diff
changeset
|
546 |
shows "(op = ===> R ===> R ===> R) If If" |
44921 | 547 |
by force |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
548 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
549 |
lemma let_prs: |
47308 | 550 |
assumes q1: "Quotient3 R1 Abs1 Rep1" |
551 |
and q2: "Quotient3 R2 Abs2 Rep2" |
|
37049
ca1c293e521e
Let rsp and prs in fun_rel/fun_map format
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
36276
diff
changeset
|
552 |
shows "(Rep2 ---> (Abs2 ---> Rep1) ---> Abs1) Let = Let" |
47308 | 553 |
using Quotient3_abs_rep[OF q1] Quotient3_abs_rep[OF q2] |
39302
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
nipkow
parents:
39198
diff
changeset
|
554 |
by (auto simp add: fun_eq_iff) |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
555 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
556 |
lemma let_rsp: |
37049
ca1c293e521e
Let rsp and prs in fun_rel/fun_map format
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
36276
diff
changeset
|
557 |
shows "(R1 ===> (R1 ===> R2) ===> R2) Let Let" |
55945 | 558 |
by (force elim: rel_funE) |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
559 |
|
39669
9e3b035841e4
quotient package: respectfulness and preservation of identity.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
39302
diff
changeset
|
560 |
lemma id_rsp: |
9e3b035841e4
quotient package: respectfulness and preservation of identity.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
39302
diff
changeset
|
561 |
shows "(R ===> R) id id" |
44921 | 562 |
by auto |
39669
9e3b035841e4
quotient package: respectfulness and preservation of identity.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
39302
diff
changeset
|
563 |
|
9e3b035841e4
quotient package: respectfulness and preservation of identity.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
39302
diff
changeset
|
564 |
lemma id_prs: |
47308 | 565 |
assumes a: "Quotient3 R Abs Rep" |
39669
9e3b035841e4
quotient package: respectfulness and preservation of identity.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
39302
diff
changeset
|
566 |
shows "(Rep ---> Abs) id = id" |
47308 | 567 |
by (simp add: fun_eq_iff Quotient3_abs_rep [OF a]) |
39669
9e3b035841e4
quotient package: respectfulness and preservation of identity.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
39302
diff
changeset
|
568 |
|
53011
aeee0a4be6cf
introduce locale with syntax for fun_rel and map_fun and make thus ===> and ---> local
kuncar
parents:
51112
diff
changeset
|
569 |
end |
39669
9e3b035841e4
quotient package: respectfulness and preservation of identity.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
39302
diff
changeset
|
570 |
|
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
571 |
locale quot_type = |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
572 |
fixes R :: "'a \<Rightarrow> 'a \<Rightarrow> bool" |
44204
3cdc4176638c
Quotient Package: make quotient_type work with separate set type
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
42814
diff
changeset
|
573 |
and Abs :: "'a set \<Rightarrow> 'b" |
3cdc4176638c
Quotient Package: make quotient_type work with separate set type
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
42814
diff
changeset
|
574 |
and Rep :: "'b \<Rightarrow> 'a set" |
37493
2377d246a631
Quotient package now uses Partial Equivalence instead place of equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
37049
diff
changeset
|
575 |
assumes equivp: "part_equivp R" |
44204
3cdc4176638c
Quotient Package: make quotient_type work with separate set type
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
42814
diff
changeset
|
576 |
and rep_prop: "\<And>y. \<exists>x. R x x \<and> Rep y = Collect (R x)" |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
577 |
and rep_inverse: "\<And>x. Abs (Rep x) = x" |
44204
3cdc4176638c
Quotient Package: make quotient_type work with separate set type
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
42814
diff
changeset
|
578 |
and abs_inverse: "\<And>c. (\<exists>x. ((R x x) \<and> (c = Collect (R x)))) \<Longrightarrow> (Rep (Abs c)) = c" |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
579 |
and rep_inject: "\<And>x y. (Rep x = Rep y) = (x = y)" |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
580 |
begin |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
581 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
582 |
definition |
40466
c6587375088e
type annotations in specifications; fun_rel_def is no simp rule by default; slightly changed fun_map_def; more on predicates on relation functions; proper HOL equations in definitions
haftmann
parents:
40031
diff
changeset
|
583 |
abs :: "'a \<Rightarrow> 'b" |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
584 |
where |
44204
3cdc4176638c
Quotient Package: make quotient_type work with separate set type
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
42814
diff
changeset
|
585 |
"abs x = Abs (Collect (R x))" |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
586 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
587 |
definition |
40466
c6587375088e
type annotations in specifications; fun_rel_def is no simp rule by default; slightly changed fun_map_def; more on predicates on relation functions; proper HOL equations in definitions
haftmann
parents:
40031
diff
changeset
|
588 |
rep :: "'b \<Rightarrow> 'a" |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
589 |
where |
44204
3cdc4176638c
Quotient Package: make quotient_type work with separate set type
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
42814
diff
changeset
|
590 |
"rep a = (SOME x. x \<in> Rep a)" |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
591 |
|
44204
3cdc4176638c
Quotient Package: make quotient_type work with separate set type
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
42814
diff
changeset
|
592 |
lemma some_collect: |
37493
2377d246a631
Quotient package now uses Partial Equivalence instead place of equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
37049
diff
changeset
|
593 |
assumes "R r r" |
44204
3cdc4176638c
Quotient Package: make quotient_type work with separate set type
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
42814
diff
changeset
|
594 |
shows "R (SOME x. x \<in> Collect (R r)) = R r" |
3cdc4176638c
Quotient Package: make quotient_type work with separate set type
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
42814
diff
changeset
|
595 |
apply simp |
3cdc4176638c
Quotient Package: make quotient_type work with separate set type
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
42814
diff
changeset
|
596 |
by (metis assms exE_some equivp[simplified part_equivp_def]) |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
597 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
598 |
lemma Quotient: |
47308 | 599 |
shows "Quotient3 R abs rep" |
600 |
unfolding Quotient3_def abs_def rep_def |
|
37493
2377d246a631
Quotient package now uses Partial Equivalence instead place of equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
37049
diff
changeset
|
601 |
proof (intro conjI allI) |
2377d246a631
Quotient package now uses Partial Equivalence instead place of equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
37049
diff
changeset
|
602 |
fix a r s |
44204
3cdc4176638c
Quotient Package: make quotient_type work with separate set type
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
42814
diff
changeset
|
603 |
show x: "R (SOME x. x \<in> Rep a) (SOME x. x \<in> Rep a)" proof - |
3cdc4176638c
Quotient Package: make quotient_type work with separate set type
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
42814
diff
changeset
|
604 |
obtain x where r: "R x x" and rep: "Rep a = Collect (R x)" using rep_prop[of a] by auto |
3cdc4176638c
Quotient Package: make quotient_type work with separate set type
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
42814
diff
changeset
|
605 |
have "R (SOME x. x \<in> Rep a) x" using r rep some_collect by metis |
3cdc4176638c
Quotient Package: make quotient_type work with separate set type
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
42814
diff
changeset
|
606 |
then have "R x (SOME x. x \<in> Rep a)" using part_equivp_symp[OF equivp] by fast |
3cdc4176638c
Quotient Package: make quotient_type work with separate set type
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
42814
diff
changeset
|
607 |
then show "R (SOME x. x \<in> Rep a) (SOME x. x \<in> Rep a)" |
3cdc4176638c
Quotient Package: make quotient_type work with separate set type
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
42814
diff
changeset
|
608 |
using part_equivp_transp[OF equivp] by (metis `R (SOME x. x \<in> Rep a) x`) |
37493
2377d246a631
Quotient package now uses Partial Equivalence instead place of equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
37049
diff
changeset
|
609 |
qed |
44204
3cdc4176638c
Quotient Package: make quotient_type work with separate set type
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
42814
diff
changeset
|
610 |
have "Collect (R (SOME x. x \<in> Rep a)) = (Rep a)" by (metis some_collect rep_prop) |
3cdc4176638c
Quotient Package: make quotient_type work with separate set type
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
42814
diff
changeset
|
611 |
then show "Abs (Collect (R (SOME x. x \<in> Rep a))) = a" using rep_inverse by auto |
3cdc4176638c
Quotient Package: make quotient_type work with separate set type
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
42814
diff
changeset
|
612 |
have "R r r \<Longrightarrow> R s s \<Longrightarrow> Abs (Collect (R r)) = Abs (Collect (R s)) \<longleftrightarrow> R r = R s" |
44242 | 613 |
proof - |
614 |
assume "R r r" and "R s s" |
|
615 |
then have "Abs (Collect (R r)) = Abs (Collect (R s)) \<longleftrightarrow> Collect (R r) = Collect (R s)" |
|
616 |
by (metis abs_inverse) |
|
617 |
also have "Collect (R r) = Collect (R s) \<longleftrightarrow> (\<lambda>A x. x \<in> A) (Collect (R r)) = (\<lambda>A x. x \<in> A) (Collect (R s))" |
|
618 |
by rule simp_all |
|
619 |
finally show "Abs (Collect (R r)) = Abs (Collect (R s)) \<longleftrightarrow> R r = R s" by simp |
|
620 |
qed |
|
44204
3cdc4176638c
Quotient Package: make quotient_type work with separate set type
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
42814
diff
changeset
|
621 |
then show "R r s \<longleftrightarrow> R r r \<and> R s s \<and> (Abs (Collect (R r)) = Abs (Collect (R s)))" |
3cdc4176638c
Quotient Package: make quotient_type work with separate set type
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
42814
diff
changeset
|
622 |
using equivp[simplified part_equivp_def] by metis |
3cdc4176638c
Quotient Package: make quotient_type work with separate set type
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
42814
diff
changeset
|
623 |
qed |
44242 | 624 |
|
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
625 |
end |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
626 |
|
47096
3ea48c19673e
generation of a code certificate from a respectfulness theorem for constants lifted by the quotient_definition command & setup_lifting command: setups Quotient infrastructure from a typedef theorem
kuncar
parents:
47094
diff
changeset
|
627 |
subsection {* Quotient composition *} |
3ea48c19673e
generation of a code certificate from a respectfulness theorem for constants lifted by the quotient_definition command & setup_lifting command: setups Quotient infrastructure from a typedef theorem
kuncar
parents:
47094
diff
changeset
|
628 |
|
47308 | 629 |
lemma OOO_quotient3: |
47096
3ea48c19673e
generation of a code certificate from a respectfulness theorem for constants lifted by the quotient_definition command & setup_lifting command: setups Quotient infrastructure from a typedef theorem
kuncar
parents:
47094
diff
changeset
|
630 |
fixes R1 :: "'a \<Rightarrow> 'a \<Rightarrow> bool" |
3ea48c19673e
generation of a code certificate from a respectfulness theorem for constants lifted by the quotient_definition command & setup_lifting command: setups Quotient infrastructure from a typedef theorem
kuncar
parents:
47094
diff
changeset
|
631 |
fixes Abs1 :: "'a \<Rightarrow> 'b" and Rep1 :: "'b \<Rightarrow> 'a" |
3ea48c19673e
generation of a code certificate from a respectfulness theorem for constants lifted by the quotient_definition command & setup_lifting command: setups Quotient infrastructure from a typedef theorem
kuncar
parents:
47094
diff
changeset
|
632 |
fixes Abs2 :: "'b \<Rightarrow> 'c" and Rep2 :: "'c \<Rightarrow> 'b" |
3ea48c19673e
generation of a code certificate from a respectfulness theorem for constants lifted by the quotient_definition command & setup_lifting command: setups Quotient infrastructure from a typedef theorem
kuncar
parents:
47094
diff
changeset
|
633 |
fixes R2' :: "'a \<Rightarrow> 'a \<Rightarrow> bool" |
3ea48c19673e
generation of a code certificate from a respectfulness theorem for constants lifted by the quotient_definition command & setup_lifting command: setups Quotient infrastructure from a typedef theorem
kuncar
parents:
47094
diff
changeset
|
634 |
fixes R2 :: "'b \<Rightarrow> 'b \<Rightarrow> bool" |
47308 | 635 |
assumes R1: "Quotient3 R1 Abs1 Rep1" |
636 |
assumes R2: "Quotient3 R2 Abs2 Rep2" |
|
47096
3ea48c19673e
generation of a code certificate from a respectfulness theorem for constants lifted by the quotient_definition command & setup_lifting command: setups Quotient infrastructure from a typedef theorem
kuncar
parents:
47094
diff
changeset
|
637 |
assumes Abs1: "\<And>x y. R2' x y \<Longrightarrow> R1 x x \<Longrightarrow> R1 y y \<Longrightarrow> R2 (Abs1 x) (Abs1 y)" |
3ea48c19673e
generation of a code certificate from a respectfulness theorem for constants lifted by the quotient_definition command & setup_lifting command: setups Quotient infrastructure from a typedef theorem
kuncar
parents:
47094
diff
changeset
|
638 |
assumes Rep1: "\<And>x y. R2 x y \<Longrightarrow> R2' (Rep1 x) (Rep1 y)" |
47308 | 639 |
shows "Quotient3 (R1 OO R2' OO R1) (Abs2 \<circ> Abs1) (Rep1 \<circ> Rep2)" |
640 |
apply (rule Quotient3I) |
|
641 |
apply (simp add: o_def Quotient3_abs_rep [OF R2] Quotient3_abs_rep [OF R1]) |
|
47096
3ea48c19673e
generation of a code certificate from a respectfulness theorem for constants lifted by the quotient_definition command & setup_lifting command: setups Quotient infrastructure from a typedef theorem
kuncar
parents:
47094
diff
changeset
|
642 |
apply simp |
47434
b75ce48a93ee
dropped abbreviation "pred_comp"; introduced infix notation "P OO Q" for "relcompp P Q"
griff
parents:
47105
diff
changeset
|
643 |
apply (rule_tac b="Rep1 (Rep2 a)" in relcomppI) |
47308 | 644 |
apply (rule Quotient3_rep_reflp [OF R1]) |
47434
b75ce48a93ee
dropped abbreviation "pred_comp"; introduced infix notation "P OO Q" for "relcompp P Q"
griff
parents:
47105
diff
changeset
|
645 |
apply (rule_tac b="Rep1 (Rep2 a)" in relcomppI [rotated]) |
47308 | 646 |
apply (rule Quotient3_rep_reflp [OF R1]) |
47096
3ea48c19673e
generation of a code certificate from a respectfulness theorem for constants lifted by the quotient_definition command & setup_lifting command: setups Quotient infrastructure from a typedef theorem
kuncar
parents:
47094
diff
changeset
|
647 |
apply (rule Rep1) |
47308 | 648 |
apply (rule Quotient3_rep_reflp [OF R2]) |
47096
3ea48c19673e
generation of a code certificate from a respectfulness theorem for constants lifted by the quotient_definition command & setup_lifting command: setups Quotient infrastructure from a typedef theorem
kuncar
parents:
47094
diff
changeset
|
649 |
apply safe |
3ea48c19673e
generation of a code certificate from a respectfulness theorem for constants lifted by the quotient_definition command & setup_lifting command: setups Quotient infrastructure from a typedef theorem
kuncar
parents:
47094
diff
changeset
|
650 |
apply (rename_tac x y) |
3ea48c19673e
generation of a code certificate from a respectfulness theorem for constants lifted by the quotient_definition command & setup_lifting command: setups Quotient infrastructure from a typedef theorem
kuncar
parents:
47094
diff
changeset
|
651 |
apply (drule Abs1) |
47308 | 652 |
apply (erule Quotient3_refl2 [OF R1]) |
653 |
apply (erule Quotient3_refl1 [OF R1]) |
|
654 |
apply (drule Quotient3_refl1 [OF R2], drule Rep1) |
|
47096
3ea48c19673e
generation of a code certificate from a respectfulness theorem for constants lifted by the quotient_definition command & setup_lifting command: setups Quotient infrastructure from a typedef theorem
kuncar
parents:
47094
diff
changeset
|
655 |
apply (subgoal_tac "R1 r (Rep1 (Abs1 x))") |
47434
b75ce48a93ee
dropped abbreviation "pred_comp"; introduced infix notation "P OO Q" for "relcompp P Q"
griff
parents:
47105
diff
changeset
|
656 |
apply (rule_tac b="Rep1 (Abs1 x)" in relcomppI, assumption) |
b75ce48a93ee
dropped abbreviation "pred_comp"; introduced infix notation "P OO Q" for "relcompp P Q"
griff
parents:
47105
diff
changeset
|
657 |
apply (erule relcomppI) |
47308 | 658 |
apply (erule Quotient3_symp [OF R1, THEN sympD]) |
659 |
apply (rule Quotient3_rel[symmetric, OF R1, THEN iffD2]) |
|
660 |
apply (rule conjI, erule Quotient3_refl1 [OF R1]) |
|
661 |
apply (rule conjI, rule Quotient3_rep_reflp [OF R1]) |
|
662 |
apply (subst Quotient3_abs_rep [OF R1]) |
|
663 |
apply (erule Quotient3_rel_abs [OF R1]) |
|
47096
3ea48c19673e
generation of a code certificate from a respectfulness theorem for constants lifted by the quotient_definition command & setup_lifting command: setups Quotient infrastructure from a typedef theorem
kuncar
parents:
47094
diff
changeset
|
664 |
apply (rename_tac x y) |
3ea48c19673e
generation of a code certificate from a respectfulness theorem for constants lifted by the quotient_definition command & setup_lifting command: setups Quotient infrastructure from a typedef theorem
kuncar
parents:
47094
diff
changeset
|
665 |
apply (drule Abs1) |
47308 | 666 |
apply (erule Quotient3_refl2 [OF R1]) |
667 |
apply (erule Quotient3_refl1 [OF R1]) |
|
668 |
apply (drule Quotient3_refl2 [OF R2], drule Rep1) |
|
47096
3ea48c19673e
generation of a code certificate from a respectfulness theorem for constants lifted by the quotient_definition command & setup_lifting command: setups Quotient infrastructure from a typedef theorem
kuncar
parents:
47094
diff
changeset
|
669 |
apply (subgoal_tac "R1 s (Rep1 (Abs1 y))") |
47434
b75ce48a93ee
dropped abbreviation "pred_comp"; introduced infix notation "P OO Q" for "relcompp P Q"
griff
parents:
47105
diff
changeset
|
670 |
apply (rule_tac b="Rep1 (Abs1 y)" in relcomppI, assumption) |
b75ce48a93ee
dropped abbreviation "pred_comp"; introduced infix notation "P OO Q" for "relcompp P Q"
griff
parents:
47105
diff
changeset
|
671 |
apply (erule relcomppI) |
47308 | 672 |
apply (erule Quotient3_symp [OF R1, THEN sympD]) |
673 |
apply (rule Quotient3_rel[symmetric, OF R1, THEN iffD2]) |
|
674 |
apply (rule conjI, erule Quotient3_refl2 [OF R1]) |
|
675 |
apply (rule conjI, rule Quotient3_rep_reflp [OF R1]) |
|
676 |
apply (subst Quotient3_abs_rep [OF R1]) |
|
677 |
apply (erule Quotient3_rel_abs [OF R1, THEN sym]) |
|
47096
3ea48c19673e
generation of a code certificate from a respectfulness theorem for constants lifted by the quotient_definition command & setup_lifting command: setups Quotient infrastructure from a typedef theorem
kuncar
parents:
47094
diff
changeset
|
678 |
apply simp |
47308 | 679 |
apply (rule Quotient3_rel_abs [OF R2]) |
680 |
apply (rule Quotient3_rel_abs [OF R1, THEN ssubst], assumption) |
|
681 |
apply (rule Quotient3_rel_abs [OF R1, THEN subst], assumption) |
|
47096
3ea48c19673e
generation of a code certificate from a respectfulness theorem for constants lifted by the quotient_definition command & setup_lifting command: setups Quotient infrastructure from a typedef theorem
kuncar
parents:
47094
diff
changeset
|
682 |
apply (erule Abs1) |
47308 | 683 |
apply (erule Quotient3_refl2 [OF R1]) |
684 |
apply (erule Quotient3_refl1 [OF R1]) |
|
47096
3ea48c19673e
generation of a code certificate from a respectfulness theorem for constants lifted by the quotient_definition command & setup_lifting command: setups Quotient infrastructure from a typedef theorem
kuncar
parents:
47094
diff
changeset
|
685 |
apply (rename_tac a b c d) |
3ea48c19673e
generation of a code certificate from a respectfulness theorem for constants lifted by the quotient_definition command & setup_lifting command: setups Quotient infrastructure from a typedef theorem
kuncar
parents:
47094
diff
changeset
|
686 |
apply simp |
47434
b75ce48a93ee
dropped abbreviation "pred_comp"; introduced infix notation "P OO Q" for "relcompp P Q"
griff
parents:
47105
diff
changeset
|
687 |
apply (rule_tac b="Rep1 (Abs1 r)" in relcomppI) |
47308 | 688 |
apply (rule Quotient3_rel[symmetric, OF R1, THEN iffD2]) |
689 |
apply (rule conjI, erule Quotient3_refl1 [OF R1]) |
|
690 |
apply (simp add: Quotient3_abs_rep [OF R1] Quotient3_rep_reflp [OF R1]) |
|
47434
b75ce48a93ee
dropped abbreviation "pred_comp"; introduced infix notation "P OO Q" for "relcompp P Q"
griff
parents:
47105
diff
changeset
|
691 |
apply (rule_tac b="Rep1 (Abs1 s)" in relcomppI [rotated]) |
47308 | 692 |
apply (rule Quotient3_rel[symmetric, OF R1, THEN iffD2]) |
693 |
apply (simp add: Quotient3_abs_rep [OF R1] Quotient3_rep_reflp [OF R1]) |
|
694 |
apply (erule Quotient3_refl2 [OF R1]) |
|
47096
3ea48c19673e
generation of a code certificate from a respectfulness theorem for constants lifted by the quotient_definition command & setup_lifting command: setups Quotient infrastructure from a typedef theorem
kuncar
parents:
47094
diff
changeset
|
695 |
apply (rule Rep1) |
3ea48c19673e
generation of a code certificate from a respectfulness theorem for constants lifted by the quotient_definition command & setup_lifting command: setups Quotient infrastructure from a typedef theorem
kuncar
parents:
47094
diff
changeset
|
696 |
apply (drule Abs1) |
47308 | 697 |
apply (erule Quotient3_refl2 [OF R1]) |
698 |
apply (erule Quotient3_refl1 [OF R1]) |
|
47096
3ea48c19673e
generation of a code certificate from a respectfulness theorem for constants lifted by the quotient_definition command & setup_lifting command: setups Quotient infrastructure from a typedef theorem
kuncar
parents:
47094
diff
changeset
|
699 |
apply (drule Abs1) |
47308 | 700 |
apply (erule Quotient3_refl2 [OF R1]) |
701 |
apply (erule Quotient3_refl1 [OF R1]) |
|
702 |
apply (drule Quotient3_rel_abs [OF R1]) |
|
703 |
apply (drule Quotient3_rel_abs [OF R1]) |
|
704 |
apply (drule Quotient3_rel_abs [OF R1]) |
|
705 |
apply (drule Quotient3_rel_abs [OF R1]) |
|
47096
3ea48c19673e
generation of a code certificate from a respectfulness theorem for constants lifted by the quotient_definition command & setup_lifting command: setups Quotient infrastructure from a typedef theorem
kuncar
parents:
47094
diff
changeset
|
706 |
apply simp |
47308 | 707 |
apply (rule Quotient3_rel[symmetric, OF R2, THEN iffD2]) |
47096
3ea48c19673e
generation of a code certificate from a respectfulness theorem for constants lifted by the quotient_definition command & setup_lifting command: setups Quotient infrastructure from a typedef theorem
kuncar
parents:
47094
diff
changeset
|
708 |
apply simp |
3ea48c19673e
generation of a code certificate from a respectfulness theorem for constants lifted by the quotient_definition command & setup_lifting command: setups Quotient infrastructure from a typedef theorem
kuncar
parents:
47094
diff
changeset
|
709 |
done |
3ea48c19673e
generation of a code certificate from a respectfulness theorem for constants lifted by the quotient_definition command & setup_lifting command: setups Quotient infrastructure from a typedef theorem
kuncar
parents:
47094
diff
changeset
|
710 |
|
47308 | 711 |
lemma OOO_eq_quotient3: |
47096
3ea48c19673e
generation of a code certificate from a respectfulness theorem for constants lifted by the quotient_definition command & setup_lifting command: setups Quotient infrastructure from a typedef theorem
kuncar
parents:
47094
diff
changeset
|
712 |
fixes R1 :: "'a \<Rightarrow> 'a \<Rightarrow> bool" |
3ea48c19673e
generation of a code certificate from a respectfulness theorem for constants lifted by the quotient_definition command & setup_lifting command: setups Quotient infrastructure from a typedef theorem
kuncar
parents:
47094
diff
changeset
|
713 |
fixes Abs1 :: "'a \<Rightarrow> 'b" and Rep1 :: "'b \<Rightarrow> 'a" |
3ea48c19673e
generation of a code certificate from a respectfulness theorem for constants lifted by the quotient_definition command & setup_lifting command: setups Quotient infrastructure from a typedef theorem
kuncar
parents:
47094
diff
changeset
|
714 |
fixes Abs2 :: "'b \<Rightarrow> 'c" and Rep2 :: "'c \<Rightarrow> 'b" |
47308 | 715 |
assumes R1: "Quotient3 R1 Abs1 Rep1" |
716 |
assumes R2: "Quotient3 op= Abs2 Rep2" |
|
717 |
shows "Quotient3 (R1 OOO op=) (Abs2 \<circ> Abs1) (Rep1 \<circ> Rep2)" |
|
47096
3ea48c19673e
generation of a code certificate from a respectfulness theorem for constants lifted by the quotient_definition command & setup_lifting command: setups Quotient infrastructure from a typedef theorem
kuncar
parents:
47094
diff
changeset
|
718 |
using assms |
47308 | 719 |
by (rule OOO_quotient3) auto |
47096
3ea48c19673e
generation of a code certificate from a respectfulness theorem for constants lifted by the quotient_definition command & setup_lifting command: setups Quotient infrastructure from a typedef theorem
kuncar
parents:
47094
diff
changeset
|
720 |
|
47362
b1f099bdfbba
connect the Quotient package to the Lifting package
kuncar
parents:
47361
diff
changeset
|
721 |
subsection {* Quotient3 to Quotient *} |
b1f099bdfbba
connect the Quotient package to the Lifting package
kuncar
parents:
47361
diff
changeset
|
722 |
|
b1f099bdfbba
connect the Quotient package to the Lifting package
kuncar
parents:
47361
diff
changeset
|
723 |
lemma Quotient3_to_Quotient: |
b1f099bdfbba
connect the Quotient package to the Lifting package
kuncar
parents:
47361
diff
changeset
|
724 |
assumes "Quotient3 R Abs Rep" |
b1f099bdfbba
connect the Quotient package to the Lifting package
kuncar
parents:
47361
diff
changeset
|
725 |
and "T \<equiv> \<lambda>x y. R x x \<and> Abs x = y" |
b1f099bdfbba
connect the Quotient package to the Lifting package
kuncar
parents:
47361
diff
changeset
|
726 |
shows "Quotient R Abs Rep T" |
b1f099bdfbba
connect the Quotient package to the Lifting package
kuncar
parents:
47361
diff
changeset
|
727 |
using assms unfolding Quotient3_def by (intro QuotientI) blast+ |
47096
3ea48c19673e
generation of a code certificate from a respectfulness theorem for constants lifted by the quotient_definition command & setup_lifting command: setups Quotient infrastructure from a typedef theorem
kuncar
parents:
47094
diff
changeset
|
728 |
|
47362
b1f099bdfbba
connect the Quotient package to the Lifting package
kuncar
parents:
47361
diff
changeset
|
729 |
lemma Quotient3_to_Quotient_equivp: |
b1f099bdfbba
connect the Quotient package to the Lifting package
kuncar
parents:
47361
diff
changeset
|
730 |
assumes q: "Quotient3 R Abs Rep" |
b1f099bdfbba
connect the Quotient package to the Lifting package
kuncar
parents:
47361
diff
changeset
|
731 |
and T_def: "T \<equiv> \<lambda>x y. Abs x = y" |
b1f099bdfbba
connect the Quotient package to the Lifting package
kuncar
parents:
47361
diff
changeset
|
732 |
and eR: "equivp R" |
b1f099bdfbba
connect the Quotient package to the Lifting package
kuncar
parents:
47361
diff
changeset
|
733 |
shows "Quotient R Abs Rep T" |
b1f099bdfbba
connect the Quotient package to the Lifting package
kuncar
parents:
47361
diff
changeset
|
734 |
proof (intro QuotientI) |
b1f099bdfbba
connect the Quotient package to the Lifting package
kuncar
parents:
47361
diff
changeset
|
735 |
fix a |
b1f099bdfbba
connect the Quotient package to the Lifting package
kuncar
parents:
47361
diff
changeset
|
736 |
show "Abs (Rep a) = a" using q by(rule Quotient3_abs_rep) |
b1f099bdfbba
connect the Quotient package to the Lifting package
kuncar
parents:
47361
diff
changeset
|
737 |
next |
b1f099bdfbba
connect the Quotient package to the Lifting package
kuncar
parents:
47361
diff
changeset
|
738 |
fix a |
b1f099bdfbba
connect the Quotient package to the Lifting package
kuncar
parents:
47361
diff
changeset
|
739 |
show "R (Rep a) (Rep a)" using q by(rule Quotient3_rep_reflp) |
b1f099bdfbba
connect the Quotient package to the Lifting package
kuncar
parents:
47361
diff
changeset
|
740 |
next |
b1f099bdfbba
connect the Quotient package to the Lifting package
kuncar
parents:
47361
diff
changeset
|
741 |
fix r s |
b1f099bdfbba
connect the Quotient package to the Lifting package
kuncar
parents:
47361
diff
changeset
|
742 |
show "R r s = (R r r \<and> R s s \<and> Abs r = Abs s)" using q by(rule Quotient3_rel[symmetric]) |
b1f099bdfbba
connect the Quotient package to the Lifting package
kuncar
parents:
47361
diff
changeset
|
743 |
next |
b1f099bdfbba
connect the Quotient package to the Lifting package
kuncar
parents:
47361
diff
changeset
|
744 |
show "T = (\<lambda>x y. R x x \<and> Abs x = y)" using T_def equivp_reflp[OF eR] by simp |
47096
3ea48c19673e
generation of a code certificate from a respectfulness theorem for constants lifted by the quotient_definition command & setup_lifting command: setups Quotient infrastructure from a typedef theorem
kuncar
parents:
47094
diff
changeset
|
745 |
qed |
3ea48c19673e
generation of a code certificate from a respectfulness theorem for constants lifted by the quotient_definition command & setup_lifting command: setups Quotient infrastructure from a typedef theorem
kuncar
parents:
47094
diff
changeset
|
746 |
|
35294 | 747 |
subsection {* ML setup *} |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
748 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
749 |
text {* Auxiliary data for the quotient package *} |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
750 |
|
57960 | 751 |
named_theorems quot_equiv "equivalence relation theorems" |
59028 | 752 |
and quot_respect "respectfulness theorems" |
753 |
and quot_preserve "preservation theorems" |
|
754 |
and id_simps "identity simp rules for maps" |
|
755 |
and quot_thm "quotient theorems" |
|
48891 | 756 |
ML_file "Tools/Quotient/quotient_info.ML" |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
757 |
|
55945 | 758 |
declare [[mapQ3 "fun" = (rel_fun, fun_quotient3)]] |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
759 |
|
47308 | 760 |
lemmas [quot_thm] = fun_quotient3 |
44553
4d39b032a021
avoid intermixing set and predicates; dropped lemmas mem_rsp and mem_prs (now in Quotient_Set.thy)
haftmann
parents:
44413
diff
changeset
|
761 |
lemmas [quot_respect] = quot_rel_rsp if_rsp o_rsp let_rsp id_rsp |
4d39b032a021
avoid intermixing set and predicates; dropped lemmas mem_rsp and mem_prs (now in Quotient_Set.thy)
haftmann
parents:
44413
diff
changeset
|
762 |
lemmas [quot_preserve] = if_prs o_prs let_prs id_prs |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
763 |
lemmas [quot_equiv] = identity_equivp |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
764 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
765 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
766 |
text {* Lemmas about simplifying id's. *} |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
767 |
lemmas [id_simps] = |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
768 |
id_def[symmetric] |
40602 | 769 |
map_fun_id |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
770 |
id_apply |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
771 |
id_o |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
772 |
o_id |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
773 |
eq_comp_r |
44413
80d460bc6fa8
Quotient Package: some infrastructure for lifting inside sets
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
44242
diff
changeset
|
774 |
vimage_id |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
775 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
776 |
text {* Translation functions for the lifting process. *} |
48891 | 777 |
ML_file "Tools/Quotient/quotient_term.ML" |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
778 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
779 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
780 |
text {* Definitions of the quotient types. *} |
48891 | 781 |
ML_file "Tools/Quotient/quotient_type.ML" |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
782 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
783 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
784 |
text {* Definitions for quotient constants. *} |
48891 | 785 |
ML_file "Tools/Quotient/quotient_def.ML" |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
786 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
787 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
788 |
text {* |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
789 |
An auxiliary constant for recording some information |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
790 |
about the lifted theorem in a tactic. |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
791 |
*} |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
792 |
definition |
40466
c6587375088e
type annotations in specifications; fun_rel_def is no simp rule by default; slightly changed fun_map_def; more on predicates on relation functions; proper HOL equations in definitions
haftmann
parents:
40031
diff
changeset
|
793 |
Quot_True :: "'a \<Rightarrow> bool" |
c6587375088e
type annotations in specifications; fun_rel_def is no simp rule by default; slightly changed fun_map_def; more on predicates on relation functions; proper HOL equations in definitions
haftmann
parents:
40031
diff
changeset
|
794 |
where |
c6587375088e
type annotations in specifications; fun_rel_def is no simp rule by default; slightly changed fun_map_def; more on predicates on relation functions; proper HOL equations in definitions
haftmann
parents:
40031
diff
changeset
|
795 |
"Quot_True x \<longleftrightarrow> True" |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
796 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
797 |
lemma |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
798 |
shows QT_all: "Quot_True (All P) \<Longrightarrow> Quot_True P" |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
799 |
and QT_ex: "Quot_True (Ex P) \<Longrightarrow> Quot_True P" |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
800 |
and QT_ex1: "Quot_True (Ex1 P) \<Longrightarrow> Quot_True P" |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
801 |
and QT_lam: "Quot_True (\<lambda>x. P x) \<Longrightarrow> (\<And>x. Quot_True (P x))" |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
802 |
and QT_ext: "(\<And>x. Quot_True (a x) \<Longrightarrow> f x = g x) \<Longrightarrow> (Quot_True a \<Longrightarrow> f = g)" |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
803 |
by (simp_all add: Quot_True_def ext) |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
804 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
805 |
lemma QT_imp: "Quot_True a \<equiv> Quot_True b" |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
806 |
by (simp add: Quot_True_def) |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
807 |
|
53011
aeee0a4be6cf
introduce locale with syntax for fun_rel and map_fun and make thus ===> and ---> local
kuncar
parents:
51112
diff
changeset
|
808 |
context |
aeee0a4be6cf
introduce locale with syntax for fun_rel and map_fun and make thus ===> and ---> local
kuncar
parents:
51112
diff
changeset
|
809 |
begin |
aeee0a4be6cf
introduce locale with syntax for fun_rel and map_fun and make thus ===> and ---> local
kuncar
parents:
51112
diff
changeset
|
810 |
interpretation lifting_syntax . |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
811 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
812 |
text {* Tactics for proving the lifted theorems *} |
48891 | 813 |
ML_file "Tools/Quotient/quotient_tacs.ML" |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
814 |
|
53011
aeee0a4be6cf
introduce locale with syntax for fun_rel and map_fun and make thus ===> and ---> local
kuncar
parents:
51112
diff
changeset
|
815 |
end |
aeee0a4be6cf
introduce locale with syntax for fun_rel and map_fun and make thus ===> and ---> local
kuncar
parents:
51112
diff
changeset
|
816 |
|
35294 | 817 |
subsection {* Methods / Interface *} |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
818 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
819 |
method_setup lifting = |
37593
2505feaf2d70
separated the lifting and descending procedures in the quotient package
Christian Urban <urbanc@in.tum.de>
parents:
37564
diff
changeset
|
820 |
{* Attrib.thms >> (fn thms => fn ctxt => |
46468 | 821 |
SIMPLE_METHOD' (Quotient_Tacs.lift_tac ctxt [] thms)) *} |
42814 | 822 |
{* lift theorems to quotient types *} |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
823 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
824 |
method_setup lifting_setup = |
37593
2505feaf2d70
separated the lifting and descending procedures in the quotient package
Christian Urban <urbanc@in.tum.de>
parents:
37564
diff
changeset
|
825 |
{* Attrib.thm >> (fn thm => fn ctxt => |
46468 | 826 |
SIMPLE_METHOD' (Quotient_Tacs.lift_procedure_tac ctxt [] thm)) *} |
42814 | 827 |
{* set up the three goals for the quotient lifting procedure *} |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
828 |
|
37593
2505feaf2d70
separated the lifting and descending procedures in the quotient package
Christian Urban <urbanc@in.tum.de>
parents:
37564
diff
changeset
|
829 |
method_setup descending = |
46468 | 830 |
{* Scan.succeed (fn ctxt => SIMPLE_METHOD' (Quotient_Tacs.descend_tac ctxt [])) *} |
42814 | 831 |
{* decend theorems to the raw level *} |
37593
2505feaf2d70
separated the lifting and descending procedures in the quotient package
Christian Urban <urbanc@in.tum.de>
parents:
37564
diff
changeset
|
832 |
|
2505feaf2d70
separated the lifting and descending procedures in the quotient package
Christian Urban <urbanc@in.tum.de>
parents:
37564
diff
changeset
|
833 |
method_setup descending_setup = |
46468 | 834 |
{* Scan.succeed (fn ctxt => SIMPLE_METHOD' (Quotient_Tacs.descend_procedure_tac ctxt [])) *} |
42814 | 835 |
{* set up the three goals for the decending theorems *} |
37593
2505feaf2d70
separated the lifting and descending procedures in the quotient package
Christian Urban <urbanc@in.tum.de>
parents:
37564
diff
changeset
|
836 |
|
45782
f82020ca3248
added a specific tactic and method that deal with partial equivalence relations
Christian Urban <urbanc@in.tum.de>
parents:
45680
diff
changeset
|
837 |
method_setup partiality_descending = |
46468 | 838 |
{* Scan.succeed (fn ctxt => SIMPLE_METHOD' (Quotient_Tacs.partiality_descend_tac ctxt [])) *} |
45782
f82020ca3248
added a specific tactic and method that deal with partial equivalence relations
Christian Urban <urbanc@in.tum.de>
parents:
45680
diff
changeset
|
839 |
{* decend theorems to the raw level *} |
f82020ca3248
added a specific tactic and method that deal with partial equivalence relations
Christian Urban <urbanc@in.tum.de>
parents:
45680
diff
changeset
|
840 |
|
f82020ca3248
added a specific tactic and method that deal with partial equivalence relations
Christian Urban <urbanc@in.tum.de>
parents:
45680
diff
changeset
|
841 |
method_setup partiality_descending_setup = |
f82020ca3248
added a specific tactic and method that deal with partial equivalence relations
Christian Urban <urbanc@in.tum.de>
parents:
45680
diff
changeset
|
842 |
{* Scan.succeed (fn ctxt => |
46468 | 843 |
SIMPLE_METHOD' (Quotient_Tacs.partiality_descend_procedure_tac ctxt [])) *} |
45782
f82020ca3248
added a specific tactic and method that deal with partial equivalence relations
Christian Urban <urbanc@in.tum.de>
parents:
45680
diff
changeset
|
844 |
{* set up the three goals for the decending theorems *} |
f82020ca3248
added a specific tactic and method that deal with partial equivalence relations
Christian Urban <urbanc@in.tum.de>
parents:
45680
diff
changeset
|
845 |
|
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
846 |
method_setup regularize = |
46468 | 847 |
{* Scan.succeed (fn ctxt => SIMPLE_METHOD' (Quotient_Tacs.regularize_tac ctxt)) *} |
42814 | 848 |
{* prove the regularization goals from the quotient lifting procedure *} |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
849 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
850 |
method_setup injection = |
46468 | 851 |
{* Scan.succeed (fn ctxt => SIMPLE_METHOD' (Quotient_Tacs.all_injection_tac ctxt)) *} |
42814 | 852 |
{* prove the rep/abs injection goals from the quotient lifting procedure *} |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
853 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
854 |
method_setup cleaning = |
46468 | 855 |
{* Scan.succeed (fn ctxt => SIMPLE_METHOD' (Quotient_Tacs.clean_tac ctxt)) *} |
42814 | 856 |
{* prove the cleaning goals from the quotient lifting procedure *} |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
857 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
858 |
attribute_setup quot_lifted = |
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
859 |
{* Scan.succeed Quotient_Tacs.lifted_attrib *} |
42814 | 860 |
{* lift theorems to quotient types *} |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
861 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
862 |
no_notation |
53011
aeee0a4be6cf
introduce locale with syntax for fun_rel and map_fun and make thus ===> and ---> local
kuncar
parents:
51112
diff
changeset
|
863 |
rel_conj (infixr "OOO" 75) |
35222
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
864 |
|
4f1fba00f66d
Initial version of HOL quotient package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
865 |
end |
47488
be6dd389639d
centralized enriched_type declaration, thanks to in-situ available Isar commands
haftmann
parents:
47436
diff
changeset
|
866 |