src/HOL/Integ/IntArith.thy
author aspinall
Sat, 17 Feb 2007 18:01:22 +0100
changeset 22338 c7feeba2249e
parent 22242 020f65c2cdab
child 22801 caffcb450ef4
permissions -rw-r--r--
Updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14259
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
     1
(*  Title:      HOL/Integ/IntArith.thy
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
     2
    ID:         $Id$
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
     3
    Authors:    Larry Paulson and Tobias Nipkow
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
     4
*)
12023
wenzelm
parents: 11868
diff changeset
     5
wenzelm
parents: 11868
diff changeset
     6
header {* Integer arithmetic *}
wenzelm
parents: 11868
diff changeset
     7
15131
c69542757a4d New theory header syntax.
nipkow
parents: 15013
diff changeset
     8
theory IntArith
22059
f72cdc0a0af4 well-founded relations for the integers
paulson
parents: 21911
diff changeset
     9
imports Numeral "../Wellfounded_Relations"
16417
9bc16273c2d4 migrated theory headers to new format
haftmann
parents: 16413
diff changeset
    10
uses ("int_arith1.ML")
15131
c69542757a4d New theory header syntax.
nipkow
parents: 15013
diff changeset
    11
begin
9436
62bb04ab4b01 rearranged setup of arithmetic procedures, avoiding global reference values;
wenzelm
parents: 9214
diff changeset
    12
14387
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    13
text{*Duplicate: can't understand why it's necessary*}
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    14
declare numeral_0_eq_0 [simp]
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    15
16413
47ffc49c7d7b a few new integer lemmas
paulson
parents: 15234
diff changeset
    16
14387
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    17
subsection{*Instantiating Binary Arithmetic for the Integers*}
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    18
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    19
instance int :: number_ring
21820
2f2b6a965ccc introduced mk/dest_numeral/number for mk/dest_binum etc.
haftmann
parents: 21191
diff changeset
    20
  int_number_of_def: "number_of w \<equiv> of_int w"
2f2b6a965ccc introduced mk/dest_numeral/number for mk/dest_binum etc.
haftmann
parents: 21191
diff changeset
    21
  by intro_classes (simp only: int_number_of_def)
14387
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    22
14353
79f9fbef9106 Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents: 14295
diff changeset
    23
14272
5efbb548107d Tidying of the integer development; towards removing the
paulson
parents: 14271
diff changeset
    24
subsection{*Inequality Reasoning for the Arithmetic Simproc*}
5efbb548107d Tidying of the integer development; towards removing the
paulson
parents: 14271
diff changeset
    25
14387
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    26
lemma add_numeral_0: "Numeral0 + a = (a::'a::number_ring)"
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    27
by simp 
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    28
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    29
lemma add_numeral_0_right: "a + Numeral0 = (a::'a::number_ring)"
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    30
by simp
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    31
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    32
lemma mult_numeral_1: "Numeral1 * a = (a::'a::number_ring)"
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    33
by simp 
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    34
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    35
lemma mult_numeral_1_right: "a * Numeral1 = (a::'a::number_ring)"
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    36
by simp
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    37
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    38
text{*Theorem lists for the cancellation simprocs. The use of binary numerals
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    39
for 0 and 1 reduces the number of special cases.*}
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    40
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    41
lemmas add_0s = add_numeral_0 add_numeral_0_right
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    42
lemmas mult_1s = mult_numeral_1 mult_numeral_1_right 
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    43
                 mult_minus1 mult_minus1_right
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    44
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    45
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    46
subsection{*Special Arithmetic Rules for Abstract 0 and 1*}
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    47
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    48
text{*Arithmetic computations are defined for binary literals, which leaves 0
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    49
and 1 as special cases. Addition already has rules for 0, but not 1.
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    50
Multiplication and unary minus already have rules for both 0 and 1.*}
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    51
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    52
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    53
lemma binop_eq: "[|f x y = g x y; x = x'; y = y'|] ==> f x' y' = g x' y'"
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    54
by simp
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    55
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    56
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    57
lemmas add_number_of_eq = number_of_add [symmetric]
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    58
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    59
text{*Allow 1 on either or both sides*}
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    60
lemma one_add_one_is_two: "1 + 1 = (2::'a::number_ring)"
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    61
by (simp del: numeral_1_eq_1 add: numeral_1_eq_1 [symmetric] add_number_of_eq)
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    62
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    63
lemmas add_special =
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    64
    one_add_one_is_two
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    65
    binop_eq [of "op +", OF add_number_of_eq numeral_1_eq_1 refl, standard]
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    66
    binop_eq [of "op +", OF add_number_of_eq refl numeral_1_eq_1, standard]
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    67
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    68
text{*Allow 1 on either or both sides (1-1 already simplifies to 0)*}
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    69
lemmas diff_special =
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    70
    binop_eq [of "op -", OF diff_number_of_eq numeral_1_eq_1 refl, standard]
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    71
    binop_eq [of "op -", OF diff_number_of_eq refl numeral_1_eq_1, standard]
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    72
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    73
text{*Allow 0 or 1 on either side with a binary numeral on the other*}
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    74
lemmas eq_special =
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    75
    binop_eq [of "op =", OF eq_number_of_eq numeral_0_eq_0 refl, standard]
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    76
    binop_eq [of "op =", OF eq_number_of_eq numeral_1_eq_1 refl, standard]
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    77
    binop_eq [of "op =", OF eq_number_of_eq refl numeral_0_eq_0, standard]
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    78
    binop_eq [of "op =", OF eq_number_of_eq refl numeral_1_eq_1, standard]
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    79
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    80
text{*Allow 0 or 1 on either side with a binary numeral on the other*}
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    81
lemmas less_special =
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    82
  binop_eq [of "op <", OF less_number_of_eq_neg numeral_0_eq_0 refl, standard]
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    83
  binop_eq [of "op <", OF less_number_of_eq_neg numeral_1_eq_1 refl, standard]
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    84
  binop_eq [of "op <", OF less_number_of_eq_neg refl numeral_0_eq_0, standard]
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    85
  binop_eq [of "op <", OF less_number_of_eq_neg refl numeral_1_eq_1, standard]
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    86
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    87
text{*Allow 0 or 1 on either side with a binary numeral on the other*}
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    88
lemmas le_special =
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    89
    binop_eq [of "op \<le>", OF le_number_of_eq numeral_0_eq_0 refl, standard]
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    90
    binop_eq [of "op \<le>", OF le_number_of_eq numeral_1_eq_1 refl, standard]
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    91
    binop_eq [of "op \<le>", OF le_number_of_eq refl numeral_0_eq_0, standard]
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    92
    binop_eq [of "op \<le>", OF le_number_of_eq refl numeral_1_eq_1, standard]
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    93
22192
834c4604de7b more fixes of arithmetic for min/max.
nipkow
parents: 22176
diff changeset
    94
