File: non-linear.lisp

package info (click to toggle)
acl2 8.5dfsg-5
  • links: PTS
  • area: main
  • in suites: bookworm
  • size: 991,452 kB
  • sloc: lisp: 15,567,759; javascript: 22,820; cpp: 13,929; ansic: 12,092; perl: 7,150; java: 4,405; xml: 3,884; makefile: 3,507; sh: 3,187; ruby: 2,633; ml: 763; python: 746; yacc: 723; awk: 295; csh: 186; php: 171; lex: 154; tcl: 49; asm: 23; haskell: 17
file content (245 lines) | stat: -rw-r--r-- 6,390 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
; See the top-level arithmetic-3 LICENSE file for authorship,
; copyright, and license information.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; non-linear.lisp
;;
;;
;; This book contains a minimal theory for use in the non-linear
;; extension to the linear arithmetic decision procedure.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

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

(in-package "ACL2")


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

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

(defthm arith-associativity-of-*
  (equal (* (* x y) z)
	 (* x (* y z))))

(defthm arith-commutativity-of-*
  (equal (* x y)
	 (* y x)))

(defthm arith-commutativity-2-of-*
  (equal (* x y z)
	 (* y x z)))



(defthm arith-unicity-of-1
  (and (equal (* 1 x)
	      (fix x))
       (equal (* x 1)
	      (fix x))))

(defthm arith-times-zero
  (and (equal (* 0 x)
	      0)
       (equal (* x 0)
	      0)))


(defthm arith-inverse-of-*-1
  (implies (and (rationalp x) (not (equal x 0)))
	   (equal (* x (/ x))
		  1)))

(defthm arith-inverse-of-*-2
  (implies (and (rationalp x) (not (equal x 0)))
	   (equal (* x (/ x) y)
		  (fix y))))

(defthm arith-inverse-of-*-3
  (implies (and (rationalp x) (not (equal x 0)))
	   (equal (* x y (/ x))
		  (fix y))))


(defthm arith-functional-self-inversion-of-/
  (equal (/ (/ x))
	 (fix x)))

(defthm arith-distributivity-of-/-over-*
  (equal (/ (* x y))
	 (* (/ x) (/ y))))


(defthm arith-functional-commutativity-of-minus-*-right
  (equal (* x (- y))
	 (- (* x y))))

(defthm arith-functional-commutativity-of-minus-*-left
  (equal (* (- x) y)
         (- (* x y))))

(defthm arith-reciprocal-minusa
  (equal (/ (- x))
         (- (/ x))))


(defthm arith-distributivity-1
  (equal (* x (+ y z)) (+ (* x y) (* x z))))

(defthm arith-distributivity-2
  (equal (* (+ y z) x) (+ (* x y) (* x z))))

(defthm arith-fold-consts-in-*
  (implies (and (syntaxp (quotep c))
		(syntaxp (quotep d)))
	   (equal (* c d x) (* (* c d) x))))



(defthm arith-expt-0
 (and (equal (expt x 0)
	     1)
      (equal (expt 0 i)
	     (if (zip i)
		 1
	         0))))

(defthm arith-expt-1
  (and (equal (expt x 1)
	      (fix x))
       (equal (expt 1 i)
	      1)))

(defthm arith-expt-minus-1
  (equal (expt x -1)
	 (/ x)))

(defthm arith-functional-commutativity-of-expt-/
  (equal (/ (expt r i))
         (expt (/ r) i)))

(local
 (in-theory (disable FUNCTIONAL-COMMUTATIVITY-OF-EXPT-/-BASE)))

(defthm arith-expt-minus-exponent
  (equal (expt r (- i))
	 (expt (/ r) i)))

(defthm arith-expt-negative-constant-exponent
  (implies (syntaxp (quotep i))
	   (equal (expt (/ r) (* i j))
                  (expt r (* (- i) j)))))

(defthm arith-exponents-multiply
  (implies (and (integerp i)
                (integerp j))
           (equal (expt (expt r i) j)
                  (expt r (* i j)))))

(defthm arith-distributivity-of-expt-over-*
  (equal (expt (* a b) i)
         (* (expt a i)
            (expt b i))))


