File: tm-floor.lisp

package info (click to toggle)
acl2 8.6%2Bdfsg-2
  • links: PTS
  • area: main
  • in suites: trixie
  • size: 1,111,420 kB
  • sloc: lisp: 17,818,294; java: 125,359; python: 28,122; javascript: 23,458; cpp: 18,851; ansic: 11,569; perl: 7,678; xml: 5,591; sh: 3,976; makefile: 3,833; ruby: 2,633; yacc: 1,126; ml: 763; awk: 295; csh: 233; lex: 197; php: 178; tcl: 49; asm: 23; haskell: 17
file content (347 lines) | stat: -rw-r--r-- 9,227 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
; Copyright (C) 2007 by Shant Harutunian
; License: A 3-clause BSD license.  See the LICENSE file distributed with ACL2.

(in-package "ACL2")

(include-book "arith-nsa4")
(include-book "nsa")
(include-book "computed-hints")

(in-theory (disable i-large))
(in-theory (disable standard-part-<=))

(defthm tm-floor-thm-hint-1
  (implies
   (and
    (realp tm)
    (realp eps)
    (< 0 eps)
    (i-small eps))
   (equal (standard-part (* eps (floor1 (/ tm eps))))
          (standard-part tm)))
  :rule-classes nil
  :hints ((standard-part-hint stable-under-simplificationp clause)
          ("Goal" :in-theory (disable  <-CANCEL-DIVISORS)
           :use ((:instance pos-factor-<-thm (x (- (/ tm eps) 1))
                            (y (floor1 (/ tm eps))) (a eps))
                 (:instance pos-factor-<=-thm (x (floor1 (/ tm eps)))
                            (y (/ tm eps)) (a eps))))))

(defthm tm-floor-thm
  (implies
   (and
    (realp tm)
    (standard-numberp tm))
   (equal (STANDARD-PART (* (/ (I-LARGE-INTEGER))
                            (FLOOR1 (* (I-LARGE-INTEGER) TM))))
          tm))
  :hints (("Goal" :use ((:instance tm-floor-thm-hint-1
                                   (eps (/ (i-large-integer))))))))

(defthm tm-floor-limited-thm
  (implies
   (and
    (realp tm)
    (standard-numberp tm))
   (i-limited (* (/ (I-LARGE-INTEGER))
                 (FLOOR1 (* (I-LARGE-INTEGER) TM)))))
  :hints (("Goal" :use ((:instance standard+small->i-limited
                                   (x (standard-part
                                       (* (/ (I-LARGE-INTEGER))
                                          (FLOOR1 (* (I-LARGE-INTEGER) TM)))))
                                   (eps (- (* (/ (I-LARGE-INTEGER))
                                              (FLOOR1 (* (I-LARGE-INTEGER) TM)))
                                           (standard-part
                                            (* (/ (I-LARGE-INTEGER))
                                               (FLOOR1 (* (I-LARGE-INTEGER) TM)))
                                            ))))))))

(defthm tm-floor-*a-hint-1
  (implies
   (and
    (realp tm)
    (realp a)
    (i-limited a)
    (standard-numberp tm))
   (equal (STANDARD-PART (* a (/ (I-LARGE-INTEGER))
                            (FLOOR1 (* (I-LARGE-INTEGER) TM))))
          (standard-part (* a tm))))
  :rule-classes nil
  :hints (("Goal" :in-theory (disable *-COMMUT-3WAY))))

(defthm tm-floor-*a-thm
  (implies
   (and
    (realp tm)
    (realp a)
    (i-limited a)
    (standard-numberp tm))
   (equal (STANDARD-PART (* (/ (I-LARGE-INTEGER)) a
                            (FLOOR1 (* (I-LARGE-INTEGER) TM))))
          (standard-part (* a tm))))
  :hints (("Goal" :in-theory (disable i-large)
           :use ((:instance tm-floor-*a-hint-1)))))