lemmas arith_special[simp] = 
14387
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    95
       add_special diff_special eq_special less_special le_special
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    96
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
    97
22192
834c4604de7b more fixes of arithmetic for min/max.
nipkow
parents: 22176
diff changeset
    98
lemma min_max_01: "min (0::int) 1 = 0 & min (1::int) 0 = 0 &
834c4604de7b more fixes of arithmetic for min/max.
nipkow
parents: 22176
diff changeset
    99
                   max (0::int) 1 = 1 & max (1::int) 0 = 1"
834c4604de7b more fixes of arithmetic for min/max.
nipkow
parents: 22176
diff changeset
   100
by(simp add:min_def max_def)
834c4604de7b more fixes of arithmetic for min/max.
nipkow
parents: 22176
diff changeset
   101
834c4604de7b more fixes of arithmetic for min/max.
nipkow
parents: 22176
diff changeset
   102
lemmas min_max_special[simp] =
834c4604de7b more fixes of arithmetic for min/max.
nipkow
parents: 22176
diff changeset
   103
 min_max_01
834c4604de7b more fixes of arithmetic for min/max.
nipkow
parents: 22176
diff changeset
   104
 max_def[of "0::int" "number_of v", standard, simp]
834c4604de7b more fixes of arithmetic for min/max.
nipkow
parents: 22176
diff changeset
   105
 min_def[of "0::int" "number_of v", standard, simp]
834c4604de7b more fixes of arithmetic for min/max.
nipkow
parents: 22176
diff changeset
   106
 max_def[of "number_of u" "0::int", standard, simp]
834c4604de7b more fixes of arithmetic for min/max.
nipkow
parents: 22176
diff changeset
   107
 min_def[of "number_of u" "0::int", standard, simp]
834c4604de7b more fixes of arithmetic for min/max.
nipkow
parents: 22176
diff changeset
   108
 max_def[of "1::int" "number_of v", standard, simp]
834c4604de7b more fixes of arithmetic for min/max.
nipkow
parents: 22176
diff changeset
   109
 min_def[of "1::int" "number_of v", standard, simp]
834c4604de7b more fixes of arithmetic for min/max.
nipkow
parents: 22176
diff changeset
   110
 max_def[of "number_of u" "1::int", standard, simp]
834c4604de7b more fixes of arithmetic for min/max.
nipkow
parents: 22176
diff changeset
   111
 min_def[of "number_of u" "1::int", standard, simp]
834c4604de7b more fixes of arithmetic for min/max.
nipkow
parents: 22176
diff changeset
   112
834c4604de7b more fixes of arithmetic for min/max.
nipkow
parents: 22176
diff changeset
   113
12023
wenzelm
parents: 11868
diff changeset
   114
use "int_arith1.ML"
wenzelm
parents: 11868
diff changeset
   115
setup int_arith_setup
14259
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   116
14353
79f9fbef9106 Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents: 14295
diff changeset
   117
14387
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
   118
subsection{*Lemmas About Small Numerals*}
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
   119
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
   120
lemma of_int_m1 [simp]: "of_int -1 = (-1 :: 'a :: number_ring)"
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
   121
proof -
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
   122
  have "(of_int -1 :: 'a) = of_int (- 1)" by simp
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
   123
  also have "... = - of_int 1" by (simp only: of_int_minus)
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
   124
  also have "... = -1" by simp
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
   125
  finally show ?thesis .
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
   126
qed
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
   127
14738
83f1a514dcb4 changes made due to new Ring_and_Field theory
obua
parents: 14479
diff changeset
   128
lemma abs_minus_one [simp]: "abs (-1) = (1::'a::{ordered_idom,number_ring})"
14387
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
   129
by (simp add: abs_if)
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
   130
14436
77017c49c004 some new results
paulson
parents: 14390
diff changeset
   131
lemma abs_power_minus_one [simp]:
15003
6145dd7538d7 replaced monomorphic abs definitions by abs_if
paulson
parents: 14738
diff changeset
   132
     "abs(-1 ^ n) = (1::'a::{ordered_idom,number_ring,recpower})"
14436
77017c49c004 some new results
paulson
parents: 14390
diff changeset
   133
by (simp add: power_abs)
77017c49c004 some new results
paulson
parents: 14390
diff changeset
   134
14387
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
   135
lemma of_int_number_of_eq:
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
   136
     "of_int (number_of v) = (number_of v :: 'a :: number_ring)"
15013
34264f5e4691 new treatment of binary numerals
paulson
parents: 15003
diff changeset
   137
by (simp add: number_of_eq) 
14387
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
   138
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
   139
text{*Lemmas for specialist use, NOT as default simprules*}
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
   140
lemma mult_2: "2 * z = (z+z::'a::number_ring)"
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
   141
proof -
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
   142
  have "2*z = (1 + 1)*z" by simp
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
   143
  also have "... = z+z" by (simp add: left_distrib)
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
   144
  finally show ?thesis .
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
   145
qed
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
   146
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
   147
lemma mult_2_right: "z * 2 = (z+z::'a::number_ring)"
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
   148
by (subst mult_commute, rule mult_2)
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
   149
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
   150
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
   151
subsection{*More Inequality Reasoning*}
14272
5efbb548107d Tidying of the integer development; towards removing the
paulson
parents: 14271
diff changeset
   152
5efbb548107d Tidying of the integer development; towards removing the
paulson
parents: 14271
diff changeset
   153
lemma zless_add1_eq: "(w < z + (1::int)) = (w<z | w=z)"
14259
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   154
by arith
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   155
14272
5efbb548107d Tidying of the integer development; towards removing the
paulson
parents: 14271
diff changeset
   156
