src/HOL/Integ/Integ.ML
changeset 1798 c055505f36d1
parent 1619 cb62d89b7adb
child 1894 c2c8279d40f0
equal deleted inserted replaced
1797:334308d2afbc 1798:c055505f36d1
   340 by (rtac (intrelI RS(equiv_intrel RS equiv_class_eq)) 1);
   340 by (rtac (intrelI RS(equiv_intrel RS equiv_class_eq)) 1);
   341 by (rtac (zmult_congruent_lemma RS trans) 1);
   341 by (rtac (zmult_congruent_lemma RS trans) 1);
   342 by (rtac (zmult_congruent_lemma RS trans RS sym) 1);
   342 by (rtac (zmult_congruent_lemma RS trans RS sym) 1);
   343 by (rtac (zmult_congruent_lemma RS trans RS sym) 1);
   343 by (rtac (zmult_congruent_lemma RS trans RS sym) 1);
   344 by (rtac (zmult_congruent_lemma RS trans RS sym) 1);
   344 by (rtac (zmult_congruent_lemma RS trans RS sym) 1);
   345 by (asm_simp_tac (!simpset delsimps [add_mult_distrib]
   345 by (asm_simp_tac (!simpset addsimps [add_mult_distrib RS sym]) 1);
   346                            addsimps [add_mult_distrib RS sym]) 1);
       
   347 by (asm_simp_tac (!simpset addsimps add_ac@mult_ac) 1);
   346 by (asm_simp_tac (!simpset addsimps add_ac@mult_ac) 1);
   348 qed "zmult_congruent2";
   347 qed "zmult_congruent2";
   349 
   348 
   350 (*Resolve th against the corresponding facts for zmult*)
   349 (*Resolve th against the corresponding facts for zmult*)
   351 val zmult_ize = RSLIST [equiv_intrel, zmult_congruent2];
   350 val zmult_ize = RSLIST [equiv_intrel, zmult_congruent2];
   395 
   394 
   396 goal Integ.thy "((z1::int) * z2) * z3 = z1 * (z2 * z3)";
   395 goal Integ.thy "((z1::int) * z2) * z3 = z1 * (z2 * z3)";
   397 by (res_inst_tac [("z","z1")] eq_Abs_Integ 1);
   396 by (res_inst_tac [("z","z1")] eq_Abs_Integ 1);
   398 by (res_inst_tac [("z","z2")] eq_Abs_Integ 1);
   397 by (res_inst_tac [("z","z2")] eq_Abs_Integ 1);
   399 by (res_inst_tac [("z","z3")] eq_Abs_Integ 1);
   398 by (res_inst_tac [("z","z3")] eq_Abs_Integ 1);
   400 by (asm_simp_tac (!simpset addsimps ([zmult] @ add_ac @ mult_ac)) 1);
   399 by (asm_simp_tac (!simpset addsimps ([add_mult_distrib2,zmult] @ 
       
   400 				     add_ac @ mult_ac)) 1);
   401 qed "zmult_assoc";
   401 qed "zmult_assoc";
   402 
   402 
   403 (*For AC rewriting*)
   403 (*For AC rewriting*)
   404 qed_goal "zmult_left_commute" Integ.thy
   404 qed_goal "zmult_left_commute" Integ.thy
   405     "(z1::int)*(z2*z3) = z2*(z1*z3)"
   405     "(z1::int)*(z2*z3) = z2*(z1*z3)"
   412 goal Integ.thy "((z1::int) + z2) * w = (z1 * w) + (z2 * w)";
   412 goal Integ.thy "((z1::int) + z2) * w = (z1 * w) + (z2 * w)";
   413 by (res_inst_tac [("z","z1")] eq_Abs_Integ 1);
   413 by (res_inst_tac [("z","z1")] eq_Abs_Integ 1);
   414 by (res_inst_tac [("z","z2")] eq_Abs_Integ 1);
   414 by (res_inst_tac [("z","z2")] eq_Abs_Integ 1);
   415 by (res_inst_tac [("z","w")] eq_Abs_Integ 1);
   415 by (res_inst_tac [("z","w")] eq_Abs_Integ 1);
   416 by (asm_simp_tac 
   416 by (asm_simp_tac 
   417     (!simpset addsimps ([zadd, zmult] @ add_ac @ mult_ac)) 1);
   417     (!simpset addsimps ([add_mult_distrib2, zadd, zmult] @ 
       
   418 			add_ac @ mult_ac)) 1);
   418 qed "zadd_zmult_distrib";
   419 qed "zadd_zmult_distrib";
   419 
   420 
   420 val zmult_commute'= read_instantiate [("z","w")] zmult_commute;
   421 val zmult_commute'= read_instantiate [("z","w")] zmult_commute;
   421 
   422 
   422 goal Integ.thy "w * ($~ z) = $~ (w * z)";
   423 goal Integ.thy "w * ($~ z) = $~ (w * z)";