File: mini-theories.lisp

package info (click to toggle)
acl2 8.6%2Bdfsg-3
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 1,138,276 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,978; makefile: 3,840; ruby: 2,633; yacc: 1,126; ml: 763; awk: 295; csh: 233; lex: 197; php: 178; tcl: 49; asm: 23; haskell: 17
file content (93 lines) | stat: -rw-r--r-- 2,218 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
; See the top-level arithmetic-3 LICENSE file for authorship,
; copyright, and license information.

;;
;; mini-theories.lisp
;;

(in-package "ACL2")


(local (include-book "basic-arithmetic"))

(local (include-book "inequalities"))

(local (include-book "prefer-times"))

(local (include-book "expt"))


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; Some proofs of linear equalities don't work when presented as
; equalities because they need to be proved by linear arithmetic,
; but linear arithmetic only works at the literal level.  This
; lemma allows you to state the equality as an equality rewrite
; rule, but breaks the equality into literals for the proof.


(defthm rewrite-linear-equalities-to-iff
   (equal (equal (< w x) (< y z))
          (iff (< w x) (< y z))))

(in-theory (disable rewrite-linear-equalities-to-iff))


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; See the note above equal-/ in basic-arithmetic.lisp.

(encapsulate
 ()

 (local
  (defthm Uniqueness-of-*-inverses-lemma-2
    (equal (equal (* x y)
                  1)
           (and (not (equal x 0))
                (acl2-numberp x)
                (equal y (/ x))))))

 (defthm Uniqueness-of-*-inverses
   (equal (equal (* x y)
                 1)
          (and (not (equal (fix x) 0))
               (equal y (/ x))))
   :hints (("Goal" :in-theory (disable equal-/)))))

(in-theory (disable Uniqueness-of-*-inverses))

;; This, and the inverse for exponents-add, should use
;; a macro to enforce the theory invariant more fully.

(theory-invariant
 (not (and (active-runep '(:rewrite Uniqueness-of-*-inverses))
           (active-runep '(:rewrite equal-/)))))


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


(defthm expts-add-aggressive
  (implies (and (integerp i)
		(integerp j))
	   (equal (expt x (+ i j))
		  (if (equal (+ i j) 0)
		      1
		      (if (equal (fix x) 0)
			  0
			  (* (expt x i) (expt x j)))))))

(defthm expts-add-inverse
  (implies (and (integerp i)
		(integerp j))
	   (equal (* (expt x i) (expt x j))
		  (if (and (equal i 0)
			   (equal j 0))
		      1
		      (if (equal (fix x) 0)
			  0
			  (expt x (+ i j)))))))

(in-theory (disable expts-add-aggressive expts-add-inverse))