src/HOL/ex/BinEx.thy
author wenzelm
Fri, 08 Mar 2002 16:24:06 +0100
changeset 13049 ce180e5b7fa0
parent 12613 279facb4253a
child 13187 e5434b822a96
permissions -rw-r--r--
tuned;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5545
9117a0e2bf31 added correctness proofs for arithmetic
paulson
parents: 5199
diff changeset
     1
(*  Title:      HOL/ex/BinEx.thy
9117a0e2bf31 added correctness proofs for arithmetic
paulson
parents: 5199
diff changeset
     2
    ID:         $Id$
9117a0e2bf31 added correctness proofs for arithmetic
paulson
parents: 5199
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
9117a0e2bf31 added correctness proofs for arithmetic
paulson
parents: 5199
diff changeset
     4
    Copyright   1998  University of Cambridge
9117a0e2bf31 added correctness proofs for arithmetic
paulson
parents: 5199
diff changeset
     5
*)
9117a0e2bf31 added correctness proofs for arithmetic
paulson
parents: 5199
diff changeset
     6
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
     7
header {* Binary arithmetic examples *}
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
     8
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
     9
theory BinEx = Main:
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    10
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    11
subsection {* The Integers *}
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    12
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    13
text {* Addition *}
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    14
11704
3c50a2cd6f00 * sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents: 11701
diff changeset
    15
lemma "(13::int) + 19 = 32"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    16
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    17
11704
3c50a2cd6f00 * sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents: 11701
diff changeset
    18
lemma "(1234::int) + 5678 = 6912"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    19
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    20
11704
3c50a2cd6f00 * sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents: 11701
diff changeset
    21
lemma "(1359::int) + -2468 = -1109"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    22
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    23
11704
3c50a2cd6f00 * sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents: 11701
diff changeset
    24
lemma "(93746::int) + -46375 = 47371"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    25
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    26
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    27
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    28
text {* \medskip Negation *}
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    29
11704
3c50a2cd6f00 * sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents: 11701
diff changeset
    30
lemma "- (65745::int) = -65745"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    31
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    32
11704
3c50a2cd6f00 * sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents: 11701
diff changeset
    33
lemma "- (-54321::int) = 54321"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    34
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    35
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    36
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    37
text {* \medskip Multiplication *}
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    38
11704
3c50a2cd6f00 * sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents: 11701
diff changeset
    39
lemma "(13::int) * 19 = 247"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    40
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    41
11704
3c50a2cd6f00 * sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents: 11701
diff changeset
    42
lemma "(-84::int) * 51 = -4284"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    43
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    44
11704
3c50a2cd6f00 * sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents: 11701
diff changeset
    45
lemma "(255::int) * 255 = 65025"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    46
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    47
11704
3c50a2cd6f00 * sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents: 11701
diff changeset
    48
lemma "(1359::int) * -2468 = -3354012"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    49
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    50
11704
3c50a2cd6f00 * sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents: 11701
diff changeset
    51
lemma "(89::int) * 10 \<noteq> 889"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    52
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    53
11704
3c50a2cd6f00 * sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents: 11701
diff changeset
    54
lemma "(13::int) < 18 - 4"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    55
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    56
11704
3c50a2cd6f00 * sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents: 11701
diff changeset
    57
lemma "(-345::int) < -242 + -100"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    58
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    59
11704
3c50a2cd6f00 * sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents: 11701
diff changeset
    60
lemma "(13557456::int) < 18678654"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    61
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    62
11868
56db9f3a6b3e Numerals now work for the integers: the binary numerals for 0 and 1 rewrite
paulson
parents: 11704
diff changeset
    63
lemma "(999999::int) \<le> (1000001 + 1) - 2"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    64
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    65
11704
3c50a2cd6f00 * sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents: 11701
diff changeset
    66
lemma "(1234567::int) \<le> 1234567"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    67
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    68
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    69
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    70
text {* \medskip Quotient and Remainder *}
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    71
11704
3c50a2cd6f00 * sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents: 11701
diff changeset
    72