lemma add1_zle_eq: "(w + (1::int) \<le> z) = (w<z)"
5efbb548107d Tidying of the integer development; towards removing the
paulson
parents: 14271
diff changeset
   157
by arith
5efbb548107d Tidying of the integer development; towards removing the
paulson
parents: 14271
diff changeset
   158
14479
0eca4aabf371 streamlined treatment of quotients for the integers
paulson
parents: 14473
diff changeset
   159
lemma zle_diff1_eq [simp]: "(w \<le> z - (1::int)) = (w<z)"
14272
5efbb548107d Tidying of the integer development; towards removing the
paulson
parents: 14271
diff changeset
   160
by arith
5efbb548107d Tidying of the integer development; towards removing the
paulson
parents: 14271
diff changeset
   161
14479
0eca4aabf371 streamlined treatment of quotients for the integers
paulson
parents: 14473
diff changeset
   162
lemma zle_add1_eq_le [simp]: "(w < z + (1::int)) = (w\<le>z)"
14259
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   163
by arith
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   164
14365
3d4df8c166ae replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents: 14353
diff changeset
   165
lemma int_one_le_iff_zero_less: "((1::int) \<le> z) = (0 < z)"
3d4df8c166ae replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents: 14353
diff changeset
   166
by arith
3d4df8c166ae replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents: 14353
diff changeset
   167
14353
79f9fbef9106 Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents: 14295
diff changeset
   168
79f9fbef9106 Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents: 14295
diff changeset
   169
subsection{*The Functions @{term nat} and @{term int}*}
14259
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   170
14353
79f9fbef9106 Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents: 14295
diff changeset
   171
text{*Simplify the terms @{term "int 0"}, @{term "int(Suc 0)"} and
79f9fbef9106 Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents: 14295
diff changeset
   172
  @{term "w + - z"}*}
14259
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   173
declare Zero_int_def [symmetric, simp]
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   174
declare One_int_def [symmetric, simp]
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   175
14479
0eca4aabf371 streamlined treatment of quotients for the integers
paulson
parents: 14473
diff changeset
   176
lemmas diff_int_def_symmetric = diff_int_def [symmetric, simp]
14259
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   177
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   178
lemma nat_0: "nat 0 = 0"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   179
by (simp add: nat_eq_iff)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   180
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   181
lemma nat_1: "nat 1 = Suc 0"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   182
by (subst nat_eq_iff, simp)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   183
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   184
lemma nat_2: "nat 2 = Suc (Suc 0)"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   185
by (subst nat_eq_iff, simp)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   186
16413
47ffc49c7d7b a few new integer lemmas
paulson
parents: 15234
diff changeset
   187
lemma one_less_nat_eq [simp]: "(Suc 0 < nat z) = (1 < z)"
47ffc49c7d7b a few new integer lemmas
paulson
parents: 15234
diff changeset
   188
apply (insert zless_nat_conj [of 1 z])
47ffc49c7d7b a few new integer lemmas
paulson
parents: 15234
diff changeset
   189
apply (auto simp add: nat_1)
47ffc49c7d7b a few new integer lemmas
paulson
parents: 15234
diff changeset
   190
done
47ffc49c7d7b a few new integer lemmas
paulson
parents: 15234
diff changeset
   191
14259
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   192
text{*This simplifies expressions of the form @{term "int n = z"} where
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   193
      z is an integer literal.*}
17085
5b57f995a179 more simprules now have names
paulson
parents: 16417
diff changeset
   194
lemmas int_eq_iff_number_of = int_eq_iff [of _ "number_of v", standard]
5b57f995a179 more simprules now have names
paulson
parents: 16417
diff changeset
   195
declare int_eq_iff_number_of [simp]
5b57f995a179 more simprules now have names
paulson
parents: 16417
diff changeset
   196
13837
8dd150d36c65 Reorganized, moving many results about the integer dvd relation from IntPrimes
paulson
parents: 13685
diff changeset
   197
14295
7f115e5c5de4 more general lemmas for Ring_and_Field
paulson
parents: 14272
diff changeset
   198
lemma split_nat [arith_split]:
14259
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   199
  "P(nat(i::int)) = ((\<forall>n. i = int n \<longrightarrow> P n) & (i < 0 \<longrightarrow> P 0))"
13575
ecb6ecd9af13 added nat_split
nipkow
parents: 12023
diff changeset
   200
  (is "?P = (?L & ?R)")
ecb6ecd9af13 added nat_split
nipkow
parents: 12023
diff changeset
   201
proof (cases "i < 0")
ecb6ecd9af13 added nat_split
nipkow
parents: 12023
diff changeset
   202
  case True thus ?thesis by simp
ecb6ecd9af13 added nat_split
nipkow
parents: 12023
diff changeset
   203
next
ecb6ecd9af13 added nat_split
nipkow
parents: 12023
diff changeset
   204
  case False
ecb6ecd9af13 added nat_split
nipkow
parents: 12023
diff changeset
   205
  have "?P = ?L"
ecb6ecd9af13 added nat_split
nipkow
parents: 12023
diff changeset
   206
  proof
ecb6ecd9af13 added nat_split
nipkow
parents: 12023
diff changeset
   207
    assume ?P thus ?L using False by clarsimp
ecb6ecd9af13 added nat_split
nipkow
parents: 12023
diff changeset
   208
  next
ecb6ecd9af13 added nat_split
nipkow
parents: 12023
diff changeset
   209
    assume ?L thus ?P using False by simp
ecb6ecd9af13 added nat_split
nipkow
parents: 12023
diff changeset
   210
  qed
ecb6ecd9af13 added nat_split
nipkow
parents: 12023
diff changeset
   211
  with False show ?thesis by simp
ecb6ecd9af13 added nat_split
nipkow
parents: 12023
diff changeset
   212
qed
ecb6ecd9af13 added nat_split
nipkow
parents: 12023
diff changeset
   213
14387
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
   214
14479
0eca4aabf371 streamlined treatment of quotients for the integers
paulson
parents: 14473
diff changeset
   215
(*Analogous to zadd_int*)
15013
34264f5e4691 new treatment of binary numerals
paulson
parents: 15003
diff changeset
   216
lemma zdiff_int: "n \<le> m ==> int m - int n = int (m-n)" 
14479
0eca4aabf371 streamlined treatment of quotients for the integers
paulson
parents: 14473
diff changeset
   217
