src/HOL/Power.thy
author nipkow
Thu, 07 Jul 2005 12:39:17 +0200
changeset 16733 236dfafbeb63
parent 15251 bb6f072c8d10
child 16775 c1b87ef4a1c3
permissions -rw-r--r--
linear arithmetic now takes "&" in assumptions apart.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3390
0c7625196d95 New theory "Power" of exponentiation (and binomial coefficients)
paulson
parents:
diff changeset
     1
(*  Title:      HOL/Power.thy
0c7625196d95 New theory "Power" of exponentiation (and binomial coefficients)
paulson
parents:
diff changeset
     2
    ID:         $Id$
0c7625196d95 New theory "Power" of exponentiation (and binomial coefficients)
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
0c7625196d95 New theory "Power" of exponentiation (and binomial coefficients)
paulson
parents:
diff changeset
     4
    Copyright   1997  University of Cambridge
0c7625196d95 New theory "Power" of exponentiation (and binomial coefficients)
paulson
parents:
diff changeset
     5
0c7625196d95 New theory "Power" of exponentiation (and binomial coefficients)
paulson
parents:
diff changeset
     6
*)
0c7625196d95 New theory "Power" of exponentiation (and binomial coefficients)
paulson
parents:
diff changeset
     7
16733
236dfafbeb63 linear arithmetic now takes "&" in assumptions apart.
nipkow
parents: 15251
diff changeset
     8
header{*Exponentiation*}
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
     9
15131
c69542757a4d New theory header syntax.
nipkow
parents: 15066
diff changeset
    10
theory Power
15140
322485b816ac import -> imports
nipkow
parents: 15131
diff changeset
    11
imports Divides
15131
c69542757a4d New theory header syntax.
nipkow
parents: 15066
diff changeset
    12
begin
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
    13
15066
d2f2b908e0a4 two new results
paulson
parents: 15004
diff changeset
    14
subsection{*Powers for Arbitrary Semirings*}
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
    15
15004
44ac09ba7213 ringpower to recpower
paulson
parents: 14738
diff changeset
    16
axclass recpower \<subseteq> comm_semiring_1_cancel, power
44ac09ba7213 ringpower to recpower
paulson
parents: 14738
diff changeset
    17
  power_0 [simp]: "a ^ 0       = 1"
44ac09ba7213 ringpower to recpower
paulson
parents: 14738
diff changeset
    18
  power_Suc:      "a ^ (Suc n) = a * (a ^ n)"
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
    19
15004
44ac09ba7213 ringpower to recpower
paulson
parents: 14738
diff changeset
    20
lemma power_0_Suc [simp]: "(0::'a::recpower) ^ (Suc n) = 0"
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
    21
by (simp add: power_Suc)
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
    22
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
    23
text{*It looks plausible as a simprule, but its effect can be strange.*}
15004
44ac09ba7213 ringpower to recpower
paulson
parents: 14738
diff changeset
    24
lemma power_0_left: "0^n = (if n=0 then 1 else (0::'a::recpower))"
15251
bb6f072c8d10 converted some induct_tac to induct
paulson
parents: 15140
diff changeset
    25
by (induct "n", auto)
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
    26
15004
44ac09ba7213 ringpower to recpower
paulson
parents: 14738
diff changeset
    27
lemma power_one [simp]: "1^n = (1::'a::recpower)"
15251
bb6f072c8d10 converted some induct_tac to induct
paulson
parents: 15140
diff changeset
    28
apply (induct "n")
14577
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
    29
apply (auto simp add: power_Suc)
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
    30
done
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
    31
15004
44ac09ba7213 ringpower to recpower
paulson
parents: 14738
diff changeset
    32
lemma power_one_right [simp]: "(a::'a::recpower) ^ 1 = a"
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
    33
by (simp add: power_Suc)
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
    34
15004
44ac09ba7213 ringpower to recpower
paulson
parents: 14738
diff changeset
    35
lemma power_add: "(a::'a::recpower) ^ (m+n) = (a^m) * (a^n)"
15251
bb6f072c8d10 converted some induct_tac to induct
paulson
parents: 15140
diff changeset
    36
