src/HOL/Nat_Numeral.thy
changeset 30960 fec1a04b7220
parent 30925 c38cbc0ac8d1
child 31002 bc4117fe72ab
equal deleted inserted replaced
30959:458e55fd0a33 30960:fec1a04b7220
    26 
    26 
    27 lemma [code post]:
    27 lemma [code post]:
    28   "nat (number_of v) = number_of v"
    28   "nat (number_of v) = number_of v"
    29   unfolding nat_number_of_def ..
    29   unfolding nat_number_of_def ..
    30 
    30 
       
    31 context recpower
       
    32 begin
       
    33 
    31 abbreviation (xsymbols)
    34 abbreviation (xsymbols)
    32   power2 :: "'a::power => 'a"  ("(_\<twosuperior>)" [1000] 999) where
    35   power2 :: "'a \<Rightarrow> 'a"  ("(_\<twosuperior>)" [1000] 999) where
    33   "x\<twosuperior> == x^2"
    36   "x\<twosuperior> \<equiv> x ^ 2"
    34 
    37 
    35 notation (latex output)
    38 notation (latex output)
    36   power2  ("(_\<twosuperior>)" [1000] 999)
    39   power2  ("(_\<twosuperior>)" [1000] 999)
    37 
    40 
    38 notation (HTML output)
    41 notation (HTML output)
    39   power2  ("(_\<twosuperior>)" [1000] 999)
    42   power2  ("(_\<twosuperior>)" [1000] 999)
       
    43 
       
    44 end
    40 
    45 
    41 
    46 
    42 subsection {* Predicate for negative binary numbers *}
    47 subsection {* Predicate for negative binary numbers *}
    43 
    48 
    44 definition neg  :: "int \<Rightarrow> bool" where
    49 definition neg  :: "int \<Rightarrow> bool" where
   395 
   400 
   396 lemma power_odd_eq: "(a::int) ^ Suc(2*n) = a * (a^n)^2"
   401 lemma power_odd_eq: "(a::int) ^ Suc(2*n) = a * (a^n)^2"
   397 by (simp add: power_even_eq) 
   402 by (simp add: power_even_eq) 
   398 
   403 
   399 lemma power_minus_even [simp]:
   404 lemma power_minus_even [simp]:
   400      "(-a) ^ (2*n) = (a::'a::{comm_ring_1,recpower}) ^ (2*n)"
   405   "(-a) ^ (2*n) = (a::'a::{comm_ring_1,recpower}) ^ (2*n)"
   401 by (simp add: power_minus1_even power_minus [of a]) 
   406   by (simp add: power_minus [of a]) 
   402 
   407 
   403 lemma zero_le_even_power'[simp]:
   408 lemma zero_le_even_power'[simp]:
   404      "0 \<le> (a::'a::{ordered_idom,recpower}) ^ (2*n)"
   409      "0 \<le> (a::'a::{ordered_idom,recpower}) ^ (2*n)"
   405 proof (induct "n")
   410 proof (induct "n")
   406   case 0
   411   case 0