src/ZF/ex/BinEx.thy
author haftmann
Fri, 14 Jun 2019 08:34:28 +0000
changeset 70347 e5cd5471c18a
parent 65449 c82e63b11b8b
child 76213 e44d86131648
permissions -rw-r--r--
official fact collection sign_simps
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
35762
af3ff2ba4c54 removed old CVS Ids;
wenzelm
parents: 16417
diff changeset
     1
(*  Title:      ZF/ex/BinEx.thy
11399
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
     2
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
     3
    Copyright   1994  University of Cambridge
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
     4
35762
af3ff2ba4c54 removed old CVS Ids;
wenzelm
parents: 16417
diff changeset
     5
Examples of performing binary arithmetic by simplification.
11399
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
     6
*)
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
     7
65449
c82e63b11b8b clarified main ZF.thy / ZFC.thy, and avoid name clash with global HOL/Main.thy;
wenzelm
parents: 61395
diff changeset
     8
theory BinEx imports ZF begin
11399
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
     9
(*All runtimes below are on a 300MHz Pentium*)
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    10
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    11
lemma "#13  $+  #19 = #32"
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    12
by simp (*0 secs*)
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    13
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    14
lemma "#1234  $+  #5678 = #6912"
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    15
by simp (*190 msec*)
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    16
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    17
lemma "#1359  $+  #-2468 = #-1109"
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    18
by simp (*160 msec*)
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    19
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    20
lemma "#93746  $+  #-46375 = #47371"
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    21
by simp (*300 msec*)
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    22
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    23
lemma "$- #65745 = #-65745"
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    24
by simp (*80 msec*)
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    25
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    26
(* negation of ~54321 *)
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    27
lemma "$- #-54321 = #54321"
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    28
by simp (*90 msec*)
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    29
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    30
lemma "#13  $*  #19 = #247"
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    31
by simp (*110 msec*)
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    32
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    33
lemma "#-84  $*  #51 = #-4284"
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    34
by simp (*210 msec*)
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    35
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    36
(*The worst case for 8-bit operands *)
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    37
lemma "#255  $*  #255 = #65025"
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    38
by simp (*730 msec*)
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    39
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    40
lemma "#1359  $*  #-2468 = #-3354012"
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    41
by simp (*1.04 secs*)
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    42
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    43
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    44
(** Comparisons **)
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    45
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    46
lemma "(#89) $* #10 \<noteq> #889"
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    47
by simp
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    48
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    49
lemma "(#13) $< #18 $- #4"
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    50
by simp
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    51
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    52
lemma "(#-345) $< #-242 $+ #-100"
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    53
by simp
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    54
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    55
lemma "(#13557456) $< #18678654"
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    56
by simp
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    57
61395
4f8c2c4a0a8c tuned syntax -- more symbols;
wenzelm
parents: 35762
diff changeset
    58
lemma "(#999999) $\<le> (#1000001 $+ #1) $- #2"
11399
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    59
by simp
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    60
61395
4f8c2c4a0a8c tuned syntax -- more symbols;
wenzelm
parents: 35762
diff changeset
    61
lemma "(#1234567) $\<le> #1234567"
11399
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    62
by simp
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    63
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    64
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    65
(*** Quotient and remainder!! [they could be faster] ***)
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    66
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    67
lemma "#23 zdiv #3 = #7"
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    68
by simp
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    69
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    70
lemma "#23 zmod #3 = #2"
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    71
by simp
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    72
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    73
(** negative dividend **)
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    74
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    75
lemma "#-23 zdiv #3 = #-8"
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    76
by simp
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    77
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    78
lemma "#-23 zmod #3 = #1"
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    79
by simp
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    80
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    81
(** negative divisor **)
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    82
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    83
lemma "#23 zdiv #-3 = #-8"
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    84
by simp
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    85
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    86
lemma "#23 zmod #-3 = #-1"
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    87
by simp
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    88
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    89
(** Negative dividend and divisor **)
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    90
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    91
lemma "#-23 zdiv #-3 = #7"
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    92
by simp
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    93
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    94
lemma "#-23 zmod #-3 = #-2"
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    95
by simp
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    96
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    97
end
1605aeb98fd5 two Isar tactic scripts
paulson
parents:
diff changeset
    98