(defun tm-fun (tm)
  (* (/ (I-LARGE-INTEGER))
     (FLOOR1 (* (I-LARGE-INTEGER) TM))))

(defthm tm-fun-limited-thm
  (implies
   (and
    (realp a)
    (realp tm)
    (standard-numberp tm))
   (i-limited (tm-fun tm))))

(defthm tm-fun-standard-part-thm
  (implies
   (and
    (realp a)
    (realp tm)
    (standard-numberp tm))
   (equal (standard-part (tm-fun tm))
          tm)))

(defthm tm-fun-rw-1-thm
  (implies
   (and
    (realp tm)
    (standard-numberp tm))
   (equal (* (/ (I-LARGE-INTEGER))
             (FLOOR1 (* (I-LARGE-INTEGER) TM)))
          (tm-fun tm))))

(defthm tm-fun-rw-2-thm
  (implies
   (and
    (realp a)
    (realp tm)
    (standard-numberp tm))
   (equal (* (/ (I-LARGE-INTEGER)) a
             (FLOOR1 (* (I-LARGE-INTEGER) TM)))
          (* (tm-fun tm) a)))
  :hints (("Goal" :in-theory (disable tm-fun-rw-1-thm))))

(defthm tm-fun-rw-3-thm
  (implies
   (and
    (realp a)
    (realp tm)
    (standard-numberp tm))
   (equal (* (/ (I-LARGE-INTEGER))
             (FLOOR1 (* (I-LARGE-INTEGER) TM))
             a)
          (* (tm-fun tm) a)))
  :hints (("Goal" :in-theory (disable tm-fun-rw-1-thm tm-fun-rw-2-thm))))

(defthm tm-fun-rw-4-thm
  (implies
   (and
    (realp a)
    (realp b)
    (realp tm)
    (standard-numberp tm))
   (equal (* (/ (I-LARGE-INTEGER))
             a
             (FLOOR1 (* (I-LARGE-INTEGER) TM))
             b)
          (* (tm-fun tm) a b)))
  :hints (("Goal" :in-theory (disable tm-fun-rw-1-thm
                                      tm-fun-rw-2-thm
                                      tm-fun-rw-3-thm))))

;; tm-fun should be disabled. Enabling it may result in rewrite loops.

(in-theory (disable tm-fun))

(defun eps-n-fun (eps n)
  (* eps n))

(defthm eps-n-fun-type-thm
  (implies
   (and
    (realp eps)
    (realp n))
   (realp (eps-n-fun eps n)))
  :rule-classes :type-prescription)

(defthm eps-n-fun-0-thm
  (equal (eps-n-fun eps 0) 0))

(defthm eps-n-fun-limited-thm
  (implies
   (and
    (realp eps)
    (integerp n)
    (i-limited (* eps n)))
   (i-limited (eps-n-fun eps n))))