apply (induct "n")
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
    37
apply (simp_all add: power_Suc mult_ac)
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
    38
done
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
    39
15004
44ac09ba7213 ringpower to recpower
paulson
parents: 14738
diff changeset
    40
lemma power_mult: "(a::'a::recpower) ^ (m*n) = (a^m) ^ n"
15251
bb6f072c8d10 converted some induct_tac to induct
paulson
parents: 15140
diff changeset
    41
apply (induct "n")
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
    42
apply (simp_all add: power_Suc power_add)
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
    43
done
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
    44
15004
44ac09ba7213 ringpower to recpower
paulson
parents: 14738
diff changeset
    45
lemma power_mult_distrib: "((a::'a::recpower) * b) ^ n = (a^n) * (b^n)"
15251
bb6f072c8d10 converted some induct_tac to induct
paulson
parents: 15140
diff changeset
    46
apply (induct "n")
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
    47
apply (auto simp add: power_Suc mult_ac)
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
    48
done
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
    49
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
    50
lemma zero_less_power:
15004
44ac09ba7213 ringpower to recpower
paulson
parents: 14738
diff changeset
    51
     "0 < (a::'a::{ordered_semidom,recpower}) ==> 0 < a^n"
15251
bb6f072c8d10 converted some induct_tac to induct
paulson
parents: 15140
diff changeset
    52
apply (induct "n")
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
    53
apply (simp_all add: power_Suc zero_less_one mult_pos)
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
    54
done
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
    55
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
    56
lemma zero_le_power:
15004
44ac09ba7213 ringpower to recpower
paulson
parents: 14738
diff changeset
    57
     "0 \<le> (a::'a::{ordered_semidom,recpower}) ==> 0 \<le> a^n"
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
    58
apply (simp add: order_le_less)
14577
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
    59
apply (erule disjE)
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
    60
apply (simp_all add: zero_less_power zero_less_one power_0_left)
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
    61
done
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
    62
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
    63
lemma one_le_power:
15004
44ac09ba7213 ringpower to recpower
paulson
parents: 14738
diff changeset
    64
     "1 \<le> (a::'a::{ordered_semidom,recpower}) ==> 1 \<le> a^n"
15251
bb6f072c8d10 converted some induct_tac to induct
paulson
parents: 15140
diff changeset
    65
apply (induct "n")
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
    66
apply (simp_all add: power_Suc)
14577
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
    67
apply (rule order_trans [OF _ mult_mono [of 1 _ 1]])
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
    68
apply (simp_all add: zero_le_one order_trans [OF zero_le_one])
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
    69
done
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
    70
14738
83f1a514dcb4 changes made due to new Ring_and_Field theory
obua
parents: 14577
diff changeset
    71
lemma gt1_imp_ge0: "1 < a ==> 0 \<le> (a::'a::ordered_semidom)"
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
    72
  by (simp add: order_trans [OF zero_le_one order_less_imp_le])
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
    73
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
    74
lemma power_gt1_lemma:
15004
44ac09ba7213 ringpower to recpower
paulson
parents: 14738
diff changeset
    75
  assumes gt1: "1 < (a::'a::{ordered_semidom,recpower})"
14577
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
    76
  shows "1 < a * a^n"
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
    77
proof -
14577
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
    78
  have "1*1 < a*1" using gt1 by simp
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
    79
  also have "\<dots> \<le> a * a^n" using gt1
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
    80
    by (simp only: mult_mono gt1_imp_ge0 one_le_power order_less_imp_le
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
    81
        zero_le_one order_refl)
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
    82
  finally show ?thesis by simp
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
    83
qed
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
    84
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
    85
lemma power_gt1:
15004
44ac09ba7213 ringpower to recpower
paulson
parents: 14738
diff changeset
    86
     "1 < (a::'a::{ordered_semidom,recpower}) ==> 1 < a ^ (Suc n)"
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
    87
by (simp add: power_gt1_lemma power_Suc)
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
    88
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
    89