lemma "(10::int) div 3 = 3"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    73
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    74
11868
56db9f3a6b3e Numerals now work for the integers: the binary numerals for 0 and 1 rewrite
paulson
parents: 11704
diff changeset
    75
lemma "(10::int) mod 3 = 1"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    76
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    77
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    78
text {* A negative divisor *}
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    79
11704
3c50a2cd6f00 * sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents: 11701
diff changeset
    80
lemma "(10::int) div -3 = -4"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    81
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    82
11704
3c50a2cd6f00 * sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents: 11701
diff changeset
    83
lemma "(10::int) mod -3 = -2"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    84
  by simp
5545
9117a0e2bf31 added correctness proofs for arithmetic
paulson
parents: 5199
diff changeset
    85
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    86
text {*
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    87
  A negative dividend\footnote{The definition agrees with mathematical
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    88
  convention but not with the hardware of most computers}
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    89
*}
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    90
11704
3c50a2cd6f00 * sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents: 11701
diff changeset
    91
lemma "(-10::int) div 3 = -4"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    92
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    93
11704
3c50a2cd6f00 * sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents: 11701
diff changeset
    94
lemma "(-10::int) mod 3 = 2"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    95
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    96
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    97
text {* A negative dividend \emph{and} divisor *}
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
    98
11704
3c50a2cd6f00 * sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents: 11701
diff changeset
    99
lemma "(-10::int) div -3 = 3"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   100
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   101
11704
3c50a2cd6f00 * sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents: 11701
diff changeset
   102
lemma "(-10::int) mod -3 = -1"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   103
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   104
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   105
text {* A few bigger examples *}
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   106
11868
56db9f3a6b3e Numerals now work for the integers: the binary numerals for 0 and 1 rewrite
paulson
parents: 11704
diff changeset
   107
lemma "(8452::int) mod 3 = 1"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   108
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   109
11704
3c50a2cd6f00 * sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents: 11701
diff changeset
   110
lemma "(59485::int) div 434 = 137"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   111
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   112
11704
3c50a2cd6f00 * sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents: 11701
diff changeset
   113
lemma "(1000006::int) mod 10 = 6"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   114
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   115
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   116
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   117
text {* \medskip Division by shifting *}
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   118
11704
3c50a2cd6f00 * sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents: 11701
diff changeset
   119
lemma "10000000 div 2 = (5000000::int)"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   120
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   121
11868
56db9f3a6b3e Numerals now work for the integers: the binary numerals for 0 and 1 rewrite
paulson
parents: 11704
diff changeset
   122
lemma "10000001 mod 2 = (1::int)"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   123
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   124
11704
3c50a2cd6f00 * sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents: 11701
diff changeset
   125
lemma "10000055 div 32 = (312501::int)"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   126
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   127
11704
3c50a2cd6f00 * sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents: 11701
diff changeset
   128
lemma "10000055 mod 32 = (23::int)"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   129
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   130
11704
3c50a2cd6f00 * sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents: 11701
diff changeset
   131
lemma "100094 div 144 = (695::int)"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   132
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   133
11704
3c50a2cd6f00 * sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents: 11701
diff changeset
   134
lemma "100094 mod 144 = (14::int)"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   135
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   136
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   137
12613
279facb4253a Literal arithmetic: raising numbers to powers (nat, int, real, hypreal)
paulson
parents: 11868
diff changeset
   138
text {* \medskip Powers *}
279facb4253a Literal arithmetic: raising numbers to powers (nat, int, real, hypreal)
paulson
parents: 11868
diff changeset
   139
279facb4253a Literal arithmetic: raising numbers to powers (nat, int, real, hypreal)
paulson
parents: 11868
diff changeset
   140
lemma "2 ^ 10 = (1024::int)"
279facb4253a Literal arithmetic: raising numbers to powers (nat, int, real, hypreal)
paulson
parents: 11868
diff changeset
   141
  by simp
279facb4253a Literal arithmetic: raising numbers to powers (nat, int, real, hypreal)
paulson
parents: 11868
diff changeset
   142
279facb4253a Literal arithmetic: raising numbers to powers (nat, int, real, hypreal)
paulson
parents: 11868
diff changeset
   143