by (induct m n rule: diff_induct, simp_all)
0eca4aabf371 streamlined treatment of quotients for the integers
paulson
parents: 14473
diff changeset
   218
0eca4aabf371 streamlined treatment of quotients for the integers
paulson
parents: 14473
diff changeset
   219
lemma nat_mult_distrib: "(0::int) \<le> z ==> nat (z*z') = nat z * nat z'"
0eca4aabf371 streamlined treatment of quotients for the integers
paulson
parents: 14473
diff changeset
   220
apply (case_tac "0 \<le> z'")
0eca4aabf371 streamlined treatment of quotients for the integers
paulson
parents: 14473
diff changeset
   221
apply (rule inj_int [THEN injD])
16413
47ffc49c7d7b a few new integer lemmas
paulson
parents: 15234
diff changeset
   222
apply (simp add: int_mult zero_le_mult_iff)
14479
0eca4aabf371 streamlined treatment of quotients for the integers
paulson
parents: 14473
diff changeset
   223
apply (simp add: mult_le_0_iff)
0eca4aabf371 streamlined treatment of quotients for the integers
paulson
parents: 14473
diff changeset
   224
done
0eca4aabf371 streamlined treatment of quotients for the integers
paulson
parents: 14473
diff changeset
   225
0eca4aabf371 streamlined treatment of quotients for the integers
paulson
parents: 14473
diff changeset
   226
lemma nat_mult_distrib_neg: "z \<le> (0::int) ==> nat(z*z') = nat(-z) * nat(-z')"
0eca4aabf371 streamlined treatment of quotients for the integers
paulson
parents: 14473
diff changeset
   227
apply (rule trans)
0eca4aabf371 streamlined treatment of quotients for the integers
paulson
parents: 14473
diff changeset
   228
apply (rule_tac [2] nat_mult_distrib, auto)
0eca4aabf371 streamlined treatment of quotients for the integers
paulson
parents: 14473
diff changeset
   229
done
0eca4aabf371 streamlined treatment of quotients for the integers
paulson
parents: 14473
diff changeset
   230
0eca4aabf371 streamlined treatment of quotients for the integers
paulson
parents: 14473
diff changeset
   231
lemma nat_abs_mult_distrib: "nat (abs (w * z)) = nat (abs w) * nat (abs z)"
0eca4aabf371 streamlined treatment of quotients for the integers
paulson
parents: 14473
diff changeset
   232
apply (case_tac "z=0 | w=0")
15003
6145dd7538d7 replaced monomorphic abs definitions by abs_if
paulson
parents: 14738
diff changeset
   233
apply (auto simp add: abs_if nat_mult_distrib [symmetric] 
14479
0eca4aabf371 streamlined treatment of quotients for the integers
paulson
parents: 14473
diff changeset
   234
                      nat_mult_distrib_neg [symmetric] mult_less_0_iff)
0eca4aabf371 streamlined treatment of quotients for the integers
paulson
parents: 14473
diff changeset
   235
done
0eca4aabf371 streamlined treatment of quotients for the integers
paulson
parents: 14473
diff changeset
   236
0eca4aabf371 streamlined treatment of quotients for the integers
paulson
parents: 14473
diff changeset
   237
17472
bcbf48d59059 tuned document;
wenzelm
parents: 17085
diff changeset
   238
subsection "Induction principles for int"
13685
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   239
22059
f72cdc0a0af4 well-founded relations for the integers
paulson
parents: 21911
diff changeset
   240
text{*Well-founded segments of the integers*}
f72cdc0a0af4 well-founded relations for the integers
paulson
parents: 21911
diff changeset
   241
f72cdc0a0af4 well-founded relations for the integers
paulson
parents: 21911
diff changeset
   242
definition
f72cdc0a0af4 well-founded relations for the integers
paulson
parents: 21911
diff changeset
   243
  int_ge_less_than  ::  "int => (int * int) set"
f72cdc0a0af4 well-founded relations for the integers
paulson
parents: 21911
diff changeset
   244
where
f72cdc0a0af4 well-founded relations for the integers
paulson
parents: 21911
diff changeset
   245
  "int_ge_less_than d = {(z',z). d \<le> z' & z' < z}"
f72cdc0a0af4 well-founded relations for the integers
paulson
parents: 21911
diff changeset
   246
f72cdc0a0af4 well-founded relations for the integers
paulson
parents: 21911
diff changeset
   247
theorem wf_int_ge_less_than: "wf (int_ge_less_than d)"
f72cdc0a0af4 well-founded relations for the integers
paulson
parents: 21911
diff changeset
   248
proof -
f72cdc0a0af4 well-founded relations for the integers
paulson
parents: 21911
diff changeset
   249
  have "int_ge_less_than d \<subseteq> measure (%z. nat (z-d))"
f72cdc0a0af4 well-founded relations for the integers
paulson
parents: 21911
diff changeset
   250
    by (auto simp add: int_ge_less_than_def)
f72cdc0a0af4 well-founded relations for the integers
paulson
parents: 21911
diff changeset
   251
  thus ?thesis 
f72cdc0a0af4 well-founded relations for the integers
paulson
parents: 21911
diff changeset
   252
    by (rule wf_subset [OF wf_measure]) 
f72cdc0a0af4 well-founded relations for the integers
paulson
parents: 21911
diff changeset
   253
qed
f72cdc0a0af4 well-founded relations for the integers
paulson
parents: 21911
diff changeset
   254
f72cdc0a0af4 well-founded relations for the integers
paulson
parents: 21911
diff changeset
   255
text{*This variant looks odd, but is typical of the relations suggested
f72cdc0a0af4 well-founded relations for the integers
paulson
parents: 21911
diff changeset
   256
by RankFinder.*}
f72cdc0a0af4 well-founded relations for the integers
paulson
parents: 21911
diff changeset
   257
f72cdc0a0af4 well-founded relations for the integers
paulson
parents: 21911
diff changeset
   258
definition
f72cdc0a0af4 well-founded relations for the integers
paulson
parents: 21911
diff changeset
   259
  int_ge_less_than2 ::  "int => (int * int) set"
f72cdc0a0af4 well-founded relations for the integers
paulson
parents: 21911
diff changeset
   260