lemma power_le_imp_le_exp:
15004
44ac09ba7213 ringpower to recpower
paulson
parents: 14738
diff changeset
    90
  assumes gt1: "(1::'a::{recpower,ordered_semidom}) < a"
14577
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
    91
  shows "!!n. a^m \<le> a^n ==> m \<le> n"
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
    92
proof (induct m)
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
    93
  case 0
14577
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
    94
  show ?case by simp
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
    95
next
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
    96
  case (Suc m)
14577
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
    97
  show ?case
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
    98
  proof (cases n)
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
    99
    case 0
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
   100
    from prems have "a * a^m \<le> 1" by (simp add: power_Suc)
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
   101
    with gt1 show ?thesis
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
   102
      by (force simp only: power_gt1_lemma
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
   103
          linorder_not_less [symmetric])
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
   104
  next
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
   105
    case (Suc n)
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
   106
    from prems show ?thesis
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
   107
      by (force dest: mult_left_le_imp_le
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
   108
          simp add: power_Suc order_less_trans [OF zero_less_one gt1])
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
   109
  qed
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   110
qed
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   111
14577
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
   112
text{*Surely we can strengthen this? It holds for @{text "0<a<1"} too.*}
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   113
lemma power_inject_exp [simp]:
15004
44ac09ba7213 ringpower to recpower
paulson
parents: 14738
diff changeset
   114
     "1 < (a::'a::{ordered_semidom,recpower}) ==> (a^m = a^n) = (m=n)"
14577
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
   115
  by (force simp add: order_antisym power_le_imp_le_exp)
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   116
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   117
text{*Can relax the first premise to @{term "0<a"} in the case of the
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   118
natural numbers.*}
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   119
lemma power_less_imp_less_exp:
15004
44ac09ba7213 ringpower to recpower
paulson
parents: 14738
diff changeset
   120
     "[| (1::'a::{recpower,ordered_semidom}) < a; a^m < a^n |] ==> m < n"
14577
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
   121
by (simp add: order_less_le [of m n] order_less_le [of "a^m" "a^n"]
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
   122
              power_le_imp_le_exp)
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   123
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   124
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   125
lemma power_mono:
15004
44ac09ba7213 ringpower to recpower
paulson
parents: 14738
diff changeset
   126
     "[|a \<le> b; (0::'a::{recpower,ordered_semidom}) \<le> a|] ==> a^n \<le> b^n"
15251
bb6f072c8d10 converted some induct_tac to induct
paulson
parents: 15140
diff changeset
   127
apply (induct "n")
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   128
apply (simp_all add: power_Suc)
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   129
apply (auto intro: mult_mono zero_le_power order_trans [of 0 a b])
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   130
done
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   131
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   132
lemma power_strict_mono [rule_format]:
15004
44ac09ba7213 ringpower to recpower
paulson
parents: 14738
diff changeset
   133
     "[|a < b; (0::'a::{recpower,ordered_semidom}) \<le> a|]
14577
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
   134
      ==> 0 < n --> a^n < b^n"
15251
bb6f072c8d10 converted some induct_tac to induct
paulson
parents: 15140
diff changeset
   135
apply (induct "n")
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   136
apply (auto simp add: mult_strict_mono zero_le_power power_Suc
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   137
                      order_le_less_trans [of 0 a b])
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   138
done
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   139
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   140
lemma power_eq_0_iff [simp]:
15004
44ac09ba7213 ringpower to recpower
paulson
parents: 14738
diff changeset
   141
     "(a^n = 0) = (a = (0::'a::{ordered_idom,recpower}) & 0<n)"
15251
bb6f072c8d10 converted some induct_tac to induct
paulson
parents: 15140
diff changeset
   142
apply (induct "n")
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   143
apply (auto simp add: power_Suc zero_neq_one [THEN not_sym])
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   144
done
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   145
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   146
lemma field_power_eq_0_iff [simp]:
15004
44ac09ba7213 ringpower to recpower
paulson
parents: 14738
diff changeset
   147
     "(a^n = 0) = (a = (0::'a::{field,recpower}) & 0<n)"
