src/HOL/Hyperreal/HyperDef.thy
changeset 14738 83f1a514dcb4
parent 14705 14b2c22a7e40
child 15013 34264f5e4691
equal deleted inserted replaced
14737:77ea79aed99d 14738:83f1a514dcb4
   330 done
   330 done
   331 
   331 
   332 lemma hypreal_add_zero_left: "(0::hypreal) + z = z"
   332 lemma hypreal_add_zero_left: "(0::hypreal) + z = z"
   333 by (cases z, simp add: hypreal_zero_def hypreal_add)
   333 by (cases z, simp add: hypreal_zero_def hypreal_add)
   334 
   334 
   335 instance hypreal :: plus_ac0
   335 instance hypreal :: comm_monoid_add
   336   by intro_classes
   336   by intro_classes
   337     (assumption | 
   337     (assumption | 
   338       rule hypreal_add_commute hypreal_add_assoc hypreal_add_zero_left)+
   338       rule hypreal_add_commute hypreal_add_assoc hypreal_add_zero_left)+
   339 
   339 
   340 lemma hypreal_add_zero_right [simp]: "z + (0::hypreal) = z"
   340 lemma hypreal_add_zero_right [simp]: "z + (0::hypreal) = z"
   421 by (simp add: hypreal_mult_inverse hypreal_mult_commute)
   421 by (simp add: hypreal_mult_inverse hypreal_mult_commute)
   422 
   422 
   423 instance hypreal :: field
   423 instance hypreal :: field
   424 proof
   424 proof
   425   fix x y z :: hypreal
   425   fix x y z :: hypreal
   426   show "(x + y) + z = x + (y + z)" by (rule hypreal_add_assoc)
       
   427   show "x + y = y + x" by (rule hypreal_add_commute)
       
   428   show "0 + x = x" by simp
       
   429   show "- x + x = 0" by (simp add: hypreal_add_minus_left)
   426   show "- x + x = 0" by (simp add: hypreal_add_minus_left)
   430   show "x - y = x + (-y)" by (simp add: hypreal_diff_def)
   427   show "x - y = x + (-y)" by (simp add: hypreal_diff_def)
   431   show "(x * y) * z = x * (y * z)" by (rule hypreal_mult_assoc)
   428   show "(x * y) * z = x * (y * z)" by (rule hypreal_mult_assoc)
   432   show "x * y = y * x" by (rule hypreal_mult_commute)
   429   show "x * y = y * x" by (rule hypreal_mult_commute)
   433   show "1 * x = x" by (simp add: hypreal_mult_1)
   430   show "1 * x = x" by (simp add: hypreal_mult_1)
   510     by (auto dest: order_le_less_trans simp add: hrabs_def linorder_not_le)
   507     by (auto dest: order_le_less_trans simp add: hrabs_def linorder_not_le)
   511 qed
   508 qed
   512 
   509 
   513 lemma hypreal_eq_minus_iff: "((x::hypreal) = y) = (x + - y = 0)"
   510 lemma hypreal_eq_minus_iff: "((x::hypreal) = y) = (x + - y = 0)"
   514 apply auto
   511 apply auto
   515 apply (rule Ring_and_Field.add_right_cancel [of _ "-y", THEN iffD1], auto)
   512 apply (rule OrderedGroup.add_right_cancel [of _ "-y", THEN iffD1], auto)
   516 done
   513 done
   517 
   514 
   518 lemma hypreal_mult_left_cancel: "(c::hypreal) \<noteq> 0 ==> (c*a=c*b) = (a=b)"
   515 lemma hypreal_mult_left_cancel: "(c::hypreal) \<noteq> 0 ==> (c*a=c*b) = (a=b)"
   519 by auto
   516 by auto
   520     
   517