lemma "-3 ^ 7 = (-2187::int)"
279facb4253a Literal arithmetic: raising numbers to powers (nat, int, real, hypreal)
paulson
parents: 11868
diff changeset
   144
  by simp
279facb4253a Literal arithmetic: raising numbers to powers (nat, int, real, hypreal)
paulson
parents: 11868
diff changeset
   145
279facb4253a Literal arithmetic: raising numbers to powers (nat, int, real, hypreal)
paulson
parents: 11868
diff changeset
   146
lemma "13 ^ 7 = (62748517::int)"
279facb4253a Literal arithmetic: raising numbers to powers (nat, int, real, hypreal)
paulson
parents: 11868
diff changeset
   147
  by simp
279facb4253a Literal arithmetic: raising numbers to powers (nat, int, real, hypreal)
paulson
parents: 11868
diff changeset
   148
279facb4253a Literal arithmetic: raising numbers to powers (nat, int, real, hypreal)
paulson
parents: 11868
diff changeset
   149
lemma "3 ^ 15 = (14348907::int)"
279facb4253a Literal arithmetic: raising numbers to powers (nat, int, real, hypreal)
paulson
parents: 11868
diff changeset
   150
  by simp
279facb4253a Literal arithmetic: raising numbers to powers (nat, int, real, hypreal)
paulson
parents: 11868
diff changeset
   151
279facb4253a Literal arithmetic: raising numbers to powers (nat, int, real, hypreal)
paulson
parents: 11868
diff changeset
   152
lemma "-5 ^ 11 = (-48828125::int)"
279facb4253a Literal arithmetic: raising numbers to powers (nat, int, real, hypreal)
paulson
parents: 11868
diff changeset
   153
  by simp
279facb4253a Literal arithmetic: raising numbers to powers (nat, int, real, hypreal)
paulson
parents: 11868
diff changeset
   154
279facb4253a Literal arithmetic: raising numbers to powers (nat, int, real, hypreal)
paulson
parents: 11868
diff changeset
   155
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   156
subsection {* The Natural Numbers *}
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   157
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   158
text {* Successor *}
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   159
11704
3c50a2cd6f00 * sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents: 11701
diff changeset
   160
lemma "Suc 99999 = 100000"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   161
  by (simp add: Suc_nat_number_of)
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   162
    -- {* not a default rewrite since sometimes we want to have @{text "Suc #nnn"} *}
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   163
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   164
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   165
text {* \medskip Addition *}
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   166
11704
3c50a2cd6f00 * sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents: 11701
diff changeset
   167
lemma "(13::nat) + 19 = 32"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   168
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   169
11704
3c50a2cd6f00 * sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents: 11701
diff changeset
   170
lemma "(1234::nat) + 5678 = 6912"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   171
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   172
11704
3c50a2cd6f00 * sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents: 11701
diff changeset
   173
lemma "(973646::nat) + 6475 = 980121"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   174
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   175
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   176
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   177
text {* \medskip Subtraction *}
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   178
11704
3c50a2cd6f00 * sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents: 11701
diff changeset
   179
lemma "(32::nat) - 14 = 18"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   180
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   181
11868
56db9f3a6b3e Numerals now work for the integers: the binary numerals for 0 and 1 rewrite
paulson
parents: 11704
diff changeset
   182
lemma "(14::nat) - 15 = 0"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   183
  by simp
5545
9117a0e2bf31 added correctness proofs for arithmetic
paulson
parents: 5199
diff changeset
   184
11868
56db9f3a6b3e Numerals now work for the integers: the binary numerals for 0 and 1 rewrite
paulson
parents: 11704
diff changeset
   185
lemma "(14::nat) - 1576644 = 0"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   186
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   187
11704
3c50a2cd6f00 * sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents: 11701
diff changeset
   188
lemma "(48273776::nat) - 3873737 = 44400039"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   189
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   190
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   191
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   192
text {* \medskip Multiplication *}
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   193
11704
3c50a2cd6f00 * sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents: 11701
diff changeset
   194
