3
;don't need everything in this book!
4
(local (include-book "numerator"))
5
(local (include-book "denominator"))
6
(local (include-book "nniq"))
7
(local (include-book "arith2"))
8
;(local (include-book "type"))
9
(local (include-book "ground-zero"))
10
(local (include-book "floor"))
11
(local (include-book "integerp"))
12
(local (include-book "rationalp"))
13
(local (include-book "unary-divide"))
14
(local (include-book "expt"))
15
(local (include-book "expo"))
16
(local (include-book "power2p"))
17
(local (include-book "fl"))
19
(local (in-theory (enable expt-minus)))
22
(declare (xargs :guard (real/rationalp x)))
25
;more general vesions of this below. kill this one?
27
(implies (case-split (rationalp x))
28
(equal (FL (* 1/2 (FL (* X (/ (EXPT 2 N))))))
29
(FL (* 1/2 X (/ (EXPT 2 N))))))
30
:hints (("Goal" :in-theory (disable fl-def-linear)
33
(x (* 1/2 (FL (* X (/ (EXPT 2 N))))))
34
(n (FL (* 1/2 X (/ (EXPT 2 N))))))
35
(:instance fl-def-linear (x (* 1/2 X (/ (EXPT 2 N)))))))))
41
(local (defthm fl-shift-fl-case-1
43
(equal (FL (* (FL X) (/ (expt 2 m))))
44
(FL (* X (/ (EXPT 2 m))))))
45
:hints (("Goal" :cases ((rationalp x))))
48
(local (defthm fl-shift-fl-case-2
50
(case-split (INTEGERP M))
52
(equal (FL (* (FL X) (/ (expt 2 m))))
53
(* (FL x) (/ (expt 2 m)))))
54
:hints (("Goal" :in-theory (disable fl-int)
55
:use (:instance fl-int (x (* (/ (expt 2 m)) (FL X))))))))
59
;can this be extended to let the out fl be of a sum?
60
;leave the case-1 event enabled too (not integerp hyp)?
62
(implies (case-split (INTEGERP M))
63
(equal (FL (* (/ (expt 2 m)) (FL X)))
65
(FL (* (/ (EXPT 2 m)) X))
66
(* (/ (expt 2 m)) (FL x)))))
67
:hints (("Goal" :cases ((< m 0))))
73
(defthm fl-shift-fl-case-1-gen
74
(implies (and (rationalp x)
79
(equal (fl (* (/ (expt 2 m)) (+ y (* 2 (fl (* 1/2 x))))))
80
(fl (* (/ (expt 2 m)) (+ y x)))))
82
:hints (("Goal" :in-theory (disable FL-DEF-LINEAR-PART-1
85
; LESS-THAN-MULTIPLY-THROUGH-BY-inverted-factor-FROM-LEFT-HAND-SIDE
88
(:instance FL-DEF-LINEAR-part-1
89
(x (+ (* X (/ (EXPT 2 M)))
90
(* Y (/ (EXPT 2 M))))))
91
(:instance FL-DEF-LINEAR-part-1
93
(:instance FL-DEF-LINEAR-part-2
94
(x (+ (* X (/ (EXPT 2 M)))
95
(* Y (/ (EXPT 2 M))))))
96
(:instance FL-DEF-LINEAR-part-2
100
(x (* (/ (expt 2 m)) (+ y (* 2 (FL (* 1/2 X))))))
101
(n (FL (* (/ (EXPT 2 m)) (+ y X)))))))))
104
(defthm fl-shift-fl-2-factors
105
(implies (AND ;(case-split (rationalp x))
106
(case-split (INTEGERP M))
107
(case-split (INTEGERP n))
109
(equal (FL (* (/ (expt 2 m)) (expt 2 n) (FL X)))
111
(FL (* (/ (EXPT 2 (- m n))) X))
112
(* (/ (expt 2 (- m n))) (FL x)))))
113
:hints (("Goal" :in-theory (set-difference-theories
115
'( fl-shift-fl ;EXPO-COMPARISON-REWRITE-TO-BOUND
117
:use (:instance fl-shift-fl (m (- m n))))))
119
(defthm fl-shift-fl-2-factors-2
120
(implies (AND ;(case-split (rationalp x))
121
(case-split (INTEGERP M))
122
(case-split (INTEGERP n))
124
(equal (FL (* (expt 2 n) (/ (expt 2 m)) (FL X)))
126
(fl (* (/ (EXPT 2 (- m n))) X))
127
(* (/ (expt 2 (- m n))) (FL x)))))
128
:hints (("Goal" :in-theory (set-difference-theories
130
'( fl-shift-fl EXPO-COMPARISON-REWRITE-TO-BOUND))
131
:use (:instance fl-shift-fl (m (- m n))))))
135
;(FL (* 2 (/ (EXPT 2 K)) (FL (* 1/2 X))))
138
(defthm fl-shift-fl-by-1
139
(EQUAL (FL (* 1/2 (FL X)))
141
:hints (("Goal" :use (:instance fl-shift-fl (m 1)))))