src/HOL/Integ/IntPower.ML
author kleing
Tue, 13 May 2003 08:59:21 +0200
changeset 14024 213dcc39358f
parent 12196 a3be6b3a9c0b
permissions -rw-r--r--
HOL-Real -> HOL-Complex
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9509
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents:
diff changeset
     1
(*  Title:	IntPower.thy
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents:
diff changeset
     2
    ID:         $Id$
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents:
diff changeset
     3
    Author:	Thomas M. Rasmussen
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents:
diff changeset
     4
    Copyright	2000  University of Cambridge
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents:
diff changeset
     5
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents:
diff changeset
     6
Integer powers 
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents:
diff changeset
     7
*)
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents:
diff changeset
     8
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents:
diff changeset
     9
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents:
diff changeset
    10
Goal "((x::int) mod m)^y mod m = x^y mod m";
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents:
diff changeset
    11
by (induct_tac "y" 1);
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents:
diff changeset
    12
by Auto_tac;
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents:
diff changeset
    13
by (rtac (zmod_zmult1_eq RS trans) 1);
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents:
diff changeset
    14
by (Asm_simp_tac 1);
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents:
diff changeset
    15
by (rtac (zmod_zmult_distrib RS sym) 1);
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents:
diff changeset
    16
qed "zpower_zmod";
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents:
diff changeset
    17
11868
56db9f3a6b3e Numerals now work for the integers: the binary numerals for 0 and 1 rewrite
paulson
parents: 11701
diff changeset
    18
Goal "1^y = (1::int)";
9509
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents:
diff changeset
    19
by (induct_tac "y" 1);
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents:
diff changeset
    20
by Auto_tac;
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents:
diff changeset
    21
qed "zpower_1";
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents:
diff changeset
    22
Addsimps [zpower_1];
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents:
diff changeset
    23
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents:
diff changeset
    24
Goal "(x*z)^y = ((x^y)*(z^y)::int)";
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents:
diff changeset
    25
by (induct_tac "y" 1);
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents:
diff changeset
    26
by Auto_tac;
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents:
diff changeset
    27
qed "zpower_zmult_distrib";
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents:
diff changeset
    28
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents:
diff changeset
    29
Goal "x^(y+z) = ((x^y)*(x^z)::int)";
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents:
diff changeset
    30
by (induct_tac "y" 1);
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents:
diff changeset
    31
by Auto_tac;
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents:
diff changeset
    32
qed "zpower_zadd_distrib";
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents:
diff changeset
    33
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents:
diff changeset
    34
Goal "(x^y)^z = (x^(y*z)::int)";
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents:
diff changeset
    35
by (induct_tac "y" 1);
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents:
diff changeset
    36
by Auto_tac;
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents:
diff changeset
    37
by (stac zpower_zmult_distrib 1);
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents:
diff changeset
    38
by (stac zpower_zadd_distrib 1);
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents:
diff changeset
    39
by (Asm_simp_tac 1);
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents:
diff changeset
    40
qed "zpower_zpower";
0f3ee1f89ca8 introduction of integer exponentiation
paulson
parents:
diff changeset
    41
12196
a3be6b3a9c0b new theories from Jacques Fleuriot
paulson
parents: 11868
diff changeset
    42
a3be6b3a9c0b new theories from Jacques Fleuriot
paulson
parents: 11868
diff changeset
    43
(*** Logical equivalences for inequalities ***)
a3be6b3a9c0b new theories from Jacques Fleuriot
paulson
parents: 11868
diff changeset
    44
a3be6b3a9c0b new theories from Jacques Fleuriot
paulson
parents: 11868
diff changeset
    45
Goal "(x^n = 0) = (x = (0::int) & 0<n)";
a3be6b3a9c0b new theories from Jacques Fleuriot
paulson
parents: 11868
diff changeset
    46
by (induct_tac "n" 1);
a3be6b3a9c0b new theories from Jacques Fleuriot
paulson
parents: 11868
diff changeset
    47
by Auto_tac; 
a3be6b3a9c0b new theories from Jacques Fleuriot
paulson
parents: 11868
diff changeset
    48
qed "zpower_eq_0_iff";
a3be6b3a9c0b new theories from Jacques Fleuriot
paulson
parents: 11868
diff changeset
    49
Addsimps [zpower_eq_0_iff];
a3be6b3a9c0b new theories from Jacques Fleuriot
paulson
parents: 11868
diff changeset
    50
a3be6b3a9c0b new theories from Jacques Fleuriot
paulson
parents: 11868
diff changeset
    51
Goal "(0 < (abs x)^n) = (x ~= (0::int) | n=0)";
a3be6b3a9c0b new theories from Jacques Fleuriot
paulson
parents: 11868
diff changeset
    52
by (induct_tac "n" 1);
a3be6b3a9c0b new theories from Jacques Fleuriot
paulson
parents: 11868
diff changeset
    53
by (auto_tac (claset(), simpset() addsimps [int_0_less_mult_iff]));  
a3be6b3a9c0b new theories from Jacques Fleuriot
paulson
parents: 11868
diff changeset
    54
qed "zero_less_zpower_abs_iff";
a3be6b3a9c0b new theories from Jacques Fleuriot
paulson
parents: 11868
diff changeset
    55
Addsimps [zero_less_zpower_abs_iff];
a3be6b3a9c0b new theories from Jacques Fleuriot
paulson
parents: 11868
diff changeset
    56
a3be6b3a9c0b new theories from Jacques Fleuriot
paulson
parents: 11868
diff changeset
    57
Goal "(0::int) <= (abs x)^n";
a3be6b3a9c0b new theories from Jacques Fleuriot
paulson
parents: 11868
diff changeset
    58
by (induct_tac "n" 1);
a3be6b3a9c0b new theories from Jacques Fleuriot
paulson
parents: 11868
diff changeset
    59
by (auto_tac (claset(), simpset() addsimps [int_0_le_mult_iff]));  
a3be6b3a9c0b new theories from Jacques Fleuriot
paulson
parents: 11868
diff changeset
    60
qed "zero_le_zpower_abs";
a3be6b3a9c0b new theories from Jacques Fleuriot
paulson
parents: 11868
diff changeset
    61
Addsimps [zero_le_zpower_abs];