lemma "(12::nat) * 11 = 132"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   195
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   196
11704
3c50a2cd6f00 * sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents: 11701
diff changeset
   197
lemma "(647::nat) * 3643 = 2357021"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   198
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   199
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   200
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   201
text {* \medskip Quotient and Remainder *}
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   202
11704
3c50a2cd6f00 * sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents: 11701
diff changeset
   203
lemma "(10::nat) div 3 = 3"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   204
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   205
11868
56db9f3a6b3e Numerals now work for the integers: the binary numerals for 0 and 1 rewrite
paulson
parents: 11704
diff changeset
   206
lemma "(10::nat) mod 3 = 1"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   207
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   208
11704
3c50a2cd6f00 * sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents: 11701
diff changeset
   209
lemma "(10000::nat) div 9 = 1111"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   210
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   211
11868
56db9f3a6b3e Numerals now work for the integers: the binary numerals for 0 and 1 rewrite
paulson
parents: 11704
diff changeset
   212
lemma "(10000::nat) mod 9 = 1"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   213
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   214
11704
3c50a2cd6f00 * sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents: 11701
diff changeset
   215
lemma "(10000::nat) div 16 = 625"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   216
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   217
11868
56db9f3a6b3e Numerals now work for the integers: the binary numerals for 0 and 1 rewrite
paulson
parents: 11704
diff changeset
   218
lemma "(10000::nat) mod 16 = 0"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   219
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   220
5545
9117a0e2bf31 added correctness proofs for arithmetic
paulson
parents: 5199
diff changeset
   221
12613
279facb4253a Literal arithmetic: raising numbers to powers (nat, int, real, hypreal)
paulson
parents: 11868
diff changeset
   222
text {* \medskip Powers *}
279facb4253a Literal arithmetic: raising numbers to powers (nat, int, real, hypreal)
paulson
parents: 11868
diff changeset
   223
279facb4253a Literal arithmetic: raising numbers to powers (nat, int, real, hypreal)
paulson
parents: 11868
diff changeset
   224
lemma "2 ^ 12 = (4096::nat)"
279facb4253a Literal arithmetic: raising numbers to powers (nat, int, real, hypreal)
paulson
parents: 11868
diff changeset
   225
  by simp
279facb4253a Literal arithmetic: raising numbers to powers (nat, int, real, hypreal)
paulson
parents: 11868
diff changeset
   226
279facb4253a Literal arithmetic: raising numbers to powers (nat, int, real, hypreal)
paulson
parents: 11868
diff changeset
   227
lemma "3 ^ 10 = (59049::nat)"
279facb4253a Literal arithmetic: raising numbers to powers (nat, int, real, hypreal)
paulson
parents: 11868
diff changeset
   228
  by simp
279facb4253a Literal arithmetic: raising numbers to powers (nat, int, real, hypreal)
paulson
parents: 11868
diff changeset
   229
279facb4253a Literal arithmetic: raising numbers to powers (nat, int, real, hypreal)
paulson
parents: 11868
diff changeset
   230
lemma "12 ^ 7 = (35831808::nat)"
279facb4253a Literal arithmetic: raising numbers to powers (nat, int, real, hypreal)
paulson
parents: 11868
diff changeset
   231
  by simp
279facb4253a Literal arithmetic: raising numbers to powers (nat, int, real, hypreal)
paulson
parents: 11868
diff changeset
   232
279facb4253a Literal arithmetic: raising numbers to powers (nat, int, real, hypreal)
paulson
parents: 11868
diff changeset
   233
lemma "3 ^ 14 = (4782969::nat)"
279facb4253a Literal arithmetic: raising numbers to powers (nat, int, real, hypreal)
paulson
parents: 11868
diff changeset
   234
  by simp
279facb4253a Literal arithmetic: raising numbers to powers (nat, int, real, hypreal)
paulson
parents: 11868
diff changeset
   235
279facb4253a Literal arithmetic: raising numbers to powers (nat, int, real, hypreal)
paulson
parents: 11868
diff changeset
   236
lemma "5 ^ 11 = (48828125::nat)"
279facb4253a Literal arithmetic: raising numbers to powers (nat, int, real, hypreal)
paulson
parents: 11868
diff changeset
   237
  by simp