15251
bb6f072c8d10 converted some induct_tac to induct
paulson
parents: 15140
diff changeset
   148
apply (induct "n")
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   149
apply (auto simp add: power_Suc field_mult_eq_0_iff zero_neq_one[THEN not_sym])
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   150
done
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   151
15004
44ac09ba7213 ringpower to recpower
paulson
parents: 14738
diff changeset
   152
lemma field_power_not_zero: "a \<noteq> (0::'a::{field,recpower}) ==> a^n \<noteq> 0"
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   153
by force
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   154
14353
79f9fbef9106 Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents: 14348
diff changeset
   155
lemma nonzero_power_inverse:
15004
44ac09ba7213 ringpower to recpower
paulson
parents: 14738
diff changeset
   156
  "a \<noteq> 0 ==> inverse ((a::'a::{field,recpower}) ^ n) = (inverse a) ^ n"
15251
bb6f072c8d10 converted some induct_tac to induct
paulson
parents: 15140
diff changeset
   157
apply (induct "n")
14353
79f9fbef9106 Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents: 14348
diff changeset
   158
apply (auto simp add: power_Suc nonzero_inverse_mult_distrib mult_commute)
79f9fbef9106 Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents: 14348
diff changeset
   159
done
79f9fbef9106 Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents: 14348
diff changeset
   160
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   161
text{*Perhaps these should be simprules.*}
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   162
lemma power_inverse:
15004
44ac09ba7213 ringpower to recpower
paulson
parents: 14738
diff changeset
   163
  "inverse ((a::'a::{field,division_by_zero,recpower}) ^ n) = (inverse a) ^ n"
15251
bb6f072c8d10 converted some induct_tac to induct
paulson
parents: 15140
diff changeset
   164
apply (induct "n")
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   165
apply (auto simp add: power_Suc inverse_mult_distrib)
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   166
done
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   167
14577
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
   168
lemma nonzero_power_divide:
15004
44ac09ba7213 ringpower to recpower
paulson
parents: 14738
diff changeset
   169
    "b \<noteq> 0 ==> (a/b) ^ n = ((a::'a::{field,recpower}) ^ n) / (b ^ n)"
14353
79f9fbef9106 Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents: 14348
diff changeset
   170
by (simp add: divide_inverse power_mult_distrib nonzero_power_inverse)
79f9fbef9106 Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents: 14348
diff changeset
   171
14577
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
   172
lemma power_divide:
15004
44ac09ba7213 ringpower to recpower
paulson
parents: 14738
diff changeset
   173
    "(a/b) ^ n = ((a::'a::{field,division_by_zero,recpower}) ^ n / b ^ n)"
14353
79f9fbef9106 Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents: 14348
diff changeset
   174
apply (case_tac "b=0", simp add: power_0_left)
14577
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
   175
apply (rule nonzero_power_divide)
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
   176
apply assumption
14353
79f9fbef9106 Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents: 14348
diff changeset
   177
done
79f9fbef9106 Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents: 14348
diff changeset
   178
15004
44ac09ba7213 ringpower to recpower
paulson
parents: 14738
diff changeset
   179
lemma power_abs: "abs(a ^ n) = abs(a::'a::{ordered_idom,recpower}) ^ n"
15251
bb6f072c8d10 converted some induct_tac to induct
paulson
parents: 15140
diff changeset
   180
apply (induct "n")
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   181
apply (auto simp add: power_Suc abs_mult)
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   182
done
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   183
14353
79f9fbef9106 Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents: 14348
diff changeset
   184
lemma zero_less_power_abs_iff [simp]:
15004
44ac09ba7213 ringpower to recpower
paulson
parents: 14738
diff changeset
   185
     "(0 < (abs a)^n) = (a \<noteq> (0::'a::{ordered_idom,recpower}) | n=0)"
14353
79f9fbef9106 Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents: 14348
diff changeset
   186
proof (induct "n")
79f9fbef9106 Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents: 14348
diff changeset
   187
  case 0
79f9fbef9106 Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents: 14348
diff changeset
   188
    show ?case by (simp add: zero_less_one)
