src/HOL/Ring_and_Field.thy
changeset 14387 e96d5c42c4b0
parent 14377 f454b3004f8f
child 14398 c5c47703f763
equal deleted inserted replaced
14386:ad1ffcc90162 14387:e96d5c42c4b0
    34 axclass ring \<subseteq> semiring, minus
    34 axclass ring \<subseteq> semiring, minus
    35   left_minus [simp]: "- a + a = 0"
    35   left_minus [simp]: "- a + a = 0"
    36   diff_minus: "a - b = a + (-b)"
    36   diff_minus: "a - b = a + (-b)"
    37 
    37 
    38 axclass ordered_semiring \<subseteq> semiring, linorder
    38 axclass ordered_semiring \<subseteq> semiring, linorder
    39   zero_less_one: "0 < 1" --{*This axiom too is needed for semirings only.*}
    39   zero_less_one [simp]: "0 < 1" --{*This too is needed for semirings only.*}
    40   add_left_mono: "a \<le> b ==> c + a \<le> c + b"
    40   add_left_mono: "a \<le> b ==> c + a \<le> c + b"
    41   mult_strict_left_mono: "a < b ==> 0 < c ==> c * a < c * b"
    41   mult_strict_left_mono: "a < b ==> 0 < c ==> c * a < c * b"
    42 
    42 
    43 axclass ordered_ring \<subseteq> ordered_semiring, ring
    43 axclass ordered_ring \<subseteq> ordered_semiring, ring
    44   abs_if: "\<bar>a\<bar> = (if a < 0 then -a else a)"
    44   abs_if: "\<bar>a\<bar> = (if a < 0 then -a else a)"
   299 
   299 
   300 lemma add_le_imp_le_right:
   300 lemma add_le_imp_le_right:
   301       "a + c \<le> b + c ==> a \<le> (b::'a::ordered_semiring)"
   301       "a + c \<le> b + c ==> a \<le> (b::'a::ordered_semiring)"
   302 by simp
   302 by simp
   303 
   303 
       
   304 lemma add_increasing: "[|0\<le>a; b\<le>c|] ==> b \<le> a + (c::'a::ordered_semiring)"
       
   305 by (insert add_mono [of 0 a b c], simp)
       
   306 
   304 
   307 
   305 subsection {* Ordering Rules for Unary Minus *}
   308 subsection {* Ordering Rules for Unary Minus *}
   306 
   309 
   307 lemma le_imp_neg_le:
   310 lemma le_imp_neg_le:
   308       assumes "a \<le> (b::'a::ordered_ring)" shows "-b \<le> -a"
   311       assumes "a \<le> (b::'a::ordered_ring)" shows "-b \<le> -a"
   569 done
   572 done
   570 
   573 
   571 lemma zero_le_square: "(0::'a::ordered_ring) \<le> a*a"
   574 lemma zero_le_square: "(0::'a::ordered_ring) \<le> a*a"
   572 by (simp add: zero_le_mult_iff linorder_linear) 
   575 by (simp add: zero_le_mult_iff linorder_linear) 
   573 
   576 
   574 lemma zero_le_one: "(0::'a::ordered_semiring) \<le> 1"
   577 text{*All three types of comparision involving 0 and 1 are covered.*}
       
   578 
       
   579 declare zero_neq_one [THEN not_sym, simp]
       
   580 
       
   581 lemma zero_le_one [simp]: "(0::'a::ordered_semiring) \<le> 1"
   575   by (rule zero_less_one [THEN order_less_imp_le]) 
   582   by (rule zero_less_one [THEN order_less_imp_le]) 
       
   583 
       
   584 lemma not_one_le_zero [simp]: "~ (1::'a::ordered_semiring) \<le> 0"
       
   585 by (simp add: linorder_not_le zero_less_one) 
       
   586 
       
   587 lemma not_one_less_zero [simp]: "~ (1::'a::ordered_semiring) < 0"
       
   588 by (simp add: linorder_not_less zero_le_one) 
   576 
   589 
   577 
   590 
   578 subsection{*More Monotonicity*}
   591 subsection{*More Monotonicity*}
   579 
   592 
   580 lemma mult_left_mono_neg:
   593 lemma mult_left_mono_neg:
   607 lemma mult_mono:
   620 lemma mult_mono:
   608      "[|a \<le> b; c \<le> d; 0 \<le> b; 0 \<le> c|] 
   621      "[|a \<le> b; c \<le> d; 0 \<le> b; 0 \<le> c|] 
   609       ==> a * c  \<le>  b * (d::'a::ordered_semiring)"
   622       ==> a * c  \<le>  b * (d::'a::ordered_semiring)"
   610 apply (erule mult_right_mono [THEN order_trans], assumption)
   623 apply (erule mult_right_mono [THEN order_trans], assumption)
   611 apply (erule mult_left_mono, assumption)
   624 apply (erule mult_left_mono, assumption)
       
   625 done
       
   626 
       
   627 lemma less_1_mult: "[| 1 < m; 1 < n |] ==> 1 < m*(n::'a::ordered_semiring)"
       
   628 apply (insert mult_strict_mono [of 1 m 1 n]) 
       
   629 apply (simp add:  order_less_trans [OF zero_less_one]); 
   612 done
   630 done
   613 
   631 
   614 
   632 
   615 subsection{*Cancellation Laws for Relationships With a Common Factor*}
   633 subsection{*Cancellation Laws for Relationships With a Common Factor*}
   616 
   634 
   974 
   992 
   975 text{*The effect is to extract signs from divisions*}
   993 text{*The effect is to extract signs from divisions*}
   976 declare minus_divide_left  [symmetric, simp]
   994 declare minus_divide_left  [symmetric, simp]
   977 declare minus_divide_right [symmetric, simp]
   995 declare minus_divide_right [symmetric, simp]
   978 
   996 
       
   997 text{*Also, extract signs from products*}
       
   998 declare minus_mult_left [symmetric, simp]
       
   999 declare minus_mult_right [symmetric, simp]
       
  1000 
   979 lemma minus_divide_divide [simp]:
  1001 lemma minus_divide_divide [simp]:
   980      "(-a)/(-b) = a / (b::'a::{field,division_by_zero})"
  1002      "(-a)/(-b) = a / (b::'a::{field,division_by_zero})"
   981 apply (case_tac "b=0", simp) 
  1003 apply (case_tac "b=0", simp) 
   982 apply (simp add: nonzero_minus_divide_divide) 
  1004 apply (simp add: nonzero_minus_divide_divide) 
   983 done
  1005 done
       
  1006 
       
  1007 lemma diff_divide_distrib:
       
  1008      "(a-b)/(c::'a::{field,division_by_zero}) = a/c - b/c"
       
  1009 by (simp add: diff_minus add_divide_distrib) 
   984 
  1010 
   985 
  1011 
   986 subsection {* Ordered Fields *}
  1012 subsection {* Ordered Fields *}
   987 
  1013 
   988 lemma positive_imp_inverse_positive: 
  1014 lemma positive_imp_inverse_positive: 
  1730 val mult_less_0_iff = thm"mult_less_0_iff";
  1756 val mult_less_0_iff = thm"mult_less_0_iff";
  1731 val mult_le_0_iff = thm"mult_le_0_iff";
  1757 val mult_le_0_iff = thm"mult_le_0_iff";
  1732 val zero_le_square = thm"zero_le_square";
  1758 val zero_le_square = thm"zero_le_square";
  1733 val zero_less_one = thm"zero_less_one";
  1759 val zero_less_one = thm"zero_less_one";
  1734 val zero_le_one = thm"zero_le_one";
  1760 val zero_le_one = thm"zero_le_one";
       
  1761 val not_one_less_zero = thm"not_one_less_zero";
       
  1762 val not_one_le_zero = thm"not_one_le_zero";
  1735 val mult_left_mono_neg = thm"mult_left_mono_neg";
  1763 val mult_left_mono_neg = thm"mult_left_mono_neg";
  1736 val mult_right_mono_neg = thm"mult_right_mono_neg";
  1764 val mult_right_mono_neg = thm"mult_right_mono_neg";
  1737 val mult_strict_mono = thm"mult_strict_mono";
  1765 val mult_strict_mono = thm"mult_strict_mono";
  1738 val mult_strict_mono' = thm"mult_strict_mono'";
  1766 val mult_strict_mono' = thm"mult_strict_mono'";
  1739 val mult_mono = thm"mult_mono";
  1767 val mult_mono = thm"mult_mono";