where
f72cdc0a0af4 well-founded relations for the integers
paulson
parents: 21911
diff changeset
   261
  "int_ge_less_than2 d = {(z',z). d \<le> z & z' < z}"
f72cdc0a0af4 well-founded relations for the integers
paulson
parents: 21911
diff changeset
   262
f72cdc0a0af4 well-founded relations for the integers
paulson
parents: 21911
diff changeset
   263
theorem wf_int_ge_less_than2: "wf (int_ge_less_than2 d)"
f72cdc0a0af4 well-founded relations for the integers
paulson
parents: 21911
diff changeset
   264
proof -
f72cdc0a0af4 well-founded relations for the integers
paulson
parents: 21911
diff changeset
   265
  have "int_ge_less_than2 d \<subseteq> measure (%z. nat (1+z-d))" 
f72cdc0a0af4 well-founded relations for the integers
paulson
parents: 21911
diff changeset
   266
    by (auto simp add: int_ge_less_than2_def)
f72cdc0a0af4 well-founded relations for the integers
paulson
parents: 21911
diff changeset
   267
  thus ?thesis 
f72cdc0a0af4 well-founded relations for the integers
paulson
parents: 21911
diff changeset
   268
    by (rule wf_subset [OF wf_measure]) 
f72cdc0a0af4 well-founded relations for the integers
paulson
parents: 21911
diff changeset
   269
qed
f72cdc0a0af4 well-founded relations for the integers
paulson
parents: 21911
diff changeset
   270
13685
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   271
                     (* `set:int': dummy construction *)
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   272
theorem int_ge_induct[case_names base step,induct set:int]:
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   273
  assumes ge: "k \<le> (i::int)" and
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   274
        base: "P(k)" and
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   275
        step: "\<And>i. \<lbrakk>k \<le> i; P i\<rbrakk> \<Longrightarrow> P(i+1)"
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   276
  shows "P i"
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   277
proof -
14272
5efbb548107d Tidying of the integer development; towards removing the
paulson
parents: 14271
diff changeset
   278
  { fix n have "\<And>i::int. n = nat(i-k) \<Longrightarrow> k \<le> i \<Longrightarrow> P i"
13685
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   279
    proof (induct n)
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   280
      case 0
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   281
      hence "i = k" by arith
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   282
      thus "P i" using base by simp
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   283
    next
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   284
      case (Suc n)
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   285
      hence "n = nat((i - 1) - k)" by arith
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   286
      moreover
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   287
      have ki1: "k \<le> i - 1" using Suc.prems by arith
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   288
      ultimately
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   289
      have "P(i - 1)" by(rule Suc.hyps)
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   290
      from step[OF ki1 this] show ?case by simp
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   291
    qed
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   292
  }
14473
846c237bd9b3 stylistic tweaks
paulson
parents: 14436
diff changeset
   293
  with ge show ?thesis by fast
13685
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   294
qed
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   295
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   296
                     (* `set:int': dummy construction *)
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   297
theorem int_gr_induct[case_names base step,induct set:int]:
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   298
  assumes gr: "k < (i::int)" and
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   299
        base: "P(k+1)" and
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   300
        step: "\<And>i. \<lbrakk>k < i; P i\<rbrakk> \<Longrightarrow> P(i+1)"
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   301
  shows "P i"
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   302
apply(rule int_ge_induct[of "k + 1"])
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   303
  using gr apply arith
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   304
 apply(rule base)
14259
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   305
apply (rule step, simp+)
13685
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   306
done
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   307
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   308
theorem int_le_induct[consumes 1,case_names base step]:
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   309
  assumes le: "i \<le> (k::int)" and
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   310
        base: "P(k)" and
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   311
        step: "\<And>i. \<lbrakk>i \<le> k; P i\<rbrakk> \<Longrightarrow> P(i - 1)"
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   312
  shows "P i"
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   313
proof -
14272
5efbb548107d Tidying of the integer development; towards removing the
paulson
parents: 14271
diff changeset
   314
  { fix n have "\<And>i::int. n = nat(k-i) \<Longrightarrow> i \<le> k \<Longrightarrow> P i"
13685
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   315
    proof (induct n)
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   316
      case 0
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   317
      hence "i = k" by arith
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   318
      thus "P i" using base by simp
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   319
    next
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   320
      case (Suc n)
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   321
      hence "n = nat(k - (i+1))" by arith
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   322
      moreover
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   323
      have ki1: "i + 1 \<le> k" using Suc.prems by arith
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   324
      ultimately
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   325
      have "P(i+1)" by(rule Suc.hyps)
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   326
      from step[OF ki1 this] show ?case by simp
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   327
    qed
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   328
  }
14473
846c237bd9b3 stylistic tweaks
paulson
parents: 14436
diff changeset
   329
  with le show ?thesis by fast
13685
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   330
qed
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   331
14387
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
   332
theorem int_less_induct [consumes 1,case_names base step]:
13685
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   333
  assumes less: "(i::int) < k" and
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   334
        base: "P(k - 1)" and
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   335
        step: "\<And>i. \<lbrakk>i < k; P i\<rbrakk> \<Longrightarrow> P(i - 1)"
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   336
  shows "P i"
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   337
apply(rule int_le_induct[of _ "k - 1"])
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   338
  using less apply arith
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   339
 apply(rule base)
14259
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   340
apply (rule step, simp+)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   341
done
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   342
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   343
subsection{*Intermediate value theorems*}
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   344
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   345
lemma int_val_lemma:
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   346
     "(\<forall>i<n::nat. abs(f(i+1) - f i) \<le> 1) -->  
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   347
      f 0 \<le> k --> k \<le> f n --> (\<exists>i \<le> n. f i = (k::int))"
14271
8ed6989228bb Simplification of the development of Integers
paulson
parents: 14266
diff changeset
   348
apply (induct_tac "n", simp)
14259
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   349
apply (intro strip)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   350
apply (erule impE, simp)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   351
apply (erule_tac x = n in allE, simp)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   352
apply (case_tac "k = f (n+1) ")
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   353
 apply force
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   354
apply (erule impE)
15003
6145dd7538d7 replaced monomorphic abs definitions by abs_if
paulson
parents: 14738
diff changeset
   355
 apply (simp add: abs_if split add: split_if_asm)
14259
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   356
apply (blast intro: le_SucI)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   357
done
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   358
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   359
lemmas nat0_intermed_int_val = int_val_lemma [rule_format (no_asm)]
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   360
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   361
lemma nat_intermed_int_val:
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   362
     "[| \<forall>i. m \<le> i & i < n --> abs(f(i + 1::nat) - f i) \<le> 1; m < n;  
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   363
         f m \<le> k; k \<le> f n |] ==> ? i. m \<le> i & i \<le> n & f i = (k::int)"
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   364
apply (cut_tac n = "n-m" and f = "%i. f (i+m) " and k = k 
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   365
       in int_val_lemma)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   366