79f9fbef9106 Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents: 14348
diff changeset
   189
next
79f9fbef9106 Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents: 14348
diff changeset
   190
  case (Suc n)
79f9fbef9106 Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents: 14348
diff changeset
   191
    show ?case by (force simp add: prems power_Suc zero_less_mult_iff)
79f9fbef9106 Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents: 14348
diff changeset
   192
qed
79f9fbef9106 Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents: 14348
diff changeset
   193
79f9fbef9106 Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents: 14348
diff changeset
   194
lemma zero_le_power_abs [simp]:
15004
44ac09ba7213 ringpower to recpower
paulson
parents: 14738
diff changeset
   195
     "(0::'a::{ordered_idom,recpower}) \<le> (abs a)^n"
15251
bb6f072c8d10 converted some induct_tac to induct
paulson
parents: 15140
diff changeset
   196
apply (induct "n")
14353
79f9fbef9106 Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents: 14348
diff changeset
   197
apply (auto simp add: zero_le_one zero_le_power)
79f9fbef9106 Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents: 14348
diff changeset
   198
done
79f9fbef9106 Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents: 14348
diff changeset
   199
15004
44ac09ba7213 ringpower to recpower
paulson
parents: 14738
diff changeset
   200
lemma power_minus: "(-a) ^ n = (- 1)^n * (a::'a::{comm_ring_1,recpower}) ^ n"
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   201
proof -
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   202
  have "-a = (- 1) * a"  by (simp add: minus_mult_left [symmetric])
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   203
  thus ?thesis by (simp only: power_mult_distrib)
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   204
qed
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   205
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   206
text{*Lemma for @{text power_strict_decreasing}*}
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   207
lemma power_Suc_less:
15004
44ac09ba7213 ringpower to recpower
paulson
parents: 14738
diff changeset
   208
     "[|(0::'a::{ordered_semidom,recpower}) < a; a < 1|]
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   209
      ==> a * a^n < a^n"
15251
bb6f072c8d10 converted some induct_tac to induct
paulson
parents: 15140
diff changeset
   210
apply (induct n)
14577
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
   211
apply (auto simp add: power_Suc mult_strict_left_mono)
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   212
done
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   213
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   214
lemma power_strict_decreasing:
15004
44ac09ba7213 ringpower to recpower
paulson
parents: 14738
diff changeset
   215
     "[|n < N; 0 < a; a < (1::'a::{ordered_semidom,recpower})|]
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   216
      ==> a^N < a^n"
14577
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
   217
apply (erule rev_mp)
15251
bb6f072c8d10 converted some induct_tac to induct
paulson
parents: 15140
diff changeset
   218
apply (induct "N")
14577
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
   219
apply (auto simp add: power_Suc power_Suc_less less_Suc_eq)
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
   220
apply (rename_tac m)
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   221
apply (subgoal_tac "a * a^m < 1 * a^n", simp)
14577
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
   222
apply (rule mult_strict_mono)
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   223
apply (auto simp add: zero_le_power zero_less_one order_less_imp_le)
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   224
done
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   225
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   226
text{*Proof resembles that of @{text power_strict_decreasing}*}
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   227
lemma power_decreasing:
15004
44ac09ba7213 ringpower to recpower
paulson
parents: 14738
diff changeset
   228
     "[|n \<le> N; 0 \<le> a; a \<le> (1::'a::{ordered_semidom,recpower})|]
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   229
      ==> a^N \<le> a^n"
14577
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
   230
apply (erule rev_mp)
15251
bb6f072c8d10 converted some induct_tac to induct
paulson
parents: 15140
diff changeset
   231
apply (induct "N")
14577
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
   232
apply (auto simp add: power_Suc  le_Suc_eq)
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
   233
apply (rename_tac m)
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   234
apply (subgoal_tac "a * a^m \<le> 1 * a^n", simp)
14577
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
   235
apply (rule mult_mono)
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   236
apply (auto simp add: zero_le_power zero_le_one)
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   237
done
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   238
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   239
lemma power_Suc_less_one:
15004
44ac09ba7213 ringpower to recpower
paulson
parents: 14738
diff changeset
   240
     "[| 0 < a; a < (1::'a::{ordered_semidom,recpower}) |] ==> a ^ Suc n < 1"