279facb4253a Literal arithmetic: raising numbers to powers (nat, int, real, hypreal)
paulson
parents: 11868
diff changeset
   238
279facb4253a Literal arithmetic: raising numbers to powers (nat, int, real, hypreal)
paulson
parents: 11868
diff changeset
   239
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   240
text {* \medskip Testing the cancellation of complementary terms *}
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   241
11868
56db9f3a6b3e Numerals now work for the integers: the binary numerals for 0 and 1 rewrite
paulson
parents: 11704
diff changeset
   242
lemma "y + (x + -x) = (0::int) + y"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   243
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   244
11868
56db9f3a6b3e Numerals now work for the integers: the binary numerals for 0 and 1 rewrite
paulson
parents: 11704
diff changeset
   245
lemma "y + (-x + (- y + x)) = (0::int)"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   246
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   247
11868
56db9f3a6b3e Numerals now work for the integers: the binary numerals for 0 and 1 rewrite
paulson
parents: 11704
diff changeset
   248
lemma "-x + (y + (- y + x)) = (0::int)"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   249
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   250
11868
56db9f3a6b3e Numerals now work for the integers: the binary numerals for 0 and 1 rewrite
paulson
parents: 11704
diff changeset
   251
lemma "x + (x + (- x + (- x + (- y + - z)))) = (0::int) - y - z"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   252
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   253
11868
56db9f3a6b3e Numerals now work for the integers: the binary numerals for 0 and 1 rewrite
paulson
parents: 11704
diff changeset
   254
lemma "x + x - x - x - y - z = (0::int) - y - z"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   255
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   256
11868
56db9f3a6b3e Numerals now work for the integers: the binary numerals for 0 and 1 rewrite
paulson
parents: 11704
diff changeset
   257
lemma "x + y + z - (x + z) = y - (0::int)"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   258
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   259
11868
56db9f3a6b3e Numerals now work for the integers: the binary numerals for 0 and 1 rewrite
paulson
parents: 11704
diff changeset
   260
lemma "x + (y + (y + (y + (-x + -x)))) = (0::int) + y - x + y + y"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   261
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   262
11868
56db9f3a6b3e Numerals now work for the integers: the binary numerals for 0 and 1 rewrite
paulson
parents: 11704
diff changeset
   263
lemma "x + (y + (y + (y + (-y + -x)))) = y + (0::int) + y"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   264
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   265
11868
56db9f3a6b3e Numerals now work for the integers: the binary numerals for 0 and 1 rewrite
paulson
parents: 11704
diff changeset
   266
lemma "x + y - x + z - x - y - z + x < (1::int)"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   267
  by simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   268
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   269
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   270
subsection {* Normal form of bit strings *}
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   271
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   272
text {*
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   273
  Definition of normal form for proving that binary arithmetic on
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   274
  normalized operands yields normalized results.  Normal means no
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   275
  leading 0s on positive numbers and no leading 1s on negatives.
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   276
*}
5545
9117a0e2bf31 added correctness proofs for arithmetic
paulson
parents: 5199
diff changeset
   277
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   278
consts normal :: "bin set"
11637
647e6c84323c inductive: no collective atts;
wenzelm
parents: 11024
diff changeset
   279
inductive normal
647e6c84323c inductive: no collective atts;
wenzelm
parents: 11024
diff changeset
   280
  intros
647e6c84323c inductive: no collective atts;
wenzelm
parents: 11024
diff changeset
   281
    Pls [simp]: "Pls: normal"
647e6c84323c inductive: no collective atts;
wenzelm
parents: 11024
diff changeset
   282
    Min [simp]: "Min: normal"
647e6c84323c inductive: no collective atts;
wenzelm
parents: 11024
diff changeset
   283
    BIT_F [simp]: "w: normal ==> w \<noteq> Pls ==> w BIT False : normal"