(defthm arith-fix-revealed
  (implies (acl2-numberp x)
	   (equal (fix x) x)))


(defthm arith-Rational-implies2
  (implies (rationalp x)
           (equal (* (numerator x) (/ (denominator x))) x)))

(defthm arith-exponents-add-1
  (implies (and (integerp i)
		(integerp j)
		(not (equal (+ i j) 0)))
	   (equal (expt r (+ i j))
		  (* (expt r i)
		     (expt r j)))))

(defthm arith-exponents-add-for-nonpos-exponentsa
  (implies (and (<= i 0)
		(<= j 0)
		(integerp i)
		(integerp j))
	   (equal (expt r (+ i j))
		  (* (expt r i)
		     (expt r j)))))

(defthm arith-exponents-add-for-nonneg-exponentsa
  (implies (and (<= 0 i)
		(<= 0 j)
		(integerp i)
		(integerp j))
	   (equal (expt r (+ i j))
		  (* (expt r i)
		     (expt r j)))))

(defthm arith-exponents-add-2
  (implies (and (not (equal 0 r))
		(acl2-numberp r)
		(integerp i)
		(integerp j))
	   (equal (expt r (+ i j))
		  (* (expt r i)
		     (expt r j)))))

(in-theory (disable arith-associativity-of-* arith-commutativity-of-*
		    arith-commutativity-2-of-* arith-unicity-of-1
		    arith-times-zero arith-inverse-of-*-1
		    arith-inverse-of-*-2 arith-inverse-of-*-3
		    arith-functional-self-inversion-of-/
		    arith-distributivity-of-/-over-*
		    arith-functional-commutativity-of-minus-*-right
		    arith-functional-commutativity-of-minus-*-left
		    arith-reciprocal-minusa arith-distributivity-1
		    arith-distributivity-2 arith-fold-consts-in-*
		    arith-expt-0
		    arith-expt-1
		    arith-expt-minus-1
		    arith-functional-commutativity-of-expt-/
		    arith-expt-minus-exponent
		    arith-expt-negative-constant-exponent
		    arith-exponents-multiply
		    arith-distributivity-of-expt-over-*
		    arith-fix-revealed arith-Rational-implies2
		    arith-exponents-add-1
		    arith-exponents-add-for-nonpos-exponentsa
		    arith-exponents-add-for-nonneg-exponentsa
		    arith-exponents-add-2))

(in-arithmetic-theory '((:REWRITE arith-associativity-of-*)
		       (:REWRITE arith-commutativity-of-*)
		       (:REWRITE arith-commutativity-2-of-*)
		       (:REWRITE arith-unicity-of-1)
		       (:REWRITE arith-times-zero)
		       (:REWRITE arith-inverse-of-*-1)
		       (:REWRITE arith-inverse-of-*-2)
		       (:REWRITE arith-inverse-of-*-3)
		       (:REWRITE arith-functional-self-inversion-of-/ )
		       (:REWRITE arith-distributivity-of-/-over-*)
		       (:REWRITE arith-functional-commutativity-of-minus-*-right)
		       (:REWRITE arith-functional-commutativity-of-minus-*-left)
		       (:REWRITE arith-reciprocal-minusa)
		       (:REWRITE arith-distributivity-1)
		       (:REWRITE arith-distributivity-2)
		       (:REWRITE arith-fold-consts-in-*)
		       (:REWRITE arith-expt-0)
		       (:REWRITE arith-expt-1)
		       (:REWRITE arith-expt-minus-1)
		       (:REWRITE arith-functional-commutativity-of-expt-/)
		       (:REWRITE arith-expt-minus-exponent)
		       (:REWRITE arith-expt-negative-constant-exponent)
		       (:REWRITE arith-exponents-multiply)
		       (:REWRITE arith-distributivity-of-expt-over-*)
		       (:REWRITE arith-fix-revealed)
		       (:REWRITE arith-Rational-implies2)
		       (:REWRITE arith-exponents-add-1)
		       (:REWRITE arith-exponents-add-for-nonpos-exponentsa)
		       (:REWRITE arith-exponents-add-for-nonneg-exponentsa)
		       (:REWRITE arith-exponents-add-2)))