1
; ACL2 Euclidean Domain books -- Book 4ab -- Example: Integers.
2
; The Integers are shown to be an Euclidean Domain with
3
; unique factorization. Here Size is abs; Quotient is floor
4
; and Remainder is mod.
6
; This version uses computable Skolem functions [in place of
7
; quantifiers (defun-sk)] and is executable. The name of
8
; each computable Skolem function, contains a $ symbol.
10
; Copyright (C) 2005 John R. Cowles, University of Wyoming
12
; This book is free software; you can redistribute it and/or modify
13
; it under the terms of the GNU General Public License as published by
14
; the Free Software Foundation; either version 2 of the License, or
15
; (at your option) any later version.
17
; This book is distributed in the hope that it will be useful,
18
; but WITHOUT ANY WARRANTY; without even the implied warranty of
19
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
; GNU General Public License for more details.
22
; You should have received a copy of the GNU General Public License
23
; along with this book; if not, write to the Free Software
24
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28
; Department of Computer Science
29
; University of Wyoming
30
; Laramie, WY 82071-3682 U.S.A.
32
; Last modified Feb. 06.
35
To certify this book, first, create a world with the following package:
39
(union-eq *acl2-exports*
40
*common-lisp-symbols-from-main-lisp-package*)
41
; Subtracted 12/4/2012 by Matt K. for addition to *acl2-exports*
42
'(nat-listp acl2-number-listp)))
47
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
48
;; The Integers are an Euclidean Doamin:
50
;; integerp ; Predicate for set of Euclidean Domain elements.
51
;; equal ; Equality predicate for Euclidean Domain elements.
52
;; identity ; Choose unique equivalence class representative for equal.
53
;; + ; Addition in Euclidean Domain.
54
;; * ; Multiplication in Euclidean Domain.
55
;; - ; Unary minus in Euclidean Domain.
56
;; 0 ; 0 element in Euclidean Domain.
57
;; 1 ; 1 element in Euclidean Domain.
58
;; abs ; Natp size of each nonzero Euclidean Domain element.
59
;; floor ; Quotient in Euclidean Domain.
60
;; mod ; Remainder in Euclidean Domain.
62
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
63
;; An Euclidean Domain is an integral domain, together with a Size function
64
;; from nonzero domain elements into the nonnegative integers, that
65
;; satisfies the Division Propery:
67
;; Division Propery. For all domain elements x and all nonzero domain
68
;; elements y there are domain elements q and r such that
70
;; x = yq + r and either r is the domain's zero or Size(r) < Size(y)
72
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
73
;; An Integral Domain is a commutative ring with no zero-divisors.
75
;; A Zero-Divisor in a commutative ring is a nonzero ring element, x, such
76
;; that there is a nonzero ring element y such that the product xy equals
77
;; the zero element of the ring.
79
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
80
;; A Commutative Ring is a nonempty set with two binary operations, addition
81
;; and multiplication, an unary operation, minus, and a ring element, zero,
84
;; (1) the binary operations are commutative and associative,
85
;; (2) multiplication distributes over addition,
86
;; (3) zero is an identity for addition, and
87
;; (4) minus produces an additive inverse
89
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
90
;; Every Euclidean Domain has a multiplicative identity.
91
;; See Book 1 of ACL2 Euclidean Domain books, ed1.lisp, for a proof.
93
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
94
;; There is no loss of generality in assuming the
95
;; Multiplicative Size Property:
97
;; For all nonzero domain elements x and y, Size(x) <= Size(xy).
99
;; If the original Size function does not satisfy this property,
100
;; then it can replaced by another that does satisfy this and the
101
;; division property.
102
;; See Book 2 of the ACL2 Euclidean Domain books, ed2.lisp,
105
;; In fact, for integers x and y, (abs (* x y)) = (* (abs x)(abs y)).
106
;; So, if integer y differs from 0, then (<= 1 (abs y)); then for
107
;; any integer x, (abs x) = (* (abs x) 1) <= (* (abs x)(abs y))
109
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
110
(in-package "INT-MOD")
111
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
112
; Make temporary use of an ACL2 Arithmetic Book and a book containing facts
113
; about FLOOR and MOD to help certify this book
116
(include-book "arithmetic/top" :dir :system
117
; Matt K.: Commenting out use of :uncertified-okp after v4-3 in order to
118
; support provisional certification:
119
; :uncertified-okp nil
121
:skip-proofs-okp nil))
124
(include-book "ihs/quotient-remainder-lemmas" :dir :system
125
; Matt K.: Commenting out use of :uncertified-okp after v4-3 in order to
126
; support provisional certification:
127
; :uncertified-okp nil
129
:skip-proofs-okp nil))
132
(in-theory (disable acl2::quotient-remainder-functions)))
134
;; Make temporary use of an ACL2 Euclidean Domain Book:
137
; Matt K.: Commenting out use of :uncertified-okp after v4-3 in order to
138
; support provisional certification:
139
; :uncertified-okp nil
141
:skip-proofs-okp nil))
144
;;; Integral Domain Axioms:
147
(and (implies (integerp x)
148
(and (implies (integerp y)
149
(and (integerp (+ x y))
158
(implies (integerp x)
160
(implies (integerp y)
161
(and (booleanp (equal x y))
164
(implies (integerp z)
165
(implies (and (equal x y)
172
(implies (equal y1 y2)
173
(and (iff (integerp y1)
175
(implies (and (integerp y1)
177
(and (implies (integerp x)
182
(implies (integerp z)
193
(implies (integerp x)
194
(integerp (identity x)))
198
Equivalence-class-Laws
199
(and (implies (integerp x)
200
(equal (identity x) x))
201
(implies (and (integerp y1)
210
(implies (and (integerp x)
220
(implies (and (integerp x)
223
(and (equal (+ (+ x y) z)
230
Left-Distributivity-Law
231
(implies (and (integerp x)
241
(implies (integerp x)
250
(implies (integerp x)
257
(implies (and (integerp x)
259
(equal (equal (* x y) 0)
264
;; Euclidean Domain Axioms:
267
(implies (and (integerp x)
269
(and (integerp (abs x))
271
:rule-classes ((:type-prescription
273
(implies (integerp x)
274
(and (integerp (abs x))
278
(implies (and (integerp x)
284
(implies (and (integerp y1)
292
Closure-of-floor-&-mod
293
(implies (and (integerp x)
296
(and (integerp (floor x y))
297
(integerp (mod x y))))
301
Congruence-for-floor-&-mod
302
(implies (and (integerp y1)
305
(and (implies (and (integerp x)
307
(and (equal (floor x y1)
311
(implies (and (integerp z)
313
(and (equal (floor y1 z)
321
(implies (and (integerp x)
324
(and (equal x (+ (* y (floor x y))
326
(or (equal (mod x y) 0)
329
:rule-classes ((:rewrite
331
(implies (and (integerp x)
334
(not (equal (mod x y) 0)))
339
(implies (and (integerp x)
342
(not (equal (mod x y)0)))
348
(implies (and (integerp x)
354
:rule-classes (:linear
357
(and (implies (and (integerp x)
361
(implies (and (integerp x)
368
:in-theory (disable (:definition abs))
371
(implies (and (integerp x)
379
(implies (and (integerp x)
382
(* (abs x)(abs y)))))))
384
:in-theory (enable (:definition abs)))))
386
(in-theory (disable (:definition abs)))
393
;; (exists z (and (integerp x)
398
;; Computable Skolem function
400
Divides-p$-witness (x y)
401
(declare (xargs :guard
402
(and (acl2-numberp x)
405
(let ((q (* y (/ x))))
413
(declare (xargs :guard
414
(and (acl2-numberp x)
416
(let ((z (divides-p$-witness x y)))
423
(implies (and (integerp x)
427
:rule-classes ((:rewrite
429
(implies (and (equal (* x z) y)
434
(in-theory (disable (:definition divides-p$-witness)))
441
(declare (xargs :guard
453
(:functional-instance
454
acl2::Size-unit-p=Size-1_e
457
(acl2::C_=_e identity)
458
(acl2::binary-+_e binary-+)
459
(acl2::binary-*_e binary-*)
461
(acl2::0_e (lambda () 0))
462
(acl2::1_e (lambda () 1))
466
(acl2::divides-p divides-p)
467
(acl2::divides-p-witness divides-p$-witness)
468
(acl2::unit-p unit-p))
479
(implies (and (integerp x)
487
(:functional-instance
488
acl2::Size=Size-1_e-implies-unit-p
491
(acl2::C_=_e identity)
492
(acl2::binary-+_e binary-+)
493
(acl2::binary-*_e binary-*)
495
(acl2::0_e (lambda () 0))
496
(acl2::1_e (lambda () 1))
500
(acl2::divides-p divides-p)
501
(acl2::divides-p-witness divides-p$-witness)
502
(acl2::unit-p unit-p))
511
:in-theory (enable abs)
513
Abs=1-implies-unit-p))))
517
(implies (and (not (unit-p y))
524
:rule-classes (:linear
527
:in-theory (e/d ((:definition abs))
528
((:definition unit-p))))))
530
;;;;;;;;;;;;;;;;;;;;;;;;
532
;; Irreducible-p theory:
536
;; (exists (y z)(and (integerp y)
540
;; (equal (* y z) x))))
543
Greatest-factor (x y)
544
"Return the largest z such that z|x and
545
1 < z <= y. If no such z exists return |x|."
546
(declare (xargs :guard
547
(and (real/rationalp x)
550
(cond ((or (zp y)(= y 1))
553
(t (greatest-factor x (- y 1)))))
557
(implies (and (integerp x)
560
(and (integerp (greatest-factor x y))
561
(>= (greatest-factor x y) 0)))
562
:rule-classes :type-prescription)
565
Divides-p-greatest-factor
566
(implies (integerp x)
567
(divides-p (greatest-factor x y) x))
569
:in-theory (enable (:definition abs)
570
(:definition divides-p$-witness)))))
574
(implies (and (not (equal x 1))
577
:rule-classes :forward-chaining)
581
(implies (and (rationalp y)
583
(not (integerp (/ y))))
586
(implies (and (rationalp y)
591
Not-integerp-/-b-lemma
592
(implies (and (rationalp y)
606
(implies (and (rationalp y)
608
(not (integerp (- (/ y)))))
610
:use Not-integerp-/-b-lemma)))
614
(implies (rationalp y)
615
(equal (equal (greatest-factor x y) 1)
619
:in-theory (enable (:definition abs)
620
(:definition divides-p$-witness)))))
625
(> (greatest-factor i j) 1))
626
:rule-classes :linear
628
:in-theory (enable (:definition abs)))))
631
Greatest-factor->-1-a
633
(> (greatest-factor i j) 1))
634
:rule-classes :linear
636
:in-theory (enable (:definition abs)))))
639
Greatest-factor->=-divisor
640
(implies (and (divides-p z x)
644
(>= (greatest-factor x y) z))
645
:rule-classes :linear)
649
(implies (and (divides-p z x)
653
(<= (greatest-factor x y) y))
654
:rule-classes :linear)
656
;; Computable Skolem function
658
Reducible-p$-witness (x)
659
(declare (xargs :guard (integerp x)))
660
(let ((gf (greatest-factor x (nfix (- (abs x) 1)))))
661
(mv (divides-p$-witness gf x) gf)))
665
(declare (xargs :guard (integerp x)))
667
(reducible-p$-witness x)
674
(in-theory (disable (:definition Reducible-p$-witness)))
676
(in-theory (enable (:definition divides-p$-witness)))
680
(implies (and (integerp y)
687
(not (equal (divides-p$-witness (greatest-factor (* y z)
700
(implies (and (integerp b)
702
(equal (* a (/ b)) 1))
705
(b (greatest-factor (* y z) (+ -1 (* y z)))))
708
(implies (and (integerp a)
712
(>= (* (- a 1) b) 1)))
718
(implies (and (integerp a)
730
(implies (and (integerp a)
736
(>= (* y z)(* a z))))
738
(implies (and (integerp a)
743
(>= (* a z)(* a b))))))
745
:in-theory (disable acl2::<-*-left-cancel
746
acl2::<-*-right-cancel))))
750
(implies (and (integerp y)
764
(implies (and (integerp y)
770
(not (equal (* y z) 1)))
773
:use subgoal-7.3-lemma-a)))
777
(implies (and (integerp y)
784
(equal (* (greatest-factor (* y z) (+ -1 (* y z)))
785
(divides-p$-witness (greatest-factor (* y z) (+ -1 (* y z)))
795
:in-theory (disable divides-p-greatest-factor)
797
divides-p-greatest-factor
799
(y (+ -1 (* y z)))))))
803
(implies (and (integerp a)
815
(implies (and (integerp a)
821
(<= (* y z)(* a z))))
823
(implies (and (integerp a)
828
(<= (* a z)(* a b))))))
830
:in-theory (disable acl2::<-*-left-cancel
831
acl2::<-*-right-cancel))))
835
(implies (and (integerp y)
849
(implies (and (integerp y)
855
(not (equal (* y z) -1)))
858
:use subgoal-5.3-lemma-a)))
862
(implies (and (integerp y)
869
(not (equal (divides-p$-witness (greatest-factor (* y z)
878
(y (+ -1 (- (* y z))))
882
(implies (and (integerp b)
884
(equal (* a (/ b)) -1))
887
(b (greatest-factor (* y z) (+ -1 (- (* y z))))))
890
(implies (and (integerp a)
894
(>= (* (- a 1) b) 1)))
900
(implies (and (integerp y)
907
(equal (* (greatest-factor (* y z)
909
(divides-p$-witness (greatest-factor (* y z)
916
Greatest-factor->-1-a
918
(j (+ -1 (- (* y z))))))
920
:in-theory (disable divides-p-greatest-factor)
922
divides-p-greatest-factor
924
(y (+ -1 (- (* y z))))))))
928
(implies (and (integerp y)
935
(not (equal (divides-p$-witness (greatest-factor (* y z)
947
(implies (and (integerp b)
949
(equal (* a (/ b)) 1))
952
(b (greatest-factor (* y z) (+ -1 (* y z)))))
955
(implies (and (integerp a)
959
(>= (* (- a 1) b) 1)))
965
(implies (and (integerp a)
977
(implies (and (integerp a)
983
(>= (* y z)(* a z))))
985
(implies (and (integerp a)
990
(>= (* a z)(* a b))))))
992
:in-theory (disable acl2::<-*-left-cancel
993
acl2::<-*-right-cancel))))
997
(implies (and (integerp y)
1011
(implies (and (integerp y)
1017
(not (equal (* y z) 1)))
1020
:use subgoal-1.3-lemma-a)))
1022
(in-theory (enable (:definition abs)))
1026
(implies (and (integerp y)
1033
(equal (* (greatest-factor (* y z) (+ -1 (* y z)))
1034
(divides-p$-witness (greatest-factor (* y z) (+ -1 (* y z)))
1038
:hints (("Subgoal 3"
1042
(j (+ -1 (* y z)))))
1044
:in-theory (disable divides-p-greatest-factor)
1046
divides-p-greatest-factor
1048
(y (+ -1 (* y z)))))))
1050
(in-theory (disable (:definition divides-p$-witness)
1051
(:definition unit-p)))
1053
(in-theory (enable (:definition reducible-p$-witness)))
1057
(implies (and (integerp y)
1063
:rule-classes ((:rewrite
1065
(implies (and (equal (* y z) x)
1071
:hints (("Subgoal 7.4"
1076
:in-theory (enable (:definition divides-p$-witness)))
1080
:in-theory (enable (:definition divides-p$-witness)))
1088
:in-theory (enable (:definition divides-p$-witness)))
1109
:in-theory (enable (:definition divides-p$-witness)))
1113
(in-theory (disable (:definition abs)
1114
(:definition reducible-p$-witness)))
1118
(declare (xargs :guard t))
1121
(not (reducible-p x))))
1124
Irreducible-p-implies-prime-property
1125
(implies (and (irreducible-p x)
1128
(divides-p x (* y z)))
1134
(:functional-instance
1135
acl2::Irreducible-p-implies-prime-property
1136
(acl2::edp integerp)
1138
(acl2::C_=_e identity)
1139
(acl2::binary-+_e binary-+)
1140
(acl2::binary-*_e binary-*)
1142
(acl2::0_e (lambda () 0))
1143
(acl2::1_e (lambda () 1))
1147
(acl2::divides-p divides-p)
1148
(acl2::divides-p-witness divides-p$-witness)
1149
(acl2::unit-p unit-p)
1150
(acl2::reducible-p reducible-p)
1151
(acl2::reducible-p-witness reducible-p$-witness)
1152
(acl2::irreducible-p irreducible-p))
1157
:in-theory (disable unit-p=_+1_or_-1
1158
(:definition reducible-p)
1159
(:definition divides-p)))
1167
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1168
;; Factorization existence theory:
1171
Irreducible-factors (x)
1172
"Return a list, lst, of irreducible
1173
elements of integerp, so that if x is
1174
in integerp, x is not 0, and x is not
1175
an unit, then x = product of the
1177
(declare (xargs :guard t
1178
:measure (if (integerp x)
1181
:hints (("Subgoal 2"
1182
:in-theory (disable (:definition mv-nth)
1183
(:definition unit-p))
1186
(x (mv-nth 1 (reducible-p$-witness x)))
1187
(y (mv-nth 0 (reducible-p$-witness x)))))
1189
:in-theory (disable (:definition mv-nth)
1190
(:definition unit-p))
1193
(x (mv-nth 0 (reducible-p$-witness x)))
1194
(y (mv-nth 1 (reducible-p$-witness x))))))))
1195
(cond ((or (not (integerp x))
1201
(reducible-p$-witness x)
1202
(append (irreducible-factors y)
1203
(irreducible-factors z))))
1207
Integerp-listp (lst)
1208
(declare (xargs :guard t))
1210
(and (integerp (car lst))
1211
(integerp-listp (cdr lst)))
1215
Irreducible-listp (lst)
1216
(declare (xargs :guard t))
1218
(and (irreducible-p (car lst))
1219
(irreducible-listp (cdr lst)))
1224
(declare (xargs :guard t))
1226
(if (integerp (car lst))
1227
(* (car lst)(*-lst (cdr lst)))
1232
IRREDUCIBLE-FACTORIZATION-EXISTENCE
1233
(and (true-listp (irreducible-factors x))
1234
(integerp-listp (irreducible-factors x))
1235
(irreducible-listp (irreducible-factors x))
1236
(implies (and (integerp x)
1239
(equal (*-lst (irreducible-factors x)) x)))
1243
(:functional-instance
1244
acl2::IRREDUCIBLE-FACTORIZATION-EXISTENCE
1245
(acl2::edp integerp)
1247
(acl2::C_=_e identity)
1248
(acl2::binary-+_e binary-+)
1249
(acl2::binary-*_e binary-*)
1251
(acl2::0_e (lambda () 0))
1252
(acl2::1_e (lambda () 1))
1256
(acl2::divides-p divides-p)
1257
(acl2::divides-p-witness divides-p$-witness)
1258
(acl2::unit-p unit-p)
1259
(acl2::reducible-p reducible-p)
1260
(acl2::reducible-p-witness reducible-p$-witness)
1261
(acl2::irreducible-p irreducible-p)
1262
(acl2::irreducible-factors irreducible-factors)
1263
(acl2::irreducible-listp irreducible-listp)
1264
(acl2::edp-listp integerp-listp)
1265
(acl2::*_e-lst *-lst))
1268
:in-theory (disable (:definition irreducible-p)))
1270
:in-theory (disable (:definition mv-nth)
1271
(:definition reducible-p)))))
1273
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1274
;; Unit-associates-p theory:
1277
;; unit-associates-p (x y)
1278
;; (exists u (if (and (integerp x)
1285
;; Computable Skolem function
1287
Unit-associates-p$-witness (x y)
1288
(declare (xargs :guard
1289
(and (acl2-numberp x)
1296
Unit-associates-p (x y)
1297
(declare (xargs :guard
1298
(and (acl2-numberp x)
1300
(let ((u (unit-associates-p$-witness x y)))
1301
(if (and (integerp x)
1308
Unit-associates-p-suff
1309
(implies (if (and (integerp x)
1314
(unit-associates-p x y)))
1316
(in-theory (disable (:definition Unit-associates-p$-witness)))
1319
Irreducible-p-unit-associates
1320
(implies (and (divides-p x y)
1323
(unit-associates-p x y))
1327
(:functional-instance
1328
acl2::Irreducible-p-unit-associates
1329
(acl2::edp integerp)
1331
(acl2::C_=_e identity)
1332
(acl2::binary-+_e binary-+)
1333
(acl2::binary-*_e binary-*)
1335
(acl2::0_e (lambda () 0))
1336
(acl2::1_e (lambda () 1))
1340
(acl2::divides-p divides-p)
1341
(acl2::divides-p-witness divides-p$-witness)
1342
(acl2::unit-p unit-p)
1343
(acl2::reducible-p reducible-p)
1344
(acl2::reducible-p-witness reducible-p$-witness)
1345
(acl2::irreducible-p irreducible-p)
1346
(acl2::unit-associates-p unit-associates-p)
1347
(acl2::unit-associates-p-witness unit-associates-p$-witness))
1352
unit-associates-p-suff
1356
:in-theory (disable unit-p=_+1_or_-1))))
1358
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1359
;; Unique factorization theory:
1362
acl2-number-listp (l)
1363
(declare (xargs :guard t))
1365
(and (acl2-numberp (car l))
1366
(acl2-number-listp (cdr l)))
1370
Member-unit-associate (x lst)
1371
"Determine if an unit-associate
1372
of x is a member of lst."
1373
(declare (xargs :guard (and (acl2-numberp x)
1374
(acl2-number-listp lst))))
1377
((unit-associates-p x (car lst))
1379
(t (member-unit-associate x (cdr lst)))))
1382
Delete-one-unit-associate (x lst)
1383
"Return the result of deleting one occurrence
1384
of an unit-associate of x from the list lst."
1385
(declare (xargs :guard (and (acl2-numberp x)
1386
(acl2-number-listp lst))))
1388
(if (unit-associates-p x (car lst))
1390
(cons (car lst)(delete-one-unit-associate x (cdr lst))))
1394
Bag-equal-unit-associates (lst1 lst2)
1395
"Return T iff lst1 and lst2 have the same
1396
members, up to unit-associates, with the
1397
same multiplicity, up to unit-associates."
1398
(declare (xargs :guard (and (acl2-number-listp lst1)
1399
(acl2-number-listp lst2))))
1401
(and (member-unit-associate (car lst1) lst2)
1402
(bag-equal-unit-associates (cdr lst1)
1403
(delete-one-unit-associate (car lst1)
1407
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1408
;; Show that bag-equal-unit-associates has the expected properties:
1410
;; Lisp objects that are bag-equal-unit-associates have the same length.
1412
;; Lisp objects that are bag-equal-unit-associates have the same members.
1413
;; up to unit-associates.
1415
;; Elements in Lisp objects that are bag-equal-unit-associates occur
1416
;; in each object with the same multiplicity up to unit-associates.
1419
Bag-equal-unit-associates->equal-len
1420
(implies (bag-equal-unit-associates lst1 lst2)
1426
(:functional-instance
1427
acl2::Bag-equal-unit-associates->equal-len
1428
(acl2::edp integerp)
1430
(acl2::C_=_e identity)
1431
(acl2::binary-+_e binary-+)
1432
(acl2::binary-*_e binary-*)
1434
(acl2::0_e (lambda () 0))
1435
(acl2::1_e (lambda () 1))
1439
(acl2::divides-p divides-p)
1440
(acl2::divides-p-witness divides-p$-witness)
1441
(acl2::unit-p unit-p)
1442
(acl2::unit-associates-p unit-associates-p)
1443
(acl2::unit-associates-p-witness unit-associates-p$-witness)
1444
(acl2::Member-unit-associate Member-unit-associate)
1445
(acl2::Delete-one-unit-associate Delete-one-unit-associate)
1446
(acl2::Bag-equal-unit-associates Bag-equal-unit-associates))
1448
(acl2::lst2 lst2)))))
1451
Bag-equal-unit-associates->iff-member-unit-associate
1452
(implies (bag-equal-unit-associates lst1 lst2)
1453
(iff (member-unit-associate x lst1)
1454
(member-unit-associate x lst2)))
1458
(:functional-instance
1459
acl2::Bag-equal-unit-associates->iff-member-unit-associate
1460
(acl2::edp integerp)
1462
(acl2::C_=_e identity)
1463
(acl2::binary-+_e binary-+)
1464
(acl2::binary-*_e binary-*)
1466
(acl2::0_e (lambda () 0))
1467
(acl2::1_e (lambda () 1))
1471
(acl2::divides-p divides-p)
1472
(acl2::divides-p-witness divides-p$-witness)
1473
(acl2::unit-p unit-p)
1474
(acl2::unit-associates-p unit-associates-p)
1475
(acl2::unit-associates-p-witness unit-associates-p$-witness)
1476
(acl2::Member-unit-associate Member-unit-associate)
1477
(acl2::Delete-one-unit-associate Delete-one-unit-associate)
1478
(acl2::Bag-equal-unit-associates Bag-equal-unit-associates))
1480
(acl2::lst2 lst2)))))
1483
Multiplicity-unit-associate (x lst)
1484
(declare (xargs :guard (and (acl2-numberp x)
1485
(acl2-number-listp lst))))
1487
(if (unit-associates-p x (car lst))
1488
(+ 1 (multiplicity-unit-associate x (cdr lst)))
1489
(multiplicity-unit-associate x (cdr lst)))
1493
Bag-equal-unit-associates->equal-multiplicity-unit-associate
1494
(implies (bag-equal-unit-associates lst1 lst2)
1495
(equal (multiplicity-unit-associate x lst1)
1496
(multiplicity-unit-associate x lst2)))
1500
(:functional-instance
1501
acl2::Bag-equal-unit-associates->equal-multiplicity-unit-associate
1502
(acl2::edp integerp)
1504
(acl2::C_=_e identity)
1505
(acl2::binary-+_e binary-+)
1506
(acl2::binary-*_e binary-*)
1508
(acl2::0_e (lambda () 0))
1509
(acl2::1_e (lambda () 1))
1513
(acl2::divides-p divides-p)
1514
(acl2::divides-p-witness divides-p$-witness)
1515
(acl2::unit-p unit-p)
1516
(acl2::unit-associates-p unit-associates-p)
1517
(acl2::unit-associates-p-witness unit-associates-p$-witness)
1518
(acl2::Member-unit-associate Member-unit-associate)
1519
(acl2::Delete-one-unit-associate Delete-one-unit-associate)
1520
(acl2::Bag-equal-unit-associates Bag-equal-unit-associates)
1521
(acl2::Multiplicity-unit-associate Multiplicity-unit-associate))
1524
(acl2::lst2 lst2)))))
1527
IRREDUCIBLE-FACTORIZATION-UNIQUENESS-general
1528
(implies (and (irreducible-listp lst1)
1529
(irreducible-listp lst2)
1530
(unit-associates-p (*-lst lst1)
1532
(bag-equal-unit-associates lst1 lst2))
1536
(:functional-instance
1537
acl2::IRREDUCIBLE-FACTORIZATION-UNIQUENESS-general
1538
(acl2::edp integerp)
1540
(acl2::C_=_e identity)
1541
(acl2::binary-+_e binary-+)
1542
(acl2::binary-*_e binary-*)
1544
(acl2::0_e (lambda () 0))
1545
(acl2::1_e (lambda () 1))
1549
(acl2::divides-p divides-p)
1550
(acl2::divides-p-witness divides-p$-witness)
1551
(acl2::unit-p unit-p)
1552
(acl2::reducible-p reducible-p)
1553
(acl2::reducible-p-witness reducible-p$-witness)
1554
(acl2::irreducible-p irreducible-p)
1555
(acl2::irreducible-listp irreducible-listp)
1556
(acl2::*_e-lst *-lst)
1557
(acl2::unit-associates-p unit-associates-p)
1558
(acl2::unit-associates-p-witness unit-associates-p$-witness)
1559
(acl2::Member-unit-associate Member-unit-associate)
1560
(acl2::Delete-one-unit-associate Delete-one-unit-associate)
1561
(acl2::Bag-equal-unit-associates Bag-equal-unit-associates))
1563
(acl2::lst2 lst2)))))
1566
IRREDUCIBLE-FACTORIZATION-UNIQUENESS
1567
(implies (and (irreducible-listp lst1)
1568
(irreducible-listp lst2)
1571
(bag-equal-unit-associates lst1 lst2))
1575
(:functional-instance
1576
acl2::IRREDUCIBLE-FACTORIZATION-UNIQUENESS
1577
(acl2::edp integerp)
1579
(acl2::C_=_e identity)
1580
(acl2::binary-+_e binary-+)
1581
(acl2::binary-*_e binary-*)
1583
(acl2::0_e (lambda () 0))
1584
(acl2::1_e (lambda () 1))
1588
(acl2::divides-p divides-p)
1589
(acl2::divides-p-witness divides-p$-witness)
1590
(acl2::unit-p unit-p)
1591
(acl2::reducible-p reducible-p)
1592
(acl2::reducible-p-witness reducible-p$-witness)
1593
(acl2::irreducible-p irreducible-p)
1594
(acl2::irreducible-listp irreducible-listp)
1595
(acl2::*_e-lst *-lst)
1596
(acl2::unit-associates-p unit-associates-p)
1597
(acl2::unit-associates-p-witness unit-associates-p$-witness)
1598
(acl2::Member-unit-associate Member-unit-associate)
1599
(acl2::Delete-one-unit-associate Delete-one-unit-associate)
1600
(acl2::Bag-equal-unit-associates Bag-equal-unit-associates))
1602
(acl2::lst2 lst2)))))