File: fl-hacks.lisp

package info (click to toggle)
acl2 6.5-2
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 108,856 kB
  • ctags: 110,136
  • sloc: lisp: 1,492,565; xml: 7,958; perl: 3,682; sh: 2,103; cpp: 1,477; makefile: 1,470; ruby: 453; ansic: 358; csh: 125; java: 24; haskell: 17
file content (74 lines) | stat: -rw-r--r-- 2,126 bytes parent folder | download | duplicates (10)
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
;;;***************************************************************
;;;An ACL2 Library of Floating Point Arithmetic

;;;David M. Russinoff
;;;Advanced Micro Devices, Inc.
;;;February, 1998
;;;***************************************************************

#|
This book contains a few hacks about fl which aren't used elsewhere in support/.

|#

(in-package "ACL2")

(include-book "ground-zero")
;(include-book "basic") ;drop?

(defund fl (x)
  (declare (xargs :guard (real/rationalp x)))
  (floor x 1))

(local (include-book "inverted-factor"))
(local (include-book "nniq"))
(local (include-book "numerator"))
(local (include-book "denominator"))
(local (include-book "fp2"))
(local (include-book "predicate"))
(local (include-book "product"))
(local (include-book "unary-divide"))
(local (include-book "rationalp"))
(local (include-book "integerp"))
(local (include-book "fl")) ;drop?
(local (include-book "mod"))
(local (include-book "even-odd"))
(local (include-book "meta/meta-plus-equal" :dir :system))

(local (include-book "arith"))

;used anywhere?
;exported in lib/basic
(defthm fl-m-1
  (implies (and (< 0 n) ;(not (equal n 0))
                (integerp m)
                (integerp n)
                )
           (= (fl (- (/ (1+ m) n)))
              (1- (- (fl (/ m n))))))
  :otf-flg t
  :rule-classes ()
  :hints (
          ("goal" :in-theory (disable fl-def-linear-part-2
                                      LESS-THAN-MULTIPLY-THROUGH-BY-INVERTED-FACTOR-FROM-LEFT-HAND-SIDE)
           :use ((:instance  fl-of-fraction-min-change
                             (p (+ 1 m)) (q n))
                 (:instance fl-unique (x (* M (/ N)))
                            (n (+ -1 (+ (/ N) (* M (/ N))))))
                 (:instance fl-unique (x (+ (/ N) (* M (/ N))))
                            (n (FL (* M (/ N)))))

                 ))))

;remove?  doesn't seem to be used anywhere or exported in lib/
;just a special case of the above...
(defthm fl-lemma
    (implies (integerp m)
	     (= (fl (- (/ (1+ m) 2)))
		(1- (- (fl (/ m 2))))))
  :rule-classes ()
  :hints (("goal" :use (:instance fl-m-1 (n 2)))))