647e6c84323c inductive: no collective atts;
wenzelm
parents: 11024
diff changeset
   284
    BIT_T [simp]: "w: normal ==> w \<noteq> Min ==> w BIT True : normal"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   285
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   286
text {*
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   287
  \medskip Binary arithmetic on normalized operands yields normalized
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   288
  results.
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   289
*}
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   290
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   291
lemma normal_BIT_I [simp]: "w BIT b \<in> normal ==> w BIT b BIT c \<in> normal"
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   292
  apply (case_tac c)
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   293
   apply auto
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   294
  done
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   295
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   296
lemma normal_BIT_D: "w BIT b \<in> normal ==> w \<in> normal"
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   297
  apply (erule normal.cases)
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   298
     apply auto
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   299
  done
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   300
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   301
lemma NCons_normal [simp]: "w \<in> normal ==> NCons w b \<in> normal"
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   302
  apply (induct w)
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   303
    apply (auto simp add: NCons_Pls NCons_Min)
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   304
  done
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   305
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   306
lemma NCons_True: "NCons w True \<noteq> Pls"
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   307
  apply (induct w)
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   308
    apply auto
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   309
  done
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   310
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   311
lemma NCons_False: "NCons w False \<noteq> Min"
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   312
  apply (induct w)
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   313
    apply auto
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   314
  done
5545
9117a0e2bf31 added correctness proofs for arithmetic
paulson
parents: 5199
diff changeset
   315
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   316
lemma bin_succ_normal [simp]: "w \<in> normal ==> bin_succ w \<in> normal"
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   317
  apply (erule normal.induct)
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   318
     apply (case_tac [4] w)
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   319
  apply (auto simp add: NCons_True bin_succ_BIT)
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   320
  done
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   321
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   322
lemma bin_pred_normal [simp]: "w \<in> normal ==> bin_pred w \<in> normal"
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   323
  apply (erule normal.induct)
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   324
     apply (case_tac [3] w)
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   325
  apply (auto simp add: NCons_False bin_pred_BIT)
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   326
  done
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   327
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   328
lemma bin_add_normal [rule_format]:
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   329
  "w \<in> normal --> (\<forall>z. z \<in> normal --> bin_add w z \<in> normal)"
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   330
  apply (induct w)
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   331
    apply simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   332
   apply simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   333
  apply (rule impI)
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   334
  apply (rule allI)
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   335
  apply (induct_tac z)
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   336
    apply (simp_all add: bin_add_BIT)
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   337
  apply (safe dest!: normal_BIT_D)
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   338
    apply simp_all
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   339
  done
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   340
11868
56db9f3a6b3e Numerals now work for the integers: the binary numerals for 0 and 1 rewrite
paulson
parents: 11704
diff changeset
   341
lemma normal_Pls_eq_0: "w \<in> normal ==> (w = Pls) = (number_of w = (0::int))"
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   342
  apply (erule normal.induct)
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   343
     apply auto
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   344
  done
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   345
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   346
lemma bin_minus_normal: "w \<in> normal ==> bin_minus w \<in> normal"
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   347
  apply (erule normal.induct)
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   348
     apply (simp_all add: bin_minus_BIT)
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   349
  apply (rule normal.intros)
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   350
  apply assumption
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   351
  apply (simp add: normal_Pls_eq_0)
11868
56db9f3a6b3e Numerals now work for the integers: the binary numerals for 0 and 1 rewrite
paulson
parents: 11704
diff changeset
   352
  apply (simp only: number_of_minus iszero_def zminus_equation [of _ "0"])
11024
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   353
  apply (rule not_sym)
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   354
  apply simp
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   355
  done
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   356
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   357
lemma bin_mult_normal [rule_format]:
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   358
    "w \<in> normal ==> z \<in> normal --> bin_mult w z \<in> normal"
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   359
  apply (erule normal.induct)
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   360
     apply (simp_all add: bin_minus_normal bin_mult_BIT)
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   361
  apply (safe dest!: normal_BIT_D)
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   362
  apply (simp add: bin_add_normal)
23bf8d787b04 converted to new-style theories;
wenzelm
parents: 9297
diff changeset
   363
  done
5545
9117a0e2bf31 added correctness proofs for arithmetic
paulson
parents: 5199
diff changeset
   364
9117a0e2bf31 added correctness proofs for arithmetic
paulson
parents: 5199
diff changeset
   365
end