8
; Added by Matt K. for v2-9, upon introduction of rewrite-solidify-plus for
9
; making a second pass of rewriting for relieving hypotheses, upon seeing
10
; dominant usage in ste-thm-backward (file fundamental.lisp) with
11
; show-accumulated-persistence.
12
(in-theory (disable r-p-car))
14
(defuntyped r-nmp ((r-p r) (naturalp n) (naturalp m)) t
16
(if (and (consp r) (< 0 n))
17
(and (equal (len (car r)) m)
18
(r-nmp (cdr r) (1- n) m))
29
(implies (and ;(r-p r)
34
(r-nmp (cons s r) n m)))
36
;;; R_MAKE def and facts
38
(defuntyped r-make ((naturalp n) (s-p s)) t
41
(cons s (r-make (1- n) s))
47
(equal (len (r-make n s)) n)))
50
(implies (and (positivep n)
53
(r-nmp (r-make n s) n m)))
57
(defuntyped r-lub (r1 r2) t
59
(if (and (r-p r1) (r-p r2))
62
(cons (s-lub (car r1) (car r2))
63
(r-lub (cdr r1) (cdr r2)))
70
(implies (and (r-p r1)
73
(equal (len (r-lub r1 r2))
74
(max (len r1) (len r2)))))
77
(implies (and (r-nmp r1 n m)
79
(r-nmp (r-lub r1 r2) n m)))
81
(defthm r-lub-commutes
82
(equal (r-lub r1 r2) (r-lub r2 r1))
88
(defuntyped r-lte ((r-p r1) (r-p r2)) t
90
(if (and (consp r1) (consp r2))
91
(and (s-lte (car r1) (car r2))
92
(r-lte (cdr r1) (cdr r2)))
96
(defthm r-lte-reflexive
100
(defthm r-lte-antisymmetric
101
(implies (and (r-p a)
108
(defthm r-lte-transitive
109
(implies (and (r-p a)
120
(defthm r-lte-r-lub-r1
121
(implies (and (r-nmp r1 n m)
123
(r-lte r1 (r-lub r1 r2))) )
125
(defthm r-lte-r-lub-r2
126
(implies (and (r-nmp r1 n m)
128
(r-lte r2 (r-lub r1 r2))) )
135
(IMPLIES (AND (R-P R1)
142
(defthm consp-r-lub-5
143
(implies (and (r-p r1)
148
(consp (r-lub r1 r2))))
150
(defthm b-p-nth-car-r-lub-cons-6
151
(IMPLIES (AND (INTEGERP L3)
156
(EQUAL (NTH L3 R3) 'TOP))
157
(B-P (NTH L3 (CAR (R-LUB (CONS R3 R4) R2))))))
159
(defthm consp-r-lub-cons-4
160
(implies (and (s-p s1)
164
(consp (r-lub (cons s1 r1) r2)))
165
:hints (("Goal" :expand ((r-lub (cons s1 r1) r2))))
168
(defthm cons-r-make-collapse
169
(implies (and (naturalp n)
171
(equal (cons (s-make m v)
172
(r-make n (s-make m v)))
173
(r-make (1+ n) (s-make m v)))))
176
(defthm equal-r-make-bottom
177
(implies (and (naturalp m)
179
(r-lte r (r-make (len r) (s-make m 'x)))
181
(equal (r-make (len r) (s-make m 'x)) r))
182
:hints (("Goal" :induct (r-p r)
183
;; r-p-car re-enabled by Matt K. to compensate for v2-9 change of
184
;; disabling this rule near the top of this file.
185
:in-theory (enable r-p-car))
186
("Subgoal *1/2.2'" :use ((:instance s-lte-implies-len-equal
187
(s1 r1) (s2 (s-make m 'x)))))))
189
(defthm r-lte-implies-len-equal
190
(implies (r-lte r1 r2)
191
(equal (len r1) (len r2)))
194
(defthm equal-r-make-bottom-2
195
(implies (and (naturalp n)
197
(r-lte r (r-make n (s-make m 'x)))
199
(equal (r-make n (s-make m 'x)) r))
200
:hints (("Goal" :do-not-induct t
201
:use ((:instance equal-r-make-bottom)
202
(:instance r-lte-implies-len-equal (r1 r) (r2 (r-make n (s-make m 'x)))) )
208
(equal (r-lub r r) r)))
214
:hints (("Goal" :expand ((r-make 1 s)))))
216
(defuntyped s-consistent ((s-p s)) t
219
(and (not (equal (car s) 'top))
220
(s-consistent (cdr s)))
223
(defuntyped r-consistent ((r-p r)) t
226
(and (s-consistent (car r))
227
(r-consistent (cdr r)))
230
(defthm consp-r-make-plus-1
231
(implies (and (s-p s)
234
(consp (r-make (+ 1 n) s))))
239
(defthm r-lub-r-lte-r-lub
240
(implies (and (r-p r1)
250
(defthm r-lub-r-lte-rewrite-1
251
(implies (and (r-p r)
254
(equal (r-lub r r1) r)))
256
(defthm r-lub-r-lte-rewrite-2
257
(implies (and (r-p r)
260
(equal (r-lub r1 r) r)))
263
(defthm r-lte-r-make-s-make-cons
264
(IMPLIES (AND (CONSP (CONS R1 R2))
267
(R-LTE (R-MAKE (+ -1 N) (S-MAKE (LEN R1) 'X))
271
(R-NMP R2 (+ -1 N) (LEN R1))
273
(R-LTE (R-MAKE N (S-MAKE (LEN R1) 'X))
277
(implies (and (r-p r)
281
(r-lte (r-make n (s-make m 'x)) r))
284
(defthm r-lub-r-lte-r-lub-r-1
285
(implies (and (r-p r)
292
:hints (("Goal" :use ((:instance r-lub-r-lte-r-lub (r1 r) (r2 r))))))
294
(defthm r-lub-r-lte-r-lub-r-2
295
(implies (and (r-p r1)
302
:hints (("Goal" :use ((:instance r-lub-r-lte-r-lub (r3 r) (r4 r))))) )
304
(defthm r-lte-both-implies-r-lte-r-lub
305
(implies (and (r-p r)
311
(r-lte (r-lub r1 r2) r)))
312
(defthm not-r-lte-1-implies-not-r-lte-r-lub
324
(not (r-lte (r-lub r1 r2) r)))
325
:hints (("Goal" :do-not '(generalize fertilize) )) )
327
(defthm not-r-lte-2-implies-not-r-lte-r-lub
339
(not (r-lte (r-lub r1 r2) r)))
341
:use ((:instance not-r-lte-1-implies-not-r-lte-r-lub
343
(:instance r-lub-commutes))