File: ash.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 (60 lines) | stat: -rw-r--r-- 1,514 bytes parent folder | download | duplicates (15)
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
(in-package "ACL2")

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

(defund bvecp (x k)
  (declare (xargs :guard (integerp k)))
  (and (integerp x)
       (<= 0 x)
       (< x (expt 2 k))))

(include-book "ground-zero")
(local (include-book "../arithmetic/fl"))
(local (include-book "../arithmetic/expt"))
(local (include-book "../arithmetic/expo"))

;change params on lemmas in this book to match those on ash?

#|(defun ash (i c)
(FLOOR (BINARY-* (IFIX I) (EXPT '2 C))
       '1))
|#

;(thm (rationalp (ash x n))) goes through?

;the (ash 1 x) form shows up in the function decode
(defthm bvecp-ash-1
  (implies (and (case-split (< x n))
                (case-split (integerp n))
                (case-split (integerp x))
                )
           (bvecp (ASH 1 x) n))
  :hints (("Goal" :in-theory (enable ash bvecp floor))))

;is this dumb?
(defthmd ash-rewrite
    (implies (integerp n)
	     (equal (ash n i)
		    (fl (* n (expt 2 i)))))
    :hints (("Goal" :in-theory (enable ash))))

(defthm ash-nonnegative
  (implies (<= 0 i)
           (<= 0 (ash i c)))
  :hints (("Goal" :in-theory (enable ash))))

(defthm ash-nonnegative-type
  (implies (<= 0 i)
           (and (rationalp (ash i c))
                (<= 0 (ash i c))))
  :rule-classes ( :type-prescription)
  :hints (("Goal" :in-theory (enable ash))))

(defthm ash-with-c-non-integer
  (implies (not (integerp c))
           (equal (ash i c)
                  (ifix i)))
  :hints (("Goal" :in-theory (enable ash))))