698
|
1 |
theory QuotSum
|
|
2 |
imports QuotMain
|
0
|
3 |
begin
|
|
4 |
|
|
5 |
fun
|
545
|
6 |
sum_rel
|
0
|
7 |
where
|
545
|
8 |
"sum_rel R1 R2 (Inl a1) (Inl b1) = R1 a1 b1"
|
|
9 |
| "sum_rel R1 R2 (Inl a1) (Inr b2) = False"
|
|
10 |
| "sum_rel R1 R2 (Inr a2) (Inl b1) = False"
|
|
11 |
| "sum_rel R1 R2 (Inr a2) (Inr b2) = R2 a2 b2"
|
0
|
12 |
|
|
13 |
fun
|
|
14 |
sum_map
|
|
15 |
where
|
|
16 |
"sum_map f1 f2 (Inl a) = Inl (f1 a)"
|
|
17 |
| "sum_map f1 f2 (Inr a) = Inr (f2 a)"
|
|
18 |
|
779
3b21b24a5fb6
corrected map declarations for Sum and Prod; moved absrep_fun examples in separate file
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
19 |
declare [[map "+" = (sum_map, sum_rel)]]
|
3b21b24a5fb6
corrected map declarations for Sum and Prod; moved absrep_fun examples in separate file
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
20 |
|
545
|
21 |
|
698
|
22 |
lemma sum_equivp[quot_equiv]:
|
|
23 |
assumes a: "equivp R1"
|
|
24 |
assumes b: "equivp R2"
|
|
25 |
shows "equivp (sum_rel R1 R2)"
|
|
26 |
unfolding equivp_reflp_symp_transp reflp_def symp_def transp_def
|
|
27 |
apply(auto)
|
|
28 |
apply(case_tac x)
|
|
29 |
apply(auto simp add: equivp_reflp[OF a] equivp_reflp[OF b])
|
|
30 |
apply(case_tac x)
|
|
31 |
apply(case_tac y)
|
|
32 |
prefer 3
|
|
33 |
apply(case_tac y)
|
|
34 |
apply(auto simp add: equivp_symp[OF a] equivp_symp[OF b])
|
|
35 |
apply(case_tac x)
|
|
36 |
apply(case_tac y)
|
|
37 |
apply(case_tac z)
|
|
38 |
prefer 3
|
|
39 |
apply(case_tac z)
|
|
40 |
prefer 5
|
|
41 |
apply(case_tac y)
|
|
42 |
apply(case_tac z)
|
|
43 |
prefer 3
|
|
44 |
apply(case_tac z)
|
|
45 |
apply(auto)
|
|
46 |
apply(metis equivp_transp[OF b])
|
|
47 |
apply(metis equivp_transp[OF a])
|
|
48 |
done
|
0
|
49 |
|
698
|
50 |
lemma sum_fun_fun:
|
|
51 |
assumes q1: "Quotient R1 Abs1 Rep1"
|
|
52 |
assumes q2: "Quotient R2 Abs2 Rep2"
|
|
53 |
shows "sum_rel R1 R2 r s =
|
|
54 |
(sum_rel R1 R2 r r \<and> sum_rel R1 R2 s s \<and> sum_map Abs1 Abs2 r = sum_map Abs1 Abs2 s)"
|
|
55 |
using q1 q2
|
|
56 |
apply(case_tac r)
|
|
57 |
apply(case_tac s)
|
|
58 |
apply(simp_all)
|
|
59 |
prefer 2
|
|
60 |
apply(case_tac s)
|
|
61 |
apply(auto)
|
|
62 |
unfolding Quotient_def
|
|
63 |
apply metis+
|
|
64 |
done
|
0
|
65 |
|
698
|
66 |
lemma sum_quotient[quot_thm]:
|
|
67 |
assumes q1: "Quotient R1 Abs1 Rep1"
|
|
68 |
assumes q2: "Quotient R2 Abs2 Rep2"
|
|
69 |
shows "Quotient (sum_rel R1 R2) (sum_map Abs1 Abs2) (sum_map Rep1 Rep2)"
|
|
70 |
unfolding Quotient_def
|
|
71 |
apply(rule conjI)
|
|
72 |
apply(rule allI)
|
|
73 |
apply(case_tac a)
|
|
74 |
apply(simp add: Quotient_abs_rep[OF q1])
|
|
75 |
apply(simp add: Quotient_abs_rep[OF q2])
|
|
76 |
apply(rule conjI)
|
|
77 |
apply(rule allI)
|
|
78 |
apply(case_tac a)
|
|
79 |
apply(simp add: Quotient_rel_rep[OF q1])
|
|
80 |
apply(simp add: Quotient_rel_rep[OF q2])
|
|
81 |
apply(rule allI)+
|
|
82 |
apply(rule sum_fun_fun[OF q1 q2])
|
|
83 |
done
|
|
84 |
|
|
85 |
end |