apply simp
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   367
apply (erule exE)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   368
apply (rule_tac x = "i+m" in exI, arith)
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   369
done
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   370
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   371
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   372
subsection{*Products and 1, by T. M. Rasmussen*}
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   373
15234
ec91a90c604e simplification tweaks for better arithmetic reasoning
paulson
parents: 15140
diff changeset
   374
lemma zabs_less_one_iff [simp]: "(\<bar>z\<bar> < 1) = (z = (0::int))"
ec91a90c604e simplification tweaks for better arithmetic reasoning
paulson
parents: 15140
diff changeset
   375
by arith
ec91a90c604e simplification tweaks for better arithmetic reasoning
paulson
parents: 15140
diff changeset
   376
ec91a90c604e simplification tweaks for better arithmetic reasoning
paulson
parents: 15140
diff changeset
   377
lemma abs_zmult_eq_1: "(\<bar>m * n\<bar> = 1) ==> \<bar>m\<bar> = (1::int)"
ec91a90c604e simplification tweaks for better arithmetic reasoning
paulson
parents: 15140
diff changeset
   378
apply (case_tac "\<bar>n\<bar>=1") 
ec91a90c604e simplification tweaks for better arithmetic reasoning
paulson
parents: 15140
diff changeset
   379
apply (simp add: abs_mult) 
ec91a90c604e simplification tweaks for better arithmetic reasoning
paulson
parents: 15140
diff changeset
   380
apply (rule ccontr) 
ec91a90c604e simplification tweaks for better arithmetic reasoning
paulson
parents: 15140
diff changeset
   381
apply (auto simp add: linorder_neq_iff abs_mult) 
ec91a90c604e simplification tweaks for better arithmetic reasoning
paulson
parents: 15140
diff changeset
   382
apply (subgoal_tac "2 \<le> \<bar>m\<bar> & 2 \<le> \<bar>n\<bar>")
ec91a90c604e simplification tweaks for better arithmetic reasoning
paulson
parents: 15140
diff changeset
   383
 prefer 2 apply arith 
ec91a90c604e simplification tweaks for better arithmetic reasoning
paulson
parents: 15140
diff changeset
   384
apply (subgoal_tac "2*2 \<le> \<bar>m\<bar> * \<bar>n\<bar>", simp) 
ec91a90c604e simplification tweaks for better arithmetic reasoning
paulson
parents: 15140
diff changeset
   385
apply (rule mult_mono, auto) 
13685
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   386
done
0b8fbcf65d73 added induction thms
nipkow
parents: 13575
diff changeset
   387
15234
ec91a90c604e simplification tweaks for better arithmetic reasoning
paulson
parents: 15140
diff changeset
   388
lemma pos_zmult_eq_1_iff_lemma: "(m * n = 1) ==> m = (1::int) | m = -1"
ec91a90c604e simplification tweaks for better arithmetic reasoning
paulson
parents: 15140
diff changeset
   389
by (insert abs_zmult_eq_1 [of m n], arith)
ec91a90c604e simplification tweaks for better arithmetic reasoning
paulson
parents: 15140
diff changeset
   390
14259
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   391
lemma pos_zmult_eq_1_iff: "0 < (m::int) ==> (m * n = 1) = (m = 1 & n = 1)"
15234
ec91a90c604e simplification tweaks for better arithmetic reasoning
paulson
parents: 15140
diff changeset
   392
apply (auto dest: pos_zmult_eq_1_iff_lemma) 
ec91a90c604e simplification tweaks for better arithmetic reasoning
paulson
parents: 15140
diff changeset
   393
apply (simp add: mult_commute [of m]) 
ec91a90c604e simplification tweaks for better arithmetic reasoning
paulson
parents: 15140
diff changeset
   394
apply (frule pos_zmult_eq_1_iff_lemma, auto) 
14259
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   395
done
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   396
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   397
lemma zmult_eq_1_iff: "(m*n = (1::int)) = ((m = 1 & n = 1) | (m = -1 & n = -1))"
15234
ec91a90c604e simplification tweaks for better arithmetic reasoning
paulson
parents: 15140
diff changeset
   398
apply (rule iffI) 
ec91a90c604e simplification tweaks for better arithmetic reasoning
paulson
parents: 15140
diff changeset
   399
 apply (frule pos_zmult_eq_1_iff_lemma)
ec91a90c604e simplification tweaks for better arithmetic reasoning
paulson
parents: 15140
diff changeset
   400
 apply (simp add: mult_commute [of m]) 
ec91a90c604e simplification tweaks for better arithmetic reasoning
paulson
parents: 15140
diff changeset
   401
 apply (frule pos_zmult_eq_1_iff_lemma, auto) 
14259
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   402
done
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   403
20355
50aaae6ae4db cleanup code generation for Numerals
haftmann
parents: 20217
diff changeset
   404
50aaae6ae4db cleanup code generation for Numerals
haftmann
parents: 20217
diff changeset
   405
subsection {* code generator setup *}
50aaae6ae4db cleanup code generation for Numerals
haftmann
parents: 20217
diff changeset
   406
21191
c00161fbf990 code generator module naming improved
haftmann
parents: 21113
diff changeset
   407
code_modulename SML
c00161fbf990 code generator module naming improved
haftmann
parents: 21113
diff changeset
   408
  Numeral Integer
20355
50aaae6ae4db cleanup code generation for Numerals
haftmann
parents: 20217
diff changeset
   409
21911
e29bcab0c81c added OCaml code generation (without dictionaries)
haftmann
parents: 21872
diff changeset
   410
