src/HOL/Library/Abstract_Rat.thy
changeset 32456 341c83339aeb
parent 31967 81dbc693143b
child 32960 69916a850301
equal deleted inserted replaced
32450:375db037f4d2 32456:341c83339aeb
   187   shows "((INum x ::'a::{ring_char_0,field, division_by_zero}) = INum y) = (x = y)" (is "?lhs = ?rhs")
   187   shows "((INum x ::'a::{ring_char_0,field, division_by_zero}) = INum y) = (x = y)" (is "?lhs = ?rhs")
   188 proof
   188 proof
   189   have "\<exists> a b a' b'. x = (a,b) \<and> y = (a',b')" by auto
   189   have "\<exists> a b a' b'. x = (a,b) \<and> y = (a',b')" by auto
   190   then obtain a b a' b' where xy[simp]: "x = (a,b)" "y=(a',b')" by blast
   190   then obtain a b a' b' where xy[simp]: "x = (a,b)" "y=(a',b')" by blast
   191   assume H: ?lhs 
   191   assume H: ?lhs 
   192   {assume "a = 0 \<or> b = 0 \<or> a' = 0 \<or> b' = 0" hence ?rhs
   192   {assume "a = 0 \<or> b = 0 \<or> a' = 0 \<or> b' = 0"
   193       using na nb H
   193     hence ?rhs using na nb H
   194       apply (simp add: INum_def split_def isnormNum_def)
   194       by (simp add: INum_def split_def isnormNum_def split: split_if_asm)}
   195       apply (cases "a = 0", simp_all)
       
   196       apply (cases "b = 0", simp_all)
       
   197       apply (cases "a' = 0", simp_all)
       
   198       apply (cases "a' = 0", simp_all add: of_int_eq_0_iff)
       
   199       done}
       
   200   moreover
   195   moreover
   201   { assume az: "a \<noteq> 0" and bz: "b \<noteq> 0" and a'z: "a'\<noteq>0" and b'z: "b'\<noteq>0"
   196   { assume az: "a \<noteq> 0" and bz: "b \<noteq> 0" and a'z: "a'\<noteq>0" and b'z: "b'\<noteq>0"
   202     from az bz a'z b'z na nb have pos: "b > 0" "b' > 0" by (simp_all add: isnormNum_def)
   197     from az bz a'z b'z na nb have pos: "b > 0" "b' > 0" by (simp_all add: isnormNum_def)
   203     from prems have eq:"a * b' = a'*b" 
   198     from prems have eq:"a * b' = a'*b" 
   204       by (simp add: INum_def  eq_divide_eq divide_eq_eq of_int_mult[symmetric] del: of_int_mult)
   199       by (simp add: INum_def  eq_divide_eq divide_eq_eq of_int_mult[symmetric] del: of_int_mult)
   515     have " \<exists> a b a' b'. x = (a,b) \<and> y= (a',b')" by auto
   510     have " \<exists> a b a' b'. x = (a,b) \<and> y= (a',b')" by auto
   516     then obtain a b a' b' where xy[simp]: "x = (a,b)" "y = (a',b')" by blast
   511     then obtain a b a' b' where xy[simp]: "x = (a,b)" "y = (a',b')" by blast
   517     have n0: "isnormNum 0\<^sub>N" by simp
   512     have n0: "isnormNum 0\<^sub>N" by simp
   518     show ?thesis using nx ny 
   513     show ?thesis using nx ny 
   519       apply (simp only: isnormNum_unique[where ?'a = 'a, OF  Nmul_normN[OF nx ny] n0, symmetric] Nmul[where ?'a = 'a])
   514       apply (simp only: isnormNum_unique[where ?'a = 'a, OF  Nmul_normN[OF nx ny] n0, symmetric] Nmul[where ?'a = 'a])
   520       apply (simp add: INum_def split_def isnormNum_def fst_conv snd_conv)
   515       by (simp add: INum_def split_def isnormNum_def fst_conv snd_conv split: split_if_asm)
   521       apply (cases "a=0",simp_all)
       
   522       apply (cases "a'=0",simp_all)
       
   523       done
       
   524   }
   516   }
   525 qed
   517 qed
   526 lemma Nneg_Nneg[simp]: "~\<^sub>N (~\<^sub>N c) = c"
   518 lemma Nneg_Nneg[simp]: "~\<^sub>N (~\<^sub>N c) = c"
   527   by (simp add: Nneg_def split_def)
   519   by (simp add: Nneg_def split_def)
   528 
   520