(defthm eps-n-fun-rw-1-thm
  (implies
   (and
    (integerp n)
    (realp eps)
    (syntaxp (eq eps 'eps))
    (i-limited (* eps n)))
   (equal (* eps n)
          (eps-n-fun eps n))))

(defthm eps-n-fun-rw-2-thm
  (implies
   (and
    (realp a)
    (syntaxp (eq eps 'eps))
    (integerp n)
    (realp eps)
    (i-limited (* eps n)))
   (equal (* eps a n)
          (* (eps-n-fun eps n) a)))
  :hints (("Goal" :in-theory (disable eps-n-fun-rw-1-thm))))

(defthm eps-n-fun-rw-3-thm
  (implies
   (and
    (realp a)
    (syntaxp (eq eps 'eps))
    (integerp n)
    (realp eps)
    (i-limited (* eps n)))
   (equal (* eps n a)
          (* (eps-n-fun eps n) a)))
  :hints (("Goal" :in-theory (disable eps-n-fun-rw-1-thm
                                      eps-n-fun-rw-2-thm))))

(defthm eps-n-fun-rw-4-thm
  (implies
   (and
    (realp a)
    (realp b)
    (syntaxp (eq eps 'eps))
    (integerp n)
    (realp eps)
    (i-limited (* eps n)))
   (equal (* eps a n b)
          (* (eps-n-fun eps n) a b)))
  :hints (("Goal" :in-theory (disable eps-n-fun-rw-1-thm
                                      eps-n-fun-rw-2-thm
                                      eps-n-fun-rw-3-thm))))

;; eps-n-fun should be disabled. Enabling it may result in rewrite loops.

(in-theory (disable eps-n-fun))

(defun tm-eps-fun (tm eps)
  (* eps
     (FLOOR1 (/ TM eps))))

(defthm tm-eps-type
  (implies
   (realp eps)
   (realp (tm-eps-fun tm eps)))
  :rule-classes :type-prescription
  :hints (("Goal" :in-theory (enable tm-eps-fun))))

(defthm tm-eps-pos-thm
  (implies
   (and
    (realp tm)
    (realp eps)
    (<= 0 tm)
    (< 0 eps))
   (<= 0 (tm-eps-fun tm eps)))
  :rule-classes :type-prescription
  :hints (("Goal" :in-theory (enable tm-eps-fun))))

(defthm tm-eps-fun-standard-part-thm
  (implies
   (and
    (realp eps)
    (< 0 eps)
    (i-small eps)
    (realp tm)
    (standard-numberp tm))
   (equal (standard-part (tm-eps-fun tm eps))
          tm))
  :hints (("Goal" :use ((:instance tm-floor-thm-hint-1)))))

(defthm tm-eps-fun-limited-thm
  (implies
   (and
    (realp eps)
    (< 0 eps)
    (i-small eps)
    (realp tm)
    (standard-numberp tm))
   (i-limited (tm-eps-fun tm eps)))
  :hints (("Goal" :in-theory (disable tm-eps-fun)
           :use ((:instance standard+small->i-limited
                            (x (standard-part (tm-eps-fun tm eps)))
                            (eps (- (tm-eps-fun tm eps)
                                    (standard-part
                                     (tm-eps-fun tm eps)))))))))

(defthm tm-eps-fun-rw-1-thm
  (implies
   (and
    (realp eps)
    (< 0 eps)
    (i-small eps)
    (realp tm)
    (standard-numberp tm))
   (equal (* eps
             (FLOOR1 (* (/ EPS) TM)))
          (tm-eps-fun tm eps))))

(defthm tm-eps-fun-rw-2-thm
  (implies
   (and
    (realp eps)
    (< 0 eps)
    (i-small eps)
    (realp a)
    (realp tm)
    (standard-numberp tm))
   (equal (* eps a
             (FLOOR1 (* (/ EPS) TM)))
          (* (tm-eps-fun tm eps) a)))
  :hints (("Goal" :in-theory (disable tm-eps-fun-rw-1-thm))))

(defthm tm-eps-fun-rw-3-thm
  (implies
   (and
    (realp eps)
    (< 0 eps)
    (i-small eps)
    (realp a)
    (realp tm)
    (standard-numberp tm))
   (equal (* eps
             (FLOOR1 (* (/ EPS) TM))
             a)
          (* (tm-eps-fun tm eps) a)))
  :hints (("Goal" :in-theory (disable tm-eps-fun-rw-1-thm
                                      tm-eps-fun-rw-2-thm))))

(defthm tm-eps-fun-rw-4-thm
  (implies
   (and
    (realp eps)
    (< 0 eps)
    (i-small eps)
    (realp a)
    (realp b)
    (realp tm)
    (standard-numberp tm))
   (equal (* eps
             a
             (FLOOR1 (* (/ EPS) TM))
             b)
          (* (tm-eps-fun tm eps) a b)))
  :hints (("Goal" :in-theory (disable tm-eps-fun-rw-1-thm
                                      tm-eps-fun-rw-2-thm
                                      tm-eps-fun-rw-3-thm))))

;; tm-eps-fun should be disabled. Enabling it may result in rewrite loops.

(in-theory (disable tm-eps-fun))