14577
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
   241
apply (insert power_strict_decreasing [of 0 "Suc n" a], simp)
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   242
done
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   243
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   244
text{*Proof again resembles that of @{text power_strict_decreasing}*}
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   245
lemma power_increasing:
15004
44ac09ba7213 ringpower to recpower
paulson
parents: 14738
diff changeset
   246
     "[|n \<le> N; (1::'a::{ordered_semidom,recpower}) \<le> a|] ==> a^n \<le> a^N"
14577
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
   247
apply (erule rev_mp)
15251
bb6f072c8d10 converted some induct_tac to induct
paulson
parents: 15140
diff changeset
   248
apply (induct "N")
14577
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
   249
apply (auto simp add: power_Suc le_Suc_eq)
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   250
apply (rename_tac m)
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   251
apply (subgoal_tac "1 * a^n \<le> a * a^m", simp)
14577
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
   252
apply (rule mult_mono)
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   253
apply (auto simp add: order_trans [OF zero_le_one] zero_le_power)
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   254
done
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   255
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   256
text{*Lemma for @{text power_strict_increasing}*}
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   257
lemma power_less_power_Suc:
15004
44ac09ba7213 ringpower to recpower
paulson
parents: 14738
diff changeset
   258
     "(1::'a::{ordered_semidom,recpower}) < a ==> a^n < a * a^n"
15251
bb6f072c8d10 converted some induct_tac to induct
paulson
parents: 15140
diff changeset
   259
apply (induct n)
14577
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
   260
apply (auto simp add: power_Suc mult_strict_left_mono order_less_trans [OF zero_less_one])
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   261
done
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   262
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   263
lemma power_strict_increasing:
15004
44ac09ba7213 ringpower to recpower
paulson
parents: 14738
diff changeset
   264
     "[|n < N; (1::'a::{ordered_semidom,recpower}) < a|] ==> a^n < a^N"
14577
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
   265
apply (erule rev_mp)
15251
bb6f072c8d10 converted some induct_tac to induct
paulson
parents: 15140
diff changeset
   266
apply (induct "N")
14577
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
   267
apply (auto simp add: power_less_power_Suc power_Suc less_Suc_eq)
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   268
apply (rename_tac m)
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   269
apply (subgoal_tac "1 * a^n < a * a^m", simp)
14577
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
   270
apply (rule mult_strict_mono)
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   271
apply (auto simp add: order_less_trans [OF zero_less_one] zero_le_power
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   272
                 order_less_imp_le)
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   273
done
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   274
15066
d2f2b908e0a4 two new results
paulson
parents: 15004
diff changeset
   275
lemma power_increasing_iff [simp]: 
d2f2b908e0a4 two new results
paulson
parents: 15004
diff changeset
   276
     "1 < (b::'a::{ordered_semidom,recpower}) ==> (b ^ x \<le> b ^ y) = (x \<le> y)"
d2f2b908e0a4 two new results
paulson
parents: 15004
diff changeset
   277
  by (blast intro: power_le_imp_le_exp power_increasing order_less_imp_le) 
d2f2b908e0a4 two new results
paulson
parents: 15004
diff changeset
   278
d2f2b908e0a4 two new results
paulson
parents: 15004
diff changeset
   279
lemma power_strict_increasing_iff [simp]:
d2f2b908e0a4 two new results
paulson
parents: 15004
diff changeset
   280
     "1 < (b::'a::{ordered_semidom,recpower}) ==> (b ^ x < b ^ y) = (x < y)"
d2f2b908e0a4 two new results
paulson
parents: 15004
diff changeset
   281
  by (blast intro: power_less_imp_less_exp power_strict_increasing) 
d2f2b908e0a4 two new results
paulson
parents: 15004
diff changeset
   282
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   283
lemma power_le_imp_le_base:
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   284
  assumes le: "a ^ Suc n \<le> b ^ Suc n"