code_modulename OCaml
e29bcab0c81c added OCaml code generation (without dictionaries)
haftmann
parents: 21872
diff changeset
   411
  Numeral Integer
e29bcab0c81c added OCaml code generation (without dictionaries)
haftmann
parents: 21872
diff changeset
   412
20595
db6bedfba498 improved numeral handling for nbe
haftmann
parents: 20523
diff changeset
   413
lemma Numeral_Pls_refl [code func]:
db6bedfba498 improved numeral handling for nbe
haftmann
parents: 20523
diff changeset
   414
  "Numeral.Pls = Numeral.Pls" ..
20402
e2c6d096af01 more concise preprocessing of numerals for code generation
haftmann
parents: 20380
diff changeset
   415
20595
db6bedfba498 improved numeral handling for nbe
haftmann
parents: 20523
diff changeset
   416
lemma Numeral_Min_refl [code func]:
db6bedfba498 improved numeral handling for nbe
haftmann
parents: 20523
diff changeset
   417
  "Numeral.Min = Numeral.Min" ..
20402
e2c6d096af01 more concise preprocessing of numerals for code generation
haftmann
parents: 20380
diff changeset
   418
20595
db6bedfba498 improved numeral handling for nbe
haftmann
parents: 20523
diff changeset
   419
lemma zero_int_refl [code func]:
db6bedfba498 improved numeral handling for nbe
haftmann
parents: 20523
diff changeset
   420
  "(0\<Colon>int) = 0" ..
20355
50aaae6ae4db cleanup code generation for Numerals
haftmann
parents: 20217
diff changeset
   421
20595
db6bedfba498 improved numeral handling for nbe
haftmann
parents: 20523
diff changeset
   422
lemma one_int_refl [code func]:
db6bedfba498 improved numeral handling for nbe
haftmann
parents: 20523
diff changeset
   423
  "(1\<Colon>int) = 1" ..
20355
50aaae6ae4db cleanup code generation for Numerals
haftmann
parents: 20217
diff changeset
   424
20595
db6bedfba498 improved numeral handling for nbe
haftmann
parents: 20523
diff changeset
   425
lemma number_of_int_refl [code func]:
db6bedfba498 improved numeral handling for nbe
haftmann
parents: 20523
diff changeset
   426
  "(number_of \<Colon> int \<Rightarrow> int) = number_of" ..
db6bedfba498 improved numeral handling for nbe
haftmann
parents: 20523
diff changeset
   427
db6bedfba498 improved numeral handling for nbe
haftmann
parents: 20523
diff changeset
   428
lemma number_of_is_id:
20485
3078fd2eec7b got rid of Numeral.bin type
haftmann
parents: 20402
diff changeset
   429
  "number_of (k::int) = k"
3078fd2eec7b got rid of Numeral.bin type
haftmann
parents: 20402
diff changeset
   430
  unfolding int_number_of_def by simp
20355
50aaae6ae4db cleanup code generation for Numerals
haftmann
parents: 20217
diff changeset
   431
21060
bc1fa6f47ced added normal post setup
haftmann
parents: 21046
diff changeset
   432
lemma zero_is_num_zero [code inline, symmetric, normal post]:
20595
db6bedfba498 improved numeral handling for nbe
haftmann
parents: 20523
diff changeset
   433
  "(0::int) = number_of Numeral.Pls" 
db6bedfba498 improved numeral handling for nbe
haftmann
parents: 20523
diff changeset
   434
  by simp
db6bedfba498 improved numeral handling for nbe
haftmann
parents: 20523
diff changeset
   435
21060
bc1fa6f47ced added normal post setup
haftmann
parents: 21046
diff changeset
   436
lemma one_is_num_one [code inline, symmetric, normal post]:
20595
db6bedfba498 improved numeral handling for nbe
haftmann
parents: 20523
diff changeset
   437
  "(1::int) = number_of  (Numeral.Pls BIT bit.B1)" 
db6bedfba498 improved numeral handling for nbe
haftmann
parents: 20523
diff changeset
   438
  by simp 
db6bedfba498 improved numeral handling for nbe
haftmann
parents: 20523
diff changeset
   439
db6bedfba498 improved numeral handling for nbe
haftmann
parents: 20523
diff changeset
   440
lemmas int_code_rewrites =
db6bedfba498 improved numeral handling for nbe
haftmann
parents: 20523
diff changeset
   441
  arith_simps(5-27)
