21 |
21 |
22 bind_thm ("equiv_intrel_iff", |
22 bind_thm ("equiv_intrel_iff", |
23 [equiv_intrel, UNIV_I, UNIV_I] MRS eq_equiv_class_iff); |
23 [equiv_intrel, UNIV_I, UNIV_I] MRS eq_equiv_class_iff); |
24 |
24 |
25 Goalw [Integ_def,intrel_def,quotient_def] |
25 Goalw [Integ_def,intrel_def,quotient_def] |
26 "intrel```{(x,y)}:Integ"; |
26 "intrel``{(x,y)}:Integ"; |
27 by (Fast_tac 1); |
27 by (Fast_tac 1); |
28 qed "intrel_in_integ"; |
28 qed "intrel_in_integ"; |
29 |
29 |
30 Goal "inj_on Abs_Integ Integ"; |
30 Goal "inj_on Abs_Integ Integ"; |
31 by (rtac inj_on_inverseI 1); |
31 by (rtac inj_on_inverseI 1); |
56 |
56 |
57 |
57 |
58 (**** zminus: unary negation on Integ ****) |
58 (**** zminus: unary negation on Integ ****) |
59 |
59 |
60 Goalw [congruent_def, intrel_def] |
60 Goalw [congruent_def, intrel_def] |
61 "congruent intrel (%(x,y). intrel```{(y,x)})"; |
61 "congruent intrel (%(x,y). intrel``{(y,x)})"; |
62 by (auto_tac (claset(), simpset() addsimps add_ac)); |
62 by (auto_tac (claset(), simpset() addsimps add_ac)); |
63 qed "zminus_congruent"; |
63 qed "zminus_congruent"; |
64 |
64 |
65 Goalw [zminus_def] |
65 Goalw [zminus_def] |
66 "- Abs_Integ(intrel```{(x,y)}) = Abs_Integ(intrel ``` {(y,x)})"; |
66 "- Abs_Integ(intrel``{(x,y)}) = Abs_Integ(intrel `` {(y,x)})"; |
67 by (simp_tac (simpset() addsimps |
67 by (simp_tac (simpset() addsimps |
68 [equiv_intrel RS UN_equiv_class, zminus_congruent]) 1); |
68 [equiv_intrel RS UN_equiv_class, zminus_congruent]) 1); |
69 qed "zminus"; |
69 qed "zminus"; |
70 |
70 |
71 (*Every integer can be written in the form Abs_Integ(...) *) |
71 (*Every integer can be written in the form Abs_Integ(...) *) |
72 val [prem] = Goal "(!!x y. z = Abs_Integ(intrel```{(x,y)}) ==> P) ==> P"; |
72 val [prem] = Goal "(!!x y. z = Abs_Integ(intrel``{(x,y)}) ==> P) ==> P"; |
73 by (res_inst_tac [("x1","z")] |
73 by (res_inst_tac [("x1","z")] |
74 (rewrite_rule [Integ_def] Rep_Integ RS quotientE) 1); |
74 (rewrite_rule [Integ_def] Rep_Integ RS quotientE) 1); |
75 by (dres_inst_tac [("f","Abs_Integ")] arg_cong 1); |
75 by (dres_inst_tac [("f","Abs_Integ")] arg_cong 1); |
76 by (res_inst_tac [("p","x")] PairE 1); |
76 by (res_inst_tac [("p","x")] PairE 1); |
77 by (rtac prem 1); |
77 by (rtac prem 1); |
112 |
112 |
113 |
113 |
114 (**** zadd: addition on Integ ****) |
114 (**** zadd: addition on Integ ****) |
115 |
115 |
116 Goalw [zadd_def] |
116 Goalw [zadd_def] |
117 "Abs_Integ(intrel```{(x1,y1)}) + Abs_Integ(intrel```{(x2,y2)}) = \ |
117 "Abs_Integ(intrel``{(x1,y1)}) + Abs_Integ(intrel``{(x2,y2)}) = \ |
118 \ Abs_Integ(intrel```{(x1+x2, y1+y2)})"; |
118 \ Abs_Integ(intrel``{(x1+x2, y1+y2)})"; |
119 by (asm_simp_tac (simpset() addsimps [UN_UN_split_split_eq]) 1); |
119 by (asm_simp_tac (simpset() addsimps [UN_UN_split_split_eq]) 1); |
120 by (stac (equiv_intrel RS UN_equiv_class2) 1); |
120 by (stac (equiv_intrel RS UN_equiv_class2) 1); |
121 by (auto_tac (claset(), simpset() addsimps [congruent2_def])); |
121 by (auto_tac (claset(), simpset() addsimps [congruent2_def])); |
122 qed "zadd"; |
122 qed "zadd"; |
123 |
123 |
230 (**** zmult: multiplication on Integ ****) |
230 (**** zmult: multiplication on Integ ****) |
231 |
231 |
232 (*Congruence property for multiplication*) |
232 (*Congruence property for multiplication*) |
233 Goal "congruent2 intrel \ |
233 Goal "congruent2 intrel \ |
234 \ (%p1 p2. (%(x1,y1). (%(x2,y2). \ |
234 \ (%p1 p2. (%(x1,y1). (%(x2,y2). \ |
235 \ intrel```{(x1*x2 + y1*y2, x1*y2 + y1*x2)}) p2) p1)"; |
235 \ intrel``{(x1*x2 + y1*y2, x1*y2 + y1*x2)}) p2) p1)"; |
236 by (rtac (equiv_intrel RS congruent2_commuteI) 1); |
236 by (rtac (equiv_intrel RS congruent2_commuteI) 1); |
237 by (pair_tac "w" 2); |
237 by (pair_tac "w" 2); |
238 by (ALLGOALS Clarify_tac); |
238 by (ALLGOALS Clarify_tac); |
239 by (simp_tac (simpset() addsimps add_ac@mult_ac) 1); |
239 by (simp_tac (simpset() addsimps add_ac@mult_ac) 1); |
240 by (asm_simp_tac (simpset() delsimps [equiv_intrel_iff] |
240 by (asm_simp_tac (simpset() delsimps [equiv_intrel_iff] |
247 by (asm_simp_tac (simpset() addsimps [add_mult_distrib RS sym]) 2); |
247 by (asm_simp_tac (simpset() addsimps [add_mult_distrib RS sym]) 2); |
248 by (arith_tac 1); |
248 by (arith_tac 1); |
249 qed "zmult_congruent2"; |
249 qed "zmult_congruent2"; |
250 |
250 |
251 Goalw [zmult_def] |
251 Goalw [zmult_def] |
252 "Abs_Integ((intrel```{(x1,y1)})) * Abs_Integ((intrel```{(x2,y2)})) = \ |
252 "Abs_Integ((intrel``{(x1,y1)})) * Abs_Integ((intrel``{(x2,y2)})) = \ |
253 \ Abs_Integ(intrel ``` {(x1*x2 + y1*y2, x1*y2 + y1*x2)})"; |
253 \ Abs_Integ(intrel `` {(x1*x2 + y1*y2, x1*y2 + y1*x2)})"; |
254 by (asm_simp_tac |
254 by (asm_simp_tac |
255 (simpset() addsimps [UN_UN_split_split_eq, zmult_congruent2, |
255 (simpset() addsimps [UN_UN_split_split_eq, zmult_congruent2, |
256 equiv_intrel RS UN_equiv_class2]) 1); |
256 equiv_intrel RS UN_equiv_class2]) 1); |
257 qed "zmult"; |
257 qed "zmult"; |
258 |
258 |