9
((local-ifloor * *) => *)
10
((local-imod * *) => *)
11
((local-expt2 *) => *)
12
((local-logcar *) => *)
13
((local-loghead * *) => *)
14
((local-logtail * *) => *)
15
((local-logapp * * *) => *)
22
(defun local-ifloor (i j)
23
(floor (ifix i) (ifix j)))
25
(defun local-imod (i j)
26
(mod (ifix i) (ifix j)))
28
(defun local-expt2 (n)
31
(defun local-logcar (i)
34
(defun local-loghead (size i)
35
(local-imod i (local-expt2 size)))
37
(defun local-logtail (pos i)
38
(local-ifloor i (local-expt2 pos)))
40
(defun local-logapp (size i j)
42
(+ (local-loghead size i) (* j (local-expt2 size)))))
46
(defthm local-ifloor-defn
47
(equal (local-ifloor i j)
48
(floor (ifix i) (ifix j))))
50
(defthm local-imod-defn
51
(equal (local-imod i j)
52
(mod (ifix i) (ifix j))))
54
(defthm local-expt2-defn
55
(equal (local-expt2 n)
58
(defthm local-logcar-defn
59
(equal (local-logcar i)
62
(defthm local-loghead-defn
63
(equal (local-loghead size i)
64
(local-imod i (local-expt2 size))))
66
(defthm local-logtail-defn
67
(equal (local-logtail size i)
68
(local-ifloor i (local-expt2 size))))
70
(defthm local-logapp-defn
71
(equal (local-logapp size i j)
73
(+ (local-loghead size i) (* j (local-expt2 size))))))
80
(local (include-book "arithmetic-3/bind-free/top" :dir :system))
82
(local (include-book "arithmetic-3/floor-mod/floor-mod" :dir :system))
84
; Matt K.: There was formerly a set-default-hints at the end of an embedded
85
; encapsulate, which had no effect since set-default-hints was local to that
88
(defthm local-special-32-bit-overflow-reduction
92
(equal (local-loghead 16 c) 0)
95
(equal (signed-byte-p 32 (+ c x))
96
(signed-byte-p 16 (+ (local-logtail 16 c) (local-logtail 16 x))))))
103
(include-book "ihs/ihs-lemmas" :dir :system)
105
(defthm special-32-bit-overflow-reduction
109
(equal (loghead 16 c) 0)
112
(equal (signed-byte-p 32 (+ c x))
113
(signed-byte-p 16 (+ (logtail 16 c) (logtail 16 x)))))
114
:hints (("Goal" :in-theory `(logapp loghead logtail logcar expt2 imod ifloor)
115
:use (:functional-instance
116
local-special-32-bit-overflow-reduction
117
(local-ifloor ifloor)
120
(local-logcar logcar)
121
(local-loghead loghead)
122
(local-logtail logtail)
123
(local-logapp logapp)))))
1
; Computational Object Inference
2
; Copyright (C) 2005-2014 Kookamara LLC
7
; 11410 Windermere Meadows
8
; Austin, TX 78759, USA
9
; http://www.kookamara.com/
11
; License: (An MIT/X11-style license)
13
; Permission is hereby granted, free of charge, to any person obtaining a
14
; copy of this software and associated documentation files (the "Software"),
15
; to deal in the Software without restriction, including without limitation
16
; the rights to use, copy, modify, merge, publish, distribute, sublicense,
17
; and/or sell copies of the Software, and to permit persons to whom the
18
; Software is furnished to do so, subject to the following conditions:
20
; The above copyright notice and this permission notice shall be included in
21
; all copies or substantial portions of the Software.
23
; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28
; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29
; DEALINGS IN THE SOFTWARE.
39
((local-ifloor * *) => *)
40
((local-imod * *) => *)
41
((local-expt2 *) => *)
42
((local-logcar *) => *)
43
((local-loghead * *) => *)
44
((local-logtail * *) => *)
45
((local-logapp * * *) => *)
52
(defun local-ifloor (i j)
53
(floor (ifix i) (ifix j)))
55
(defun local-imod (i j)
56
(mod (ifix i) (ifix j)))
58
(defun local-expt2 (n)
61
(defun local-logcar (i)
64
(defun local-loghead (size i)
65
(local-imod i (local-expt2 size)))
67
(defun local-logtail (pos i)
68
(local-ifloor i (local-expt2 pos)))
70
(defun local-logapp (size i j)
72
(+ (local-loghead size i) (* j (local-expt2 size)))))
76
(defthm local-ifloor-defn
77
(equal (local-ifloor i j)
78
(floor (ifix i) (ifix j))))
80
(defthm local-imod-defn
81
(equal (local-imod i j)
82
(mod (ifix i) (ifix j))))
84
(defthm local-expt2-defn
85
(equal (local-expt2 n)
88
(defthm local-logcar-defn
89
(equal (local-logcar i)
92
(defthm local-loghead-defn
93
(equal (local-loghead size i)
94
(local-imod i (local-expt2 size))))
96
(defthm local-logtail-defn
97
(equal (local-logtail size i)
98
(local-ifloor i (local-expt2 size))))
100
(defthm local-logapp-defn
101
(equal (local-logapp size i j)
103
(+ (local-loghead size i) (* j (local-expt2 size))))))
110
(local (include-book "arithmetic-3/bind-free/top" :dir :system))
112
(local (include-book "arithmetic-3/floor-mod/floor-mod" :dir :system))
114
; Matt K.: There was formerly a set-default-hints at the end of an embedded
115
; encapsulate, which had no effect since set-default-hints was local to that
118
(defthm local-special-32-bit-overflow-reduction
122
(equal (local-loghead 16 c) 0)
125
(equal (signed-byte-p 32 (+ c x))
126
(signed-byte-p 16 (+ (local-logtail 16 c) (local-logtail 16 x))))))
133
(include-book "ihs/ihs-lemmas" :dir :system)
135
(defthm special-32-bit-overflow-reduction
139
(equal (loghead 16 c) 0)
142
(equal (signed-byte-p 32 (+ c x))
143
(signed-byte-p 16 (+ (logtail 16 c) (logtail 16 x)))))
144
:hints (("Goal" :in-theory `(logapp loghead logtail logcar expt2 imod ifloor)
145
:use (:functional-instance
146
local-special-32-bit-overflow-reduction
147
(local-ifloor ifloor)
150
(local-logcar logcar)
151
(local-loghead loghead)
152
(local-logtail logtail)
153
(local-logapp logapp)))))