15004
44ac09ba7213 ringpower to recpower
paulson
parents: 14738
diff changeset
   285
      and xnonneg: "(0::'a::{ordered_semidom,recpower}) \<le> a"
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   286
      and ynonneg: "0 \<le> b"
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   287
  shows "a \<le> b"
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   288
 proof (rule ccontr)
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   289
   assume "~ a \<le> b"
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   290
   then have "b < a" by (simp only: linorder_not_le)
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   291
   then have "b ^ Suc n < a ^ Suc n"
14577
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
   292
     by (simp only: prems power_strict_mono)
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   293
   from le and this show "False"
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   294
      by (simp add: linorder_not_less [symmetric])
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   295
 qed
14577
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
   296
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   297
lemma power_inject_base:
14577
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
   298
     "[| a ^ Suc n = b ^ Suc n; 0 \<le> a; 0 \<le> b |]
15004
44ac09ba7213 ringpower to recpower
paulson
parents: 14738
diff changeset
   299
      ==> a = (b::'a::{ordered_semidom,recpower})"
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   300
by (blast intro: power_le_imp_le_base order_antisym order_eq_refl sym)
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   301
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   302
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   303
subsection{*Exponentiation for the Natural Numbers*}
3390
0c7625196d95 New theory "Power" of exponentiation (and binomial coefficients)
paulson
parents:
diff changeset
   304
8844
db71c334e854 named "op ^" definitions;
wenzelm
parents: 7843
diff changeset
   305
primrec (power)
3390
0c7625196d95 New theory "Power" of exponentiation (and binomial coefficients)
paulson
parents:
diff changeset
   306
  "p ^ 0 = 1"
0c7625196d95 New theory "Power" of exponentiation (and binomial coefficients)
paulson
parents:
diff changeset
   307
  "p ^ (Suc n) = (p::nat) * (p ^ n)"
14577
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
   308
15004
44ac09ba7213 ringpower to recpower
paulson
parents: 14738
diff changeset
   309
instance nat :: recpower
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   310
proof
14438
paulson
parents: 14353
diff changeset
   311
  fix z n :: nat
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   312
  show "z^0 = 1" by simp
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   313
  show "z^(Suc n) = z * (z^n)" by simp
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   314
qed
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   315
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   316
lemma nat_one_le_power [simp]: "1 \<le> i ==> Suc 0 \<le> i^n"
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   317
by (insert one_le_power [of i n], simp)
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   318
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   319
lemma le_imp_power_dvd: "!!i::nat. m \<le> n ==> i^m dvd i^n"
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   320
apply (unfold dvd_def)
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   321
apply (erule not_less_iff_le [THEN iffD2, THEN add_diff_inverse, THEN subst])
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   322
apply (simp add: power_add)
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   323
done
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   324
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   325
text{*Valid for the naturals, but what if @{text"0<i<1"}?
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   326
Premises cannot be weakened: consider the case where @{term "i=0"},
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   327
@{term "m=1"} and @{term "n=0"}.*}
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   328
lemma nat_power_less_imp_less: "!!i::nat. [| 0 < i; i^m < i^n |] ==> m < n"
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   329
apply (rule ccontr)
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   330
apply (drule leI [THEN le_imp_power_dvd, THEN dvd_imp_le, THEN leD])
14577
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
   331
apply (erule zero_less_power, auto)
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   332
done
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   333
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   334
lemma nat_zero_less_power_iff [simp]: "(0 < x^n) = (x \<noteq> (0::nat) | n=0)"
15251
bb6f072c8d10 converted some induct_tac to induct
paulson
parents: 15140
diff changeset
   335
by (induct "n", auto)
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   336
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   337
lemma power_le_dvd [rule_format]: "k^j dvd n --> i\<le>j --> k^i dvd (n::nat)"
15251
bb6f072c8d10 converted some induct_tac to induct
paulson
parents: 15140
diff changeset
   338
apply (induct "j")
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   339
apply (simp_all add: le_Suc_eq)
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   340
apply (blast dest!: dvd_mult_right)
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   341
done
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   342
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   343
lemma power_dvd_imp_le: "[|i^m dvd i^n;  (1::nat) < i|] ==> m \<le> n"
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   344
apply (rule power_le_imp_le_exp, assumption)
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   345
apply (erule dvd_imp_le, simp)
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   346
done
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   347
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   348
text{*ML bindings for the general exponentiation theorems*}
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   349
ML
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   350
{*
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   351
val power_0 = thm"power_0";
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   352
val power_Suc = thm"power_Suc";
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   353
val power_0_Suc = thm"power_0_Suc";
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   354
val power_0_left = thm"power_0_left";
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   355
val power_one = thm"power_one";
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   356
val power_one_right = thm"power_one_right";
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   357
val power_add = thm"power_add";
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   358
val power_mult = thm"power_mult";
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   359
val power_mult_distrib = thm"power_mult_distrib";
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   360
val zero_less_power = thm"zero_less_power";
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   361
val zero_le_power = thm"zero_le_power";
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   362
val one_le_power = thm"one_le_power";
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   363
val gt1_imp_ge0 = thm"gt1_imp_ge0";
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   364
val power_gt1_lemma = thm"power_gt1_lemma";
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   365
val power_gt1 = thm"power_gt1";
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   366
val power_le_imp_le_exp = thm"power_le_imp_le_exp";
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   367
val power_inject_exp = thm"power_inject_exp";
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   368
val power_less_imp_less_exp = thm"power_less_imp_less_exp";
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   369
val power_mono = thm"power_mono";
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   370
val power_strict_mono = thm"power_strict_mono";
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   371
val power_eq_0_iff = thm"power_eq_0_iff";
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   372
val field_power_eq_0_iff = thm"field_power_eq_0_iff";
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   373
val field_power_not_zero = thm"field_power_not_zero";
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   374
val power_inverse = thm"power_inverse";
14353
79f9fbef9106 Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents: 14348
diff changeset
   375
val nonzero_power_divide = thm"nonzero_power_divide";
79f9fbef9106 Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents: 14348
diff changeset
   376
val power_divide = thm"power_divide";
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   377
val power_abs = thm"power_abs";
14353
79f9fbef9106 Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents: 14348
diff changeset
   378
val zero_less_power_abs_iff = thm"zero_less_power_abs_iff";
79f9fbef9106 Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents: 14348
diff changeset
   379
val zero_le_power_abs = thm "zero_le_power_abs";
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   380
val power_minus = thm"power_minus";
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   381
val power_Suc_less = thm"power_Suc_less";
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   382
val power_strict_decreasing = thm"power_strict_decreasing";
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   383
val power_decreasing = thm"power_decreasing";
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   384
val power_Suc_less_one = thm"power_Suc_less_one";
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   385
val power_increasing = thm"power_increasing";
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   386
val power_strict_increasing = thm"power_strict_increasing";
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   387
val power_le_imp_le_base = thm"power_le_imp_le_base";
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   388
val power_inject_base = thm"power_inject_base";
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   389
*}
14577
dbb95b825244 tuned document;
wenzelm
parents: 14438
diff changeset
   390
14348
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   391
text{*ML bindings for the remaining theorems*}
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   392
ML
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   393
{*
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   394
val nat_one_le_power = thm"nat_one_le_power";
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   395
val le_imp_power_dvd = thm"le_imp_power_dvd";
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   396
val nat_power_less_imp_less = thm"nat_power_less_imp_less";
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   397
val nat_zero_less_power_iff = thm"nat_zero_less_power_iff";
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   398
val power_le_dvd = thm"power_le_dvd";
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   399
val power_dvd_imp_le = thm"power_dvd_imp_le";
744c868ee0b7 Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents: 8844
diff changeset
   400
*}
3390
0c7625196d95 New theory "Power" of exponentiation (and binomial coefficients)
paulson
parents:
diff changeset
   401
0c7625196d95 New theory "Power" of exponentiation (and binomial coefficients)
paulson
parents:
diff changeset
   402
end
0c7625196d95 New theory "Power" of exponentiation (and binomial coefficients)
paulson
parents:
diff changeset
   403