20900
c1ba49ade6a5 standardized facts;
wenzelm
parents: 20699
diff changeset
   442
  arith_extra_simps(1-5) [where 'a = int]
20595
db6bedfba498 improved numeral handling for nbe
haftmann
parents: 20523
diff changeset
   443
db6bedfba498 improved numeral handling for nbe
haftmann
parents: 20523
diff changeset
   444
declare int_code_rewrites [code func]
20355
50aaae6ae4db cleanup code generation for Numerals
haftmann
parents: 20217
diff changeset
   445
20699
0cc77abb185a refinements in codegen serializer
haftmann
parents: 20595
diff changeset
   446
code_type bit
21113
5b76e541cc0a adapted to new serializer syntax
haftmann
parents: 21060
diff changeset
   447
  (SML "bool")
21911
e29bcab0c81c added OCaml code generation (without dictionaries)
haftmann
parents: 21872
diff changeset
   448
  (OCaml "bool")
21113
5b76e541cc0a adapted to new serializer syntax
haftmann
parents: 21060
diff changeset
   449
  (Haskell "Bool")
20699
0cc77abb185a refinements in codegen serializer
haftmann
parents: 20595
diff changeset
   450
code_const "Numeral.bit.B0" and "Numeral.bit.B1"
21113
5b76e541cc0a adapted to new serializer syntax
haftmann
parents: 21060
diff changeset
   451
  (SML "false" and "true")
21911
e29bcab0c81c added OCaml code generation (without dictionaries)
haftmann
parents: 21872
diff changeset
   452
  (OCaml "false" and "true")
21113
5b76e541cc0a adapted to new serializer syntax
haftmann
parents: 21060
diff changeset
   453
  (Haskell "False" and "True")
20699
0cc77abb185a refinements in codegen serializer
haftmann
parents: 20595
diff changeset
   454
0cc77abb185a refinements in codegen serializer
haftmann
parents: 20595
diff changeset
   455
code_const "number_of \<Colon> int \<Rightarrow> int"
0cc77abb185a refinements in codegen serializer
haftmann
parents: 20595
diff changeset
   456
  and "Numeral.Pls" and "Numeral.Min" and "Numeral.Bit"
0cc77abb185a refinements in codegen serializer
haftmann
parents: 20595
diff changeset
   457
  and "Numeral.succ" and "Numeral.pred"
20595
db6bedfba498 improved numeral handling for nbe
haftmann
parents: 20523
diff changeset
   458
  (SML "_"
21113
5b76e541cc0a adapted to new serializer syntax
haftmann
parents: 21060
diff changeset
   459
     and "0/ :/ IntInf.int"
5b76e541cc0a adapted to new serializer syntax
haftmann
parents: 21060
diff changeset
   460
     and "~1/ :/ IntInf.int"
21911
e29bcab0c81c added OCaml code generation (without dictionaries)
haftmann
parents: 21872
diff changeset
   461
     and "!(_; _; raise Fail \"BIT\")"
21113
5b76e541cc0a adapted to new serializer syntax
haftmann
parents: 21060
diff changeset
   462
     and "IntInf.+/ (_,/ 1)"
5b76e541cc0a adapted to new serializer syntax
haftmann
parents: 21060
diff changeset
   463
     and "IntInf.-/ (_,/ 1))")
21911
e29bcab0c81c added OCaml code generation (without dictionaries)
haftmann
parents: 21872
diff changeset
   464
  (OCaml "_"
e29bcab0c81c added OCaml code generation (without dictionaries)
haftmann
parents: 21872
diff changeset
   465
     and "Big'_int.big'_int'_of'_int/ 0"
22176
29ba33d58637 fxied bug for OCaml bigints
haftmann
parents: 22059
diff changeset
   466
     and "Big'_int.big'_int'_of'_int/ (-1)"
21911
e29bcab0c81c added OCaml code generation (without dictionaries)
haftmann
parents: 21872
diff changeset
   467
     and "!(_; _; failwith \"BIT\")"
e29bcab0c81c added OCaml code generation (without dictionaries)
haftmann
parents: 21872
diff changeset
   468
     and "Big'_int.succ'_big'_int"
e29bcab0c81c added OCaml code generation (without dictionaries)
haftmann
parents: 21872
diff changeset
   469
     and "Big'_int.pred'_big'_int")
20595
db6bedfba498 improved numeral handling for nbe
haftmann
parents: 20523
diff changeset
   470
  (Haskell "_"
21113
5b76e541cc0a adapted to new serializer syntax
haftmann
parents: 21060
diff changeset
   471
     and "0"
21911
e29bcab0c81c added OCaml code generation (without dictionaries)
haftmann
parents: 21872
diff changeset
   472
     and "!(-1)"
21113
5b76e541cc0a adapted to new serializer syntax
haftmann
parents: 21060
diff changeset
   473
     and "error/ \"BIT\""
5b76e541cc0a adapted to new serializer syntax
haftmann
parents: 21060
diff changeset
   474
     and "(+)/ 1"
5b76e541cc0a adapted to new serializer syntax
haftmann
parents: 21060
diff changeset
   475
     and "(-)/ _/ 1")
20485
3078fd2eec7b got rid of Numeral.bin type
haftmann
parents: 20402
diff changeset
   476
20355
50aaae6ae4db cleanup code generation for Numerals
haftmann
parents: 20217
diff changeset
   477
setup {*
21820
2f2b6a965ccc introduced mk/dest_numeral/number for mk/dest_binum etc.
haftmann
parents: 21191
diff changeset
   478
  CodegenPackage.add_appconst ("Numeral.Bit", CodegenPackage.appgen_numeral (try HOLogic.dest_numeral))
20355
50aaae6ae4db cleanup code generation for Numerals
haftmann
parents: 20217
diff changeset
   479
*}
50aaae6ae4db cleanup code generation for Numerals
haftmann
parents: 20217
diff changeset
   480
50aaae6ae4db cleanup code generation for Numerals
haftmann
parents: 20217
diff changeset
   481
19601
299d4cd2ef51 added codegen preprocessors for numerals
haftmann
parents: 17472
diff changeset
   482
subsection {* legacy ML bindings *}
299d4cd2ef51 added codegen preprocessors for numerals
haftmann
parents: 17472
diff changeset
   483
14259
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   484
ML
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   485
{*
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   486
val zle_diff1_eq = thm "zle_diff1_eq";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   487
val zle_add1_eq_le = thm "zle_add1_eq_le";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   488
val nonneg_eq_int = thm "nonneg_eq_int";
14387
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14378
diff changeset
   489
val abs_minus_one = thm "abs_minus_one";
14390
55fe71faadda further tweaks to the numeric theories
paulson
parents: 14387
diff changeset
   490
val of_int_number_of_eq = thm"of_int_number_of_eq";
14259
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   491
val nat_eq_iff = thm "nat_eq_iff";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   492
val nat_eq_iff2 = thm "nat_eq_iff2";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   493
val nat_less_iff = thm "nat_less_iff";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   494
val int_eq_iff = thm "int_eq_iff";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   495
val nat_0 = thm "nat_0";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   496
val nat_1 = thm "nat_1";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   497
val nat_2 = thm "nat_2";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   498
val nat_less_eq_zless = thm "nat_less_eq_zless";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   499
val nat_le_eq_zle = thm "nat_le_eq_zle";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   500
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   501
val nat_intermed_int_val = thm "nat_intermed_int_val";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   502
val pos_zmult_eq_1_iff = thm "pos_zmult_eq_1_iff";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   503
val zmult_eq_1_iff = thm "zmult_eq_1_iff";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   504
val nat_add_distrib = thm "nat_add_distrib";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   505
val nat_diff_distrib = thm "nat_diff_distrib";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   506
val nat_mult_distrib = thm "nat_mult_distrib";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   507
val nat_mult_distrib_neg = thm "nat_mult_distrib_neg";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   508
val nat_abs_mult_distrib = thm "nat_abs_mult_distrib";
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   509
*}
79f7d3451b1e conversion of ML to Isar scripts
paulson
parents: 13849
diff changeset
   510
7707
1f4b67fdfdae simprocs now in IntArith;
wenzelm
parents:
diff changeset
   511
end