src/HOL/Integ/IntDef.thy
changeset 14658 b1293d0f8d5f
parent 14532 43e44c8b03ab
child 14691 e1eedc8cad37
equal deleted inserted replaced
14657:c7cc01735801 14658:b1293d0f8d5f
   131 
   131 
   132 lemma add:
   132 lemma add:
   133      "Abs_Integ (intrel``{(x,y)}) + Abs_Integ (intrel``{(u,v)}) =
   133      "Abs_Integ (intrel``{(x,y)}) + Abs_Integ (intrel``{(u,v)}) =
   134       Abs_Integ (intrel``{(x+u, y+v)})"
   134       Abs_Integ (intrel``{(x+u, y+v)})"
   135 proof -
   135 proof -
   136   have "congruent2 intrel
   136   have "congruent2 intrel intrel
   137         (\<lambda>z w. (\<lambda>(x,y). (\<lambda>(u,v). intrel `` {(x+u, y+v)}) w) z)"
   137         (\<lambda>z w. (\<lambda>(x,y). (\<lambda>(u,v). intrel `` {(x+u, y+v)}) w) z)"
   138     by (simp add: congruent2_def)
   138     by (simp add: congruent2_def)
   139   thus ?thesis
   139   thus ?thesis
   140     by (simp add: add_int_def UN_UN_split_split_eq
   140     by (simp add: add_int_def UN_UN_split_split_eq
   141                   UN_equiv_class2 [OF equiv_intrel])
   141                   UN_equiv_class2 [OF equiv_intrel equiv_intrel])
   142 qed
   142 qed
   143 
   143 
   144 lemma zminus_zadd_distrib: "- (z + w) = (- z) + (- w::int)"
   144 lemma zminus_zadd_distrib: "- (z + w) = (- z) + (- w::int)"
   145 by (cases z, cases w, simp add: minus add)
   145 by (cases z, cases w, simp add: minus add)
   146 
   146 
   185 
   185 
   186 subsection{*Integer Multiplication*}
   186 subsection{*Integer Multiplication*}
   187 
   187 
   188 text{*Congruence property for multiplication*}
   188 text{*Congruence property for multiplication*}
   189 lemma mult_congruent2:
   189 lemma mult_congruent2:
   190      "congruent2 intrel
   190      "congruent2 intrel intrel
   191         (%p1 p2. (%(x,y). (%(u,v).
   191         (%p1 p2. (%(x,y). (%(u,v).
   192                     intrel``{(x*u + y*v, x*v + y*u)}) p2) p1)"
   192                     intrel``{(x*u + y*v, x*v + y*u)}) p2) p1)"
   193 apply (rule equiv_intrel [THEN congruent2_commuteI])
   193 apply (rule equiv_intrel [THEN congruent2_commuteI])
   194  apply (force simp add: mult_ac, clarify) 
   194  apply (force simp add: mult_ac, clarify) 
   195 apply (simp add: congruent_def mult_ac)  
   195 apply (simp add: congruent_def mult_ac)  
   202 
   202 
   203 lemma mult:
   203 lemma mult:
   204      "Abs_Integ((intrel``{(x,y)})) * Abs_Integ((intrel``{(u,v)})) =
   204      "Abs_Integ((intrel``{(x,y)})) * Abs_Integ((intrel``{(u,v)})) =
   205       Abs_Integ(intrel `` {(x*u + y*v, x*v + y*u)})"
   205       Abs_Integ(intrel `` {(x*u + y*v, x*v + y*u)})"
   206 by (simp add: mult_int_def UN_UN_split_split_eq mult_congruent2
   206 by (simp add: mult_int_def UN_UN_split_split_eq mult_congruent2
   207               equiv_intrel [THEN UN_equiv_class2])
   207               UN_equiv_class2 [OF equiv_intrel equiv_intrel])
   208 
   208 
   209 lemma zmult_zminus: "(- z) * w = - (z * (w::int))"
   209 lemma zmult_zminus: "(- z) * w = - (z * (w::int))"
   210 by (cases z, cases w, simp add: minus mult add_ac)
   210 by (cases z, cases w, simp add: minus mult add_ac)
   211 
   211 
   212 lemma zmult_commute: "(z::int) * w = w * z"
   212 lemma zmult_commute: "(z::int) * w = w * z"