src/HOL/Hyperreal/NthRoot.thy
author huffman
Fri, 18 May 2007 17:35:07 +0200
changeset 23009 01c295dd4a36
parent 22968 7134874437ac
child 23042 492514b39956
permissions -rw-r--r--
Prove existence of nth roots using Intermediate Value Theorem
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12196
a3be6b3a9c0b new theories from Jacques Fleuriot
paulson
parents:
diff changeset
     1
(*  Title       : NthRoot.thy
a3be6b3a9c0b new theories from Jacques Fleuriot
paulson
parents:
diff changeset
     2
    Author      : Jacques D. Fleuriot
a3be6b3a9c0b new theories from Jacques Fleuriot
paulson
parents:
diff changeset
     3
    Copyright   : 1998  University of Cambridge
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14365
diff changeset
     4
    Conversion to Isar and new proofs by Lawrence C Paulson, 2004
12196
a3be6b3a9c0b new theories from Jacques Fleuriot
paulson
parents:
diff changeset
     5
*)
a3be6b3a9c0b new theories from Jacques Fleuriot
paulson
parents:
diff changeset
     6
22956
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
     7
header {* Nth Roots of Real Numbers *}
14324
c9c6832f9b22 converting Hyperreal/NthRoot to Isar
paulson
parents: 14268
diff changeset
     8
15131
c69542757a4d New theory header syntax.
nipkow
parents: 15085
diff changeset
     9
theory NthRoot
23009
01c295dd4a36 Prove existence of nth roots using Intermediate Value Theorem
huffman
parents: 22968
diff changeset
    10
imports SEQ Parity Deriv
15131
c69542757a4d New theory header syntax.
nipkow
parents: 15085
diff changeset
    11
begin
14324
c9c6832f9b22 converting Hyperreal/NthRoot to Isar
paulson
parents: 14268
diff changeset
    12
22956
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
    13
subsection {* Existence of Nth Root *}
20687
fedb901be392 move root and sqrt stuff from Transcendental to NthRoot
huffman
parents: 20515
diff changeset
    14
23009
01c295dd4a36 Prove existence of nth roots using Intermediate Value Theorem
huffman
parents: 22968
diff changeset
    15
text {* Existence follows from the Intermediate Value Theorem *}
14324
c9c6832f9b22 converting Hyperreal/NthRoot to Isar
paulson
parents: 14268
diff changeset
    16
23009
01c295dd4a36 Prove existence of nth roots using Intermediate Value Theorem
huffman
parents: 22968
diff changeset
    17
lemma realpow_pos_nth:
01c295dd4a36 Prove existence of nth roots using Intermediate Value Theorem
huffman
parents: 22968
diff changeset
    18
  assumes n: "0 < n"
01c295dd4a36 Prove existence of nth roots using Intermediate Value Theorem
huffman
parents: 22968
diff changeset
    19
  assumes a: "0 < a"
01c295dd4a36 Prove existence of nth roots using Intermediate Value Theorem
huffman
parents: 22968
diff changeset
    20
  shows "\<exists>r>0. r ^ n = (a::real)"
01c295dd4a36 Prove existence of nth roots using Intermediate Value Theorem
huffman
parents: 22968
diff changeset
    21
proof -
01c295dd4a36 Prove existence of nth roots using Intermediate Value Theorem
huffman
parents: 22968
diff changeset
    22
  have "\<exists>r\<ge>0. r \<le> (max 1 a) \<and> r ^ n = a"
01c295dd4a36 Prove existence of nth roots using Intermediate Value Theorem
huffman
parents: 22968
diff changeset
    23
  proof (rule IVT)
01c295dd4a36 Prove existence of nth roots using Intermediate Value Theorem
huffman
parents: 22968
diff changeset
    24
    show "0 ^ n \<le> a" using n a by (simp add: power_0_left)
01c295dd4a36 Prove existence of nth roots using Intermediate Value Theorem
huffman
parents: 22968
diff changeset
    25
    show "0 \<le> max 1 a" by simp
01c295dd4a36 Prove existence of nth roots using Intermediate Value Theorem
huffman
parents: 22968
diff changeset
    26
    from n have n1: "1 \<le> n" by simp
01c295dd4a36 Prove existence of nth roots using Intermediate Value Theorem
huffman
parents: 22968
diff changeset
    27
    have "a \<le> max 1 a ^ 1" by simp
01c295dd4a36 Prove existence of nth roots using Intermediate Value Theorem
huffman
parents: 22968
diff changeset
    28
    also have "max 1 a ^ 1 \<le> max 1 a ^ n"
01c295dd4a36 Prove existence of nth roots using Intermediate Value Theorem
huffman
parents: 22968
diff changeset
    29
      using n1 by (rule power_increasing, simp)
01c295dd4a36 Prove existence of nth roots using Intermediate Value Theorem
huffman
parents: 22968
diff changeset
    30
    finally show "a \<le> max 1 a ^ n" .
01c295dd4a36 Prove existence of nth roots using Intermediate Value Theorem
huffman
parents: 22968
diff changeset
    31
    show "\<forall>r. 0 \<le> r \<and> r \<le> max 1 a \<longrightarrow> isCont (\<lambda>x. x ^ n) r"
01c295dd4a36 Prove existence of nth roots using Intermediate Value Theorem
huffman
parents: 22968
diff changeset
    32
      by (simp add: isCont_power isCont_Id)
01c295dd4a36 Prove existence of nth roots using Intermediate Value Theorem
huffman
parents: 22968
diff changeset
    33
  qed
01c295dd4a36 Prove existence of nth roots using Intermediate Value Theorem
huffman
parents: 22968
diff changeset
    34
  then obtain r where r: "0 \<le> r \<and> r ^ n = a" by fast
