4
(declare (xargs :guard t))
8
(local (include-book "../support/support/bvecp"))
13
(declare (xargs :guard (integerp k)))
18
(defthm bvecp-with-n-not-a-positive-integer
19
(implies (or (not (integerp k))
28
;just a special case of bvecp-with-n-not-a-positive-integer
34
(implies (case-split (<= 0 k))
35
(bvecp (+ -1 (expt 2 k)) k)))
39
(implies (and (bvecp x k1)
41
(case-split (integerp k2))
44
:rule-classes ((:rewrite :match-free :all)))
46
;expensive and so disabled
48
(defthmd bvecp-one-longer
49
(implies (and (integerp k)
52
:rule-classes ((:rewrite :backchain-limit-lst (nil 2))))
55
(defthm bvecp-of-non-integer
56
(implies (not (integerp x))
59
;gen (replace n+1 with an arbitrary integer > n)?
60
(defthm bvecp-expt-2-n
61
(implies (and (case-split (integerp n))
64
(bvecp (expt 2 n) (+ 1 n))))
66
; The following lemma can be critical during backchaining. Imagine that ACL2
67
; backchains to (bvecp (if test x y) k) and we know (bvecp x k) and (bvecp y
68
; k). ACL2 may fail to relieve the hyp because it is merely rewriting; there is
69
; no case splitting. So we need a rule about bvecp applied to an if
72
(equal (bvecp (if test x y) k)
73
(if test (bvecp x k) (bvecp y k))))
76
; The following are analogous to mk-bvarr etc. in rtlarr.lisp.
80
(declare (xargs :guard (integerp k)))
83
(defthm mk-bvec-is-bvecp
84
(bvecp (mk-bvec r k) k))
86
(defthm mk-bvec-identity
88
(equal (mk-bvec r k) r)))
90
;BOZO make a version to shift by a constant!
92
(implies (and (integerp x) ;note!
94
(case-split (integerp m))
95
(case-split (integerp n))
97
(equal (bvecp (* x (expt 2 m)) n)
100
(defthm bvecp-shift-alt
101
(implies (and (integerp x) ;note!
103
(case-split (integerp m))
104
(case-split (integerp n))
106
(equal (bvecp (* (expt 2 m) x) n)
110
;BOZO will this unify (* 2 x) with 0??
111
(defthm bvecp-shift-by-2
112
(implies (and (syntaxp (not (quotep x))) ;prevents loops...
115
(case-split (integerp m))
116
(case-split (integerp n))
118
(equal (bvecp (* 2 x) n)
123
;in general, rewrite (bvecp k n) where k is a constant to a fact about n
125
(implies (and (<= 1 n)
129
;n is a free variable
130
;Disabled since may cause expensive backchaining.
134
:rule-classes ((:rewrite :match-free :once)))
136
(defthmd bvecp-forward
140
(< x (expt 2 k)))) ;tigher-bound?
141
:rule-classes :forward-chaining)
143
(defthm bvecp-product
144
(implies (and (bvecp x m)
147
(bvecp (* x y) (+ m n)))
150
(defthmd bvecp-1-rewrite
152
(or (equal x 0) (equal x 1))))
154
;make another for not-equal-0 implies equal-1?
156
(implies (and (bvecp x 1)
159
:rule-classes :forward-chaining)
162
(implies (and (natp n)
166
;same as bvecp-longer.decide which param names to use. j and k??
167
(defthmd bvecp-monotone
168
(implies (and (bvecp x n)
170
(case-split (integerp m))
175
;This bounds the amount of carry out that we can have from the sum.
176
(defthm bvecp-sum-of-bvecps
177
(implies (and (bvecp x (+ -1 k))
179
(case-split (integerp k)))
183
;add rule that (not (natp x)) implies (not (bvecp x k)) ??
187
(implies (and (bvecp x 1)
190
:rule-classes :forward-chaining)
b'\\ No newline at end of file'