01c295dd4a36 Prove existence of nth roots using Intermediate Value Theorem
huffman
parents: 22968
diff changeset
    35
  with n a have "r \<noteq> 0" by (auto simp add: power_0_left)
01c295dd4a36 Prove existence of nth roots using Intermediate Value Theorem
huffman
parents: 22968
diff changeset
    36
  with r have "0 < r \<and> r ^ n = a" by simp
01c295dd4a36 Prove existence of nth roots using Intermediate Value Theorem
huffman
parents: 22968
diff changeset
    37
  thus ?thesis ..
01c295dd4a36 Prove existence of nth roots using Intermediate Value Theorem
huffman
parents: 22968
diff changeset
    38
qed
14325
94ac3895822f removing real_of_posnat
paulson
parents: 14324
diff changeset
    39
23009
01c295dd4a36 Prove existence of nth roots using Intermediate Value Theorem
huffman
parents: 22968
diff changeset
    40
text {* Uniqueness of nth positive root *}
14324
c9c6832f9b22 converting Hyperreal/NthRoot to Isar
paulson
parents: 14268
diff changeset
    41
c9c6832f9b22 converting Hyperreal/NthRoot to Isar
paulson
parents: 14268
diff changeset
    42
lemma realpow_pos_nth_unique:
23009
01c295dd4a36 Prove existence of nth roots using Intermediate Value Theorem
huffman
parents: 22968
diff changeset
    43
  "\<lbrakk>0 < n; 0 < a\<rbrakk> \<Longrightarrow> \<exists>!r. 0 < r \<and> r ^ n = (a::real)"
14324
c9c6832f9b22 converting Hyperreal/NthRoot to Isar
paulson
parents: 14268
diff changeset
    44
apply (auto intro!: realpow_pos_nth)
23009
01c295dd4a36 Prove existence of nth roots using Intermediate Value Theorem
huffman
parents: 22968
diff changeset
    45
apply (rule_tac n=n in power_eq_imp_eq_base, simp_all)
14324
c9c6832f9b22 converting Hyperreal/NthRoot to Isar
paulson
parents: 14268
diff changeset
    46
done
c9c6832f9b22 converting Hyperreal/NthRoot to Isar
paulson
parents: 14268
diff changeset
    47
20687
fedb901be392 move root and sqrt stuff from Transcendental to NthRoot
huffman
parents: 20515
diff changeset
    48
subsection {* Nth Root *}
fedb901be392 move root and sqrt stuff from Transcendental to NthRoot
huffman
parents: 20515
diff changeset
    49
22956
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
    50
text {* We define roots of negative reals such that
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
    51
  @{term "root n (- x) = - root n x"}. This allows
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
    52
  us to omit side conditions from many theorems. *}
20687
fedb901be392 move root and sqrt stuff from Transcendental to NthRoot
huffman
parents: 20515
diff changeset
    53
22956
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
    54
definition
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
    55
  root :: "[nat, real] \<Rightarrow> real" where
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
    56
  "root n x = (if 0 < x then (THE u. 0 < u \<and> u ^ n = x) else
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
    57
               if x < 0 then - (THE u. 0 < u \<and> u ^ n = - x) else 0)"
20687
fedb901be392 move root and sqrt stuff from Transcendental to NthRoot
huffman
parents: 20515
diff changeset
    58
22956
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
    59
lemma real_root_zero [simp]: "root n 0 = 0"
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
    60
unfolding root_def by simp
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
    61
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
    62
lemma real_root_minus: "0 < n \<Longrightarrow> root n (- x) = - root n x"
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
    63
unfolding root_def by simp
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
    64
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
    65
lemma real_root_gt_zero: "\<lbrakk>0 < n; 0 < x\<rbrakk> \<Longrightarrow> 0 < root n x"
20687
fedb901be392 move root and sqrt stuff from Transcendental to NthRoot
huffman
parents: 20515
diff changeset
    66
apply (simp add: root_def)
22956
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
    67
apply (drule (1) realpow_pos_nth_unique)
20687
fedb901be392 move root and sqrt stuff from Transcendental to NthRoot
huffman
parents: 20515
diff changeset
    68
apply (erule theI' [THEN conjunct1])
fedb901be392 move root and sqrt stuff from Transcendental to NthRoot
huffman
parents: 20515
diff changeset
    69
done
fedb901be392 move root and sqrt stuff from Transcendental to NthRoot
huffman
parents: 20515
diff changeset
    70
22956
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
    71
lemma real_root_pow_pos: (* TODO: rename *)
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
    72
  "\<lbrakk>0 < n; 0 < x\<rbrakk> \<Longrightarrow> root n x ^ n = x"
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
    73
apply (simp add: root_def)
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
    74
apply (drule (1) realpow_pos_nth_unique)
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
    75
apply (erule theI' [THEN conjunct2])
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
    76
done
20687
fedb901be392 move root and sqrt stuff from Transcendental to NthRoot
huffman
parents: 20515
diff changeset
    77
22956
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
    78
lemma real_root_pow_pos2 [simp]: (* TODO: rename *)
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
    79
  "\<lbrakk>0 < n; 0 \<le> x\<rbrakk> \<Longrightarrow> root n x ^ n = x"
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
    80
by (auto simp add: order_le_less real_root_pow_pos)
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
    81
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
    82
lemma real_root_ge_zero: "\<lbrakk>0 < n; 0 \<le> x\<rbrakk> \<Longrightarrow> 0 \<le> root n x"
20687
fedb901be392 move root and sqrt stuff from Transcendental to NthRoot
huffman
parents: 20515
diff changeset
    83
by (auto simp add: order_le_less real_root_gt_zero)
fedb901be392 move root and sqrt stuff from Transcendental to NthRoot
huffman
parents: 20515
diff changeset
    84
22956
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
    85
lemma real_root_power_cancel: "\<lbrakk>0 < n; 0 \<le> x\<rbrakk> \<Longrightarrow> root n (x ^ n) = x"
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
    86
apply (subgoal_tac "0 \<le> x ^ n")
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
    87
apply (subgoal_tac "0 \<le> root n (x ^ n)")
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
    88
apply (subgoal_tac "root n (x ^ n) ^ n = x ^ n")
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
    89
apply (erule (3) power_eq_imp_eq_base)
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
    90
apply (erule (1) real_root_pow_pos2)
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
    91
apply (erule (1) real_root_ge_zero)
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
    92
apply (erule zero_le_power)
20687
fedb901be392 move root and sqrt stuff from Transcendental to NthRoot
huffman
parents: 20515
diff changeset
    93
done
fedb901be392 move root and sqrt stuff from Transcendental to NthRoot
huffman
parents: 20515
diff changeset
    94
22956
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
    95
lemma real_root_pos_unique:
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
    96
  "\<lbrakk>0 < n; 0 \<le> y; y ^ n = x\<rbrakk> \<Longrightarrow> root n x = y"
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
    97
by (erule subst, rule real_root_power_cancel)
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
    98
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
    99
lemma real_root_one [simp]: "0 < n \<Longrightarrow> root n 1 = 1"
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   100
by (simp add: real_root_pos_unique)
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   101
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   102
text {* Root function is strictly monotonic, hence injective *}
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   103
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   104
lemma real_root_less_mono_lemma:
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   105
  "\<lbrakk>0 < n; 0 \<le> x; x < y\<rbrakk> \<Longrightarrow> root n x < root n y"
22856
eb0e0582092a cleaned up
huffman
parents: 22721
diff changeset
   106
apply (subgoal_tac "0 \<le> y")
22956
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   107
apply (subgoal_tac "root n x ^ n < root n y ^ n")
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   108
apply (erule power_less_imp_less_base)
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   109
apply (erule (1) real_root_ge_zero)
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   110
apply simp
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   111
apply simp
22721
d9be18bd7a28 moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents: 22630
diff changeset
   112
done
d9be18bd7a28 moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents: 22630
diff changeset
   113
22956
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   114
lemma real_root_less_mono: "\<lbrakk>0 < n; x < y\<rbrakk> \<Longrightarrow> root n x < root n y"
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   115
apply (cases "0 \<le> x")
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   116
apply (erule (2) real_root_less_mono_lemma)
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   117
apply (cases "0 \<le> y")
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   118
apply (rule_tac y=0 in order_less_le_trans)
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   119
apply (subgoal_tac "0 < root n (- x)")
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   120
apply (simp add: real_root_minus)
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   121
apply (simp add: real_root_gt_zero)
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   122
apply (simp add: real_root_ge_zero)
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   123
apply (subgoal_tac "root n (- y) < root n (- x)")
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   124
apply (simp add: real_root_minus)
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   125
apply (simp add: real_root_less_mono_lemma)
22721
d9be18bd7a28 moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents: 22630
diff changeset
   126
done
d9be18bd7a28 moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents: 22630
diff changeset
   127
22956
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   128
lemma real_root_le_mono: "\<lbrakk>0 < n; x \<le> y\<rbrakk> \<Longrightarrow> root n x \<le> root n y"
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   129
by (auto simp add: order_le_less real_root_less_mono)
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   130
22721
d9be18bd7a28 moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents: 22630
diff changeset
   131
lemma real_root_less_iff [simp]:
22956
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   132
  "0 < n \<Longrightarrow> (root n x < root n y) = (x < y)"
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   133
apply (cases "x < y")
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   134
apply (simp add: real_root_less_mono)
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   135
apply (simp add: linorder_not_less real_root_le_mono)
22721
d9be18bd7a28 moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents: 22630
diff changeset
   136
done
d9be18bd7a28 moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents: 22630
diff changeset
   137
d9be18bd7a28 moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents: 22630
diff changeset
   138
lemma real_root_le_iff [simp]:
22956
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   139
  "0 < n \<Longrightarrow> (root n x \<le> root n y) = (x \<le> y)"
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   140
apply (cases "x \<le> y")
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   141
apply (simp add: real_root_le_mono)
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   142
apply (simp add: linorder_not_le real_root_less_mono)
22721
d9be18bd7a28 moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents: 22630
diff changeset
   143
done
d9be18bd7a28 moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents: 22630
diff changeset
   144
d9be18bd7a28 moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents: 22630
diff changeset
   145
lemma real_root_eq_iff [simp]:
22956
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   146
  "0 < n \<Longrightarrow> (root n x = root n y) = (x = y)"
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   147
by (simp add: order_eq_iff)
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   148
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   149
lemmas real_root_gt_0_iff [simp] = real_root_less_iff [where x=0, simplified]
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   150
lemmas real_root_lt_0_iff [simp] = real_root_less_iff [where y=0, simplified]
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   151
lemmas real_root_ge_0_iff [simp] = real_root_le_iff [where x=0, simplified]
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   152
lemmas real_root_le_0_iff [simp] = real_root_le_iff [where y=0, simplified]
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   153
lemmas real_root_eq_0_iff [simp] = real_root_eq_iff [where y=0, simplified]
22721
d9be18bd7a28 moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents: 22630
diff changeset
   154
22956
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   155
text {* Roots of multiplication and division *}
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   156
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   157
lemma real_root_mult_lemma:
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   158
  "\<lbrakk>0 < n; 0 \<le> x; 0 \<le> y\<rbrakk> \<Longrightarrow> root n (x * y) = root n x * root n y"
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   159
by (simp add: real_root_pos_unique mult_nonneg_nonneg power_mult_distrib)
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   160
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   161
lemma real_root_inverse_lemma:
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   162
  "\<lbrakk>0 < n; 0 \<le> x\<rbrakk> \<Longrightarrow> root n (inverse x) = inverse (root n x)"
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   163
by (simp add: real_root_pos_unique power_inverse [symmetric])
22721
d9be18bd7a28 moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents: 22630
diff changeset
   164
d9be18bd7a28 moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents: 22630
diff changeset
   165
lemma real_root_mult:
22956
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   166
  assumes n: "0 < n"
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   167
  shows "root n (x * y) = root n x * root n y"
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   168
proof (rule linorder_le_cases, rule_tac [!] linorder_le_cases)
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   169
  assume "0 \<le> x" and "0 \<le> y"
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   170
  thus ?thesis by (rule real_root_mult_lemma [OF n])
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   171
next
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   172
  assume "0 \<le> x" and "y \<le> 0"
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   173
  hence "0 \<le> x" and "0 \<le> - y" by simp_all
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   174
  hence "root n (x * - y) = root n x * root n (- y)"
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   175
    by (rule real_root_mult_lemma [OF n])
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   176
  thus ?thesis by (simp add: real_root_minus [OF n])
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   177
next
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   178
  assume "x \<le> 0" and "0 \<le> y"
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   179
  hence "0 \<le> - x" and "0 \<le> y" by simp_all
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   180
  hence "root n (- x * y) = root n (- x) * root n y"
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   181
    by (rule real_root_mult_lemma [OF n])
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   182
  thus ?thesis by (simp add: real_root_minus [OF n])
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   183
next
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   184
  assume "x \<le> 0" and "y \<le> 0"
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   185
  hence "0 \<le> - x" and "0 \<le> - y" by simp_all
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   186
  hence "root n (- x * - y) = root n (- x) * root n (- y)"
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   187
    by (rule real_root_mult_lemma [OF n])
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   188
  thus ?thesis by (simp add: real_root_minus [OF n])
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   189
qed
22721
d9be18bd7a28 moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents: 22630
diff changeset
   190
d9be18bd7a28 moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents: 22630
diff changeset
   191
lemma real_root_inverse:
22956
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   192
  assumes n: "0 < n"
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   193
  shows "root n (inverse x) = inverse (root n x)"
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   194
proof (rule linorder_le_cases)
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   195
  assume "0 \<le> x"
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   196
  thus ?thesis by (rule real_root_inverse_lemma [OF n])
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   197
next
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   198
  assume "x \<le> 0"
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   199
  hence "0 \<le> - x" by simp
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   200
  hence "root n (inverse (- x)) = inverse (root n (- x))"
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   201
    by (rule real_root_inverse_lemma [OF n])
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   202
  thus ?thesis by (simp add: real_root_minus [OF n])
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   203
qed
22721
d9be18bd7a28 moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents: 22630
diff changeset
   204
22956
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   205
lemma real_root_divide:
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   206
  "0 < n \<Longrightarrow> root n (x / y) = root n x / root n y"
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   207
by (simp add: divide_inverse real_root_mult real_root_inverse)
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   208
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   209
lemma real_root_power:
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   210
  "0 < n \<Longrightarrow> root n (x ^ k) = root n x ^ k"
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   211
by (induct k, simp_all add: real_root_mult)
22721
d9be18bd7a28 moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents: 22630
diff changeset
   212
22956
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   213
subsection {* Square Root *}
20687
fedb901be392 move root and sqrt stuff from Transcendental to NthRoot
huffman
parents: 20515
diff changeset
   214
22956
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   215
definition
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   216
  sqrt :: "real \<Rightarrow> real" where
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   217
  "sqrt = root 2"
20687
fedb901be392 move root and sqrt stuff from Transcendental to NthRoot
huffman
parents: 20515
diff changeset
   218
22956
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   219
lemma pos2: "0 < (2::nat)" by simp
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   220
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   221
lemma real_sqrt_unique: "\<lbrakk>y\<twosuperior> = x; 0 \<le> y\<rbrakk> \<Longrightarrow> sqrt x = y"
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   222
unfolding sqrt_def by (rule real_root_pos_unique [OF pos2])
20687
fedb901be392 move root and sqrt stuff from Transcendental to NthRoot
huffman
parents: 20515
diff changeset
   223
22956
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   224
lemma real_sqrt_abs [simp]: "sqrt (x\<twosuperior>) = \<bar>x\<bar>"
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   225
apply (rule real_sqrt_unique)
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   226
apply (rule power2_abs)
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   227
apply (rule abs_ge_zero)
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   228
done
20687
fedb901be392 move root and sqrt stuff from Transcendental to NthRoot
huffman
parents: 20515
diff changeset
   229
22956
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   230
lemma real_sqrt_pow2 [simp]: "0 \<le> x \<Longrightarrow> (sqrt x)\<twosuperior> = x"
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   231
unfolding sqrt_def by (rule real_root_pow_pos2 [OF pos2])
22856
eb0e0582092a cleaned up
huffman
parents: 22721
diff changeset
   232
22956
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   233
lemma real_sqrt_pow2_iff [simp]: "((sqrt x)\<twosuperior> = x) = (0 \<le> x)"
22856
eb0e0582092a cleaned up
huffman
parents: 22721
diff changeset
   234
apply (rule iffI)
eb0e0582092a cleaned up
huffman
parents: 22721
diff changeset
   235
apply (erule subst)
eb0e0582092a cleaned up
huffman
parents: 22721
diff changeset
   236
apply (rule zero_le_power2)
eb0e0582092a cleaned up
huffman
parents: 22721
diff changeset
   237
apply (erule real_sqrt_pow2)
20687
fedb901be392 move root and sqrt stuff from Transcendental to NthRoot
huffman
parents: 20515
diff changeset
   238
done
fedb901be392 move root and sqrt stuff from Transcendental to NthRoot
huffman
parents: 20515
diff changeset
   239
22956
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   240
lemma real_sqrt_zero [simp]: "sqrt 0 = 0"
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   241
unfolding sqrt_def by (rule real_root_zero)
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   242
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   243
lemma real_sqrt_one [simp]: "sqrt 1 = 1"
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   244
unfolding sqrt_def by (rule real_root_one [OF pos2])
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   245
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   246
lemma real_sqrt_minus: "sqrt (- x) = - sqrt x"
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   247
unfolding sqrt_def by (rule real_root_minus [OF pos2])
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   248
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   249
lemma real_sqrt_mult: "sqrt (x * y) = sqrt x * sqrt y"
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   250
unfolding sqrt_def by (rule real_root_mult [OF pos2])
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   251
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   252
lemma real_sqrt_inverse: "sqrt (inverse x) = inverse (sqrt x)"
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   253
unfolding sqrt_def by (rule real_root_inverse [OF pos2])
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   254
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   255
lemma real_sqrt_divide: "sqrt (x / y) = sqrt x / sqrt y"
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   256
unfolding sqrt_def by (rule real_root_divide [OF pos2])
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   257
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   258
lemma real_sqrt_power: "sqrt (x ^ k) = sqrt x ^ k"
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   259
unfolding sqrt_def by (rule real_root_power [OF pos2])
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   260
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   261
lemma real_sqrt_gt_zero: "0 < x \<Longrightarrow> 0 < sqrt x"
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   262
unfolding sqrt_def by (rule real_root_gt_zero [OF pos2])
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   263
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   264
lemma real_sqrt_ge_zero: "0 \<le> x \<Longrightarrow> 0 \<le> sqrt x"
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   265
unfolding sqrt_def by (rule real_root_ge_zero [OF pos2])
20687
fedb901be392 move root and sqrt stuff from Transcendental to NthRoot
huffman
parents: 20515
diff changeset
   266
22956
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   267
lemma real_sqrt_less_mono: "x < y \<Longrightarrow> sqrt x < sqrt y"
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   268
unfolding sqrt_def by (rule real_root_less_mono [OF pos2])
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   269
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   270
lemma real_sqrt_le_mono: "x \<le> y \<Longrightarrow> sqrt x \<le> sqrt y"
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   271
unfolding sqrt_def by (rule real_root_le_mono [OF pos2])
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   272
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   273
lemma real_sqrt_less_iff [simp]: "(sqrt x < sqrt y) = (x < y)"
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   274
unfolding sqrt_def by (rule real_root_less_iff [OF pos2])
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   275
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   276
lemma real_sqrt_le_iff [simp]: "(sqrt x \<le> sqrt y) = (x \<le> y)"
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   277
unfolding sqrt_def by (rule real_root_le_iff [OF pos2])
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   278
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   279
lemma real_sqrt_eq_iff [simp]: "(sqrt x = sqrt y) = (x = y)"
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   280
unfolding sqrt_def by (rule real_root_eq_iff [OF pos2])
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   281
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   282
lemmas real_sqrt_gt_0_iff [simp] = real_sqrt_less_iff [where x=0, simplified]
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   283
lemmas real_sqrt_lt_0_iff [simp] = real_sqrt_less_iff [where y=0, simplified]
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   284
lemmas real_sqrt_ge_0_iff [simp] = real_sqrt_le_iff [where x=0, simplified]
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   285
lemmas real_sqrt_le_0_iff [simp] = real_sqrt_le_iff [where y=0, simplified]
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   286
lemmas real_sqrt_eq_0_iff [simp] = real_sqrt_eq_iff [where y=0, simplified]
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   287
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   288
lemmas real_sqrt_gt_1_iff [simp] = real_sqrt_less_iff [where x=1, simplified]
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   289
lemmas real_sqrt_lt_1_iff [simp] = real_sqrt_less_iff [where y=1, simplified]
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   290
lemmas real_sqrt_ge_1_iff [simp] = real_sqrt_le_iff [where x=1, simplified]
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   291
lemmas real_sqrt_le_1_iff [simp] = real_sqrt_le_iff [where y=1, simplified]
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   292
lemmas real_sqrt_eq_1_iff [simp] = real_sqrt_eq_iff [where y=1, simplified]
20687
fedb901be392 move root and sqrt stuff from Transcendental to NthRoot
huffman
parents: 20515
diff changeset
   293
fedb901be392 move root and sqrt stuff from Transcendental to NthRoot
huffman
parents: 20515
diff changeset
   294
lemma not_real_square_gt_zero [simp]: "(~ (0::real) < x*x) = (x = 0)"
fedb901be392 move root and sqrt stuff from Transcendental to NthRoot
huffman
parents: 20515
diff changeset
   295
apply auto
fedb901be392 move root and sqrt stuff from Transcendental to NthRoot
huffman
parents: 20515
diff changeset
   296
apply (cut_tac x = x and y = 0 in linorder_less_linear)
fedb901be392 move root and sqrt stuff from Transcendental to NthRoot
huffman
parents: 20515
diff changeset
   297
apply (simp add: zero_less_mult_iff)
fedb901be392 move root and sqrt stuff from Transcendental to NthRoot
huffman
parents: 20515
diff changeset
   298
done
fedb901be392 move root and sqrt stuff from Transcendental to NthRoot
huffman
parents: 20515
diff changeset
   299
fedb901be392 move root and sqrt stuff from Transcendental to NthRoot
huffman
parents: 20515
diff changeset
   300
lemma real_sqrt_abs2 [simp]: "sqrt(x*x) = \<bar>x\<bar>"
22856
eb0e0582092a cleaned up
huffman
parents: 22721
diff changeset
   301
apply (subst power2_eq_square [symmetric])
20687
fedb901be392 move root and sqrt stuff from Transcendental to NthRoot
huffman
parents: 20515
diff changeset
   302
apply (rule real_sqrt_abs)
fedb901be392 move root and sqrt stuff from Transcendental to NthRoot
huffman
parents: 20515
diff changeset
   303
done
fedb901be392 move root and sqrt stuff from Transcendental to NthRoot
huffman
parents: 20515
diff changeset
   304
fedb901be392 move root and sqrt stuff from Transcendental to NthRoot
huffman
parents: 20515
diff changeset
   305
lemma real_sqrt_pow2_gt_zero: "0 < x ==> 0 < (sqrt x)\<twosuperior>"
22956
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   306
by simp (* TODO: delete *)
20687
fedb901be392 move root and sqrt stuff from Transcendental to NthRoot
huffman
parents: 20515
diff changeset
   307
fedb901be392 move root and sqrt stuff from Transcendental to NthRoot
huffman
parents: 20515
diff changeset
   308
lemma real_sqrt_not_eq_zero: "0 < x ==> sqrt x \<noteq> 0"
22956
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   309
by simp (* TODO: delete *)
20687
fedb901be392 move root and sqrt stuff from Transcendental to NthRoot
huffman
parents: 20515
diff changeset
   310
fedb901be392 move root and sqrt stuff from Transcendental to NthRoot
huffman
parents: 20515
diff changeset
   311
lemma real_inv_sqrt_pow2: "0 < x ==> inverse (sqrt(x)) ^ 2 = inverse x"
22856
eb0e0582092a cleaned up
huffman
parents: 22721
diff changeset
   312
by (simp add: power_inverse [symmetric])
20687
fedb901be392 move root and sqrt stuff from Transcendental to NthRoot
huffman
parents: 20515
diff changeset
   313
fedb901be392 move root and sqrt stuff from Transcendental to NthRoot
huffman
parents: 20515
diff changeset
   314
lemma real_sqrt_eq_zero_cancel: "[| 0 \<le> x; sqrt(x) = 0|] ==> x = 0"
22956
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   315
by simp
20687
fedb901be392 move root and sqrt stuff from Transcendental to NthRoot
huffman
parents: 20515
diff changeset
   316
fedb901be392 move root and sqrt stuff from Transcendental to NthRoot
huffman
parents: 20515
diff changeset
   317
lemma real_sqrt_ge_one: "1 \<le> x ==> 1 \<le> sqrt x"
22956
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   318
by simp
20687
fedb901be392 move root and sqrt stuff from Transcendental to NthRoot
huffman
parents: 20515
diff changeset
   319
22443
346729a55460 move sqrt_divide_self_eq to NthRoot.thy
huffman
parents: 21865
diff changeset
   320
lemma sqrt_divide_self_eq:
346729a55460 move sqrt_divide_self_eq to NthRoot.thy
huffman
parents: 21865
diff changeset
   321
  assumes nneg: "0 \<le> x"
346729a55460 move sqrt_divide_self_eq to NthRoot.thy
huffman
parents: 21865
diff changeset
   322
  shows "sqrt x / x = inverse (sqrt x)"
346729a55460 move sqrt_divide_self_eq to NthRoot.thy
huffman
parents: 21865
diff changeset
   323
proof cases
346729a55460 move sqrt_divide_self_eq to NthRoot.thy
huffman
parents: 21865
diff changeset
   324
  assume "x=0" thus ?thesis by simp
346729a55460 move sqrt_divide_self_eq to NthRoot.thy
huffman
parents: 21865
diff changeset
   325
next
346729a55460 move sqrt_divide_self_eq to NthRoot.thy
huffman
parents: 21865
diff changeset
   326
  assume nz: "x\<noteq>0" 
346729a55460 move sqrt_divide_self_eq to NthRoot.thy
huffman
parents: 21865
diff changeset
   327
  hence pos: "0<x" using nneg by arith
346729a55460 move sqrt_divide_self_eq to NthRoot.thy
huffman
parents: 21865
diff changeset
   328
  show ?thesis
346729a55460 move sqrt_divide_self_eq to NthRoot.thy
huffman
parents: 21865
diff changeset
   329
  proof (rule right_inverse_eq [THEN iffD1, THEN sym]) 
346729a55460 move sqrt_divide_self_eq to NthRoot.thy
huffman
parents: 21865
diff changeset
   330
    show "sqrt x / x \<noteq> 0" by (simp add: divide_inverse nneg nz) 
346729a55460 move sqrt_divide_self_eq to NthRoot.thy
huffman
parents: 21865
diff changeset
   331
    show "inverse (sqrt x) / (sqrt x / x) = 1"
346729a55460 move sqrt_divide_self_eq to NthRoot.thy
huffman
parents: 21865
diff changeset
   332
      by (simp add: divide_inverse mult_assoc [symmetric] 
346729a55460 move sqrt_divide_self_eq to NthRoot.thy
huffman
parents: 21865
diff changeset
   333
                  power2_eq_square [symmetric] real_inv_sqrt_pow2 pos nz) 
346729a55460 move sqrt_divide_self_eq to NthRoot.thy
huffman
parents: 21865
diff changeset
   334
  qed
346729a55460 move sqrt_divide_self_eq to NthRoot.thy
huffman
parents: 21865
diff changeset
   335
qed
346729a55460 move sqrt_divide_self_eq to NthRoot.thy
huffman
parents: 21865
diff changeset
   336
22721
d9be18bd7a28 moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents: 22630
diff changeset
   337
lemma real_divide_square_eq [simp]: "(((r::real) * a) / (r * r)) = a / r"
d9be18bd7a28 moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents: 22630
diff changeset
   338
apply (simp add: divide_inverse)
d9be18bd7a28 moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents: 22630
diff changeset
   339
apply (case_tac "r=0")
d9be18bd7a28 moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents: 22630
diff changeset
   340
apply (auto simp add: mult_ac)
d9be18bd7a28 moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents: 22630
diff changeset
   341
done
d9be18bd7a28 moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents: 22630
diff changeset
   342
22856
eb0e0582092a cleaned up
huffman
parents: 22721
diff changeset
   343
subsection {* Square Root of Sum of Squares *}
eb0e0582092a cleaned up
huffman
parents: 22721
diff changeset
   344
eb0e0582092a cleaned up
huffman
parents: 22721
diff changeset
   345
lemma real_sqrt_mult_self_sum_ge_zero [simp]: "0 \<le> sqrt(x*x + y*y)"
22968
huffman
parents: 22961
diff changeset
   346
by (rule real_sqrt_ge_zero [OF sum_squares_ge_zero])
22856
eb0e0582092a cleaned up
huffman
parents: 22721
diff changeset
   347
eb0e0582092a cleaned up
huffman
parents: 22721
diff changeset
   348
lemma real_sqrt_sum_squares_ge_zero [simp]: "0 \<le> sqrt (x\<twosuperior> + y\<twosuperior>)"
22961
e499ded5d0fc remove redundant lemmas
huffman
parents: 22956
diff changeset
   349
by simp
22856
eb0e0582092a cleaned up
huffman
parents: 22721
diff changeset
   350
eb0e0582092a cleaned up
huffman
parents: 22721
diff changeset
   351
lemma real_sqrt_sum_squares_mult_ge_zero [simp]:
eb0e0582092a cleaned up
huffman
parents: 22721
diff changeset
   352
     "0 \<le> sqrt ((x\<twosuperior> + y\<twosuperior>)*(xa\<twosuperior> + ya\<twosuperior>))"
eb0e0582092a cleaned up
huffman
parents: 22721
diff changeset
   353
by (auto intro!: real_sqrt_ge_zero simp add: zero_le_mult_iff)
eb0e0582092a cleaned up
huffman
parents: 22721
diff changeset
   354
eb0e0582092a cleaned up
huffman
parents: 22721
diff changeset
   355
lemma real_sqrt_sum_squares_mult_squared_eq [simp]:
eb0e0582092a cleaned up
huffman
parents: 22721
diff changeset
   356
     "sqrt ((x\<twosuperior> + y\<twosuperior>) * (xa\<twosuperior> + ya\<twosuperior>)) ^ 2 = (x\<twosuperior> + y\<twosuperior>) * (xa\<twosuperior> + ya\<twosuperior>)"
22956
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   357
by (auto simp add: zero_le_mult_iff)
22856
eb0e0582092a cleaned up
huffman
parents: 22721
diff changeset
   358
eb0e0582092a cleaned up
huffman
parents: 22721
diff changeset
   359
lemma real_sqrt_sum_squares_ge1 [simp]: "x \<le> sqrt(x\<twosuperior> + y\<twosuperior>)"
eb0e0582092a cleaned up
huffman
parents: 22721
diff changeset
   360
by (rule power2_le_imp_le, simp_all)
eb0e0582092a cleaned up
huffman
parents: 22721
diff changeset
   361
eb0e0582092a cleaned up
huffman
parents: 22721
diff changeset
   362
lemma real_sqrt_sum_squares_ge2 [simp]: "y \<le> sqrt(x\<twosuperior> + y\<twosuperior>)"
eb0e0582092a cleaned up
huffman
parents: 22721
diff changeset
   363
by (rule power2_le_imp_le, simp_all)
eb0e0582092a cleaned up
huffman
parents: 22721
diff changeset
   364
22858
5ca5d1cce388 add lemma real_sqrt_sum_squares_triangle_ineq
huffman
parents: 22856
diff changeset
   365
lemma power2_sum:
5ca5d1cce388 add lemma real_sqrt_sum_squares_triangle_ineq
huffman
parents: 22856
diff changeset
   366
  fixes x y :: "'a::{number_ring,recpower}"
5ca5d1cce388 add lemma real_sqrt_sum_squares_triangle_ineq
huffman
parents: 22856
diff changeset
   367
  shows "(x + y)\<twosuperior> = x\<twosuperior> + y\<twosuperior> + 2 * x * y"
5ca5d1cce388 add lemma real_sqrt_sum_squares_triangle_ineq
huffman
parents: 22856
diff changeset
   368
by (simp add: left_distrib right_distrib power2_eq_square)
5ca5d1cce388 add lemma real_sqrt_sum_squares_triangle_ineq
huffman
parents: 22856
diff changeset
   369
5ca5d1cce388 add lemma real_sqrt_sum_squares_triangle_ineq
huffman
parents: 22856
diff changeset
   370
lemma power2_diff:
5ca5d1cce388 add lemma real_sqrt_sum_squares_triangle_ineq
huffman
parents: 22856
diff changeset
   371
  fixes x y :: "'a::{number_ring,recpower}"
5ca5d1cce388 add lemma real_sqrt_sum_squares_triangle_ineq
huffman
parents: 22856
diff changeset
   372
  shows "(x - y)\<twosuperior> = x\<twosuperior> + y\<twosuperior> - 2 * x * y"
5ca5d1cce388 add lemma real_sqrt_sum_squares_triangle_ineq
huffman
parents: 22856
diff changeset
   373
by (simp add: left_diff_distrib right_diff_distrib power2_eq_square)
5ca5d1cce388 add lemma real_sqrt_sum_squares_triangle_ineq
huffman
parents: 22856
diff changeset
   374
5ca5d1cce388 add lemma real_sqrt_sum_squares_triangle_ineq
huffman
parents: 22856
diff changeset
   375
lemma real_sqrt_sum_squares_triangle_ineq:
5ca5d1cce388 add lemma real_sqrt_sum_squares_triangle_ineq
huffman
parents: 22856
diff changeset
   376
  "sqrt ((a + c)\<twosuperior> + (b + d)\<twosuperior>) \<le> sqrt (a\<twosuperior> + b\<twosuperior>) + sqrt (c\<twosuperior> + d\<twosuperior>)"
5ca5d1cce388 add lemma real_sqrt_sum_squares_triangle_ineq
huffman
parents: 22856
diff changeset
   377
apply (rule power2_le_imp_le, simp)
5ca5d1cce388 add lemma real_sqrt_sum_squares_triangle_ineq
huffman
parents: 22856
diff changeset
   378
apply (simp add: power2_sum)
5ca5d1cce388 add lemma real_sqrt_sum_squares_triangle_ineq
huffman
parents: 22856
diff changeset
   379
apply (simp only: mult_assoc right_distrib [symmetric])
5ca5d1cce388 add lemma real_sqrt_sum_squares_triangle_ineq
huffman
parents: 22856
diff changeset
   380
apply (rule mult_left_mono)
5ca5d1cce388 add lemma real_sqrt_sum_squares_triangle_ineq
huffman
parents: 22856
diff changeset
   381
apply (rule power2_le_imp_le)
5ca5d1cce388 add lemma real_sqrt_sum_squares_triangle_ineq
huffman
parents: 22856
diff changeset
   382
apply (simp add: power2_sum power_mult_distrib)
5ca5d1cce388 add lemma real_sqrt_sum_squares_triangle_ineq
huffman
parents: 22856
diff changeset
   383
apply (simp add: ring_distrib)
5ca5d1cce388 add lemma real_sqrt_sum_squares_triangle_ineq
huffman
parents: 22856
diff changeset
   384
apply (subgoal_tac "0 \<le> b\<twosuperior> * c\<twosuperior> + a\<twosuperior> * d\<twosuperior> - 2 * (a * c) * (b * d)", simp)
5ca5d1cce388 add lemma real_sqrt_sum_squares_triangle_ineq
huffman
parents: 22856
diff changeset
   385
apply (rule_tac b="(a * d - b * c)\<twosuperior>" in ord_le_eq_trans)
5ca5d1cce388 add lemma real_sqrt_sum_squares_triangle_ineq
huffman
parents: 22856
diff changeset
   386
apply (rule zero_le_power2)
5ca5d1cce388 add lemma real_sqrt_sum_squares_triangle_ineq
huffman
parents: 22856
diff changeset
   387
apply (simp add: power2_diff power_mult_distrib)
5ca5d1cce388 add lemma real_sqrt_sum_squares_triangle_ineq
huffman
parents: 22856
diff changeset
   388
apply (simp add: mult_nonneg_nonneg)
5ca5d1cce388 add lemma real_sqrt_sum_squares_triangle_ineq
huffman
parents: 22856
diff changeset
   389
apply simp
5ca5d1cce388 add lemma real_sqrt_sum_squares_triangle_ineq
huffman
parents: 22856
diff changeset
   390
apply (simp add: add_increasing)
5ca5d1cce388 add lemma real_sqrt_sum_squares_triangle_ineq
huffman
parents: 22856
diff changeset
   391
done
5ca5d1cce388 add lemma real_sqrt_sum_squares_triangle_ineq
huffman
parents: 22856
diff changeset
   392
22956
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   393
text "Legacy theorem names:"
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   394
lemmas real_root_pos2 = real_root_power_cancel
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   395
lemmas real_root_pos_pos = real_root_gt_zero [THEN order_less_imp_le]
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   396
lemmas real_root_pos_pos_le = real_root_ge_zero
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   397
lemmas real_sqrt_mult_distrib = real_sqrt_mult
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   398
lemmas real_sqrt_mult_distrib2 = real_sqrt_mult
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   399
lemmas real_sqrt_eq_zero_cancel_iff = real_sqrt_eq_0_iff
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   400
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   401
(* needed for CauchysMeanTheorem.het_base from AFP *)
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   402
lemma real_root_pos: "0 < x \<Longrightarrow> root (Suc n) (x ^ (Suc n)) = x"
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   403
by (rule real_root_power_cancel [OF zero_less_Suc order_less_imp_le])
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   404
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   405
(* FIXME: the stronger version of real_root_less_iff
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   406
 breaks CauchysMeanTheorem.list_gmean_gt_iff from AFP. *)
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   407
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   408
declare real_root_less_iff [simp del]
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   409
lemma real_root_less_iff_nonneg [simp]:
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   410
  "\<lbrakk>0 < n; 0 \<le> x; 0 \<le> y\<rbrakk> \<Longrightarrow> (root n x < root n y) = (x < y)"
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   411
by (rule real_root_less_iff)
617140080e6a define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents: 22943
diff changeset
   412
14324
c9c6832f9b22 converting Hyperreal/NthRoot to Isar
paulson
parents: 14268
diff changeset
   413
end