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
|
; Arithmetic-5 Library
; Written by Robert Krug
; Copyright/License:
; See the LICENSE file at the top level of the arithmetic-5 library.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; mini-theories.lisp
;;;
;;; This book contains a couple of rules which don't seem to fit
;;; anywhere else. They are sometimes useful, however, and
;;; their existence should be kept in mind.
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(in-package "ACL2")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Some proofs of linear inequalities don't work when presented as
;;; equalities. This lemma allows you to state the equality as
;;; an equality rewrite rule, but breaks the equality apart for
;;; the proof.
;;; The same technique is sometimes needed for other boolean
;;; operators.
;;; Try the following lemma in a fresh ACL2 with and without
;;; rewrite-linear-equalities-to-iff to see what is meant by the
;;; above paragraphs:
#|(defthm <-*-0
(implies (and (rationalp x)
(rationalp y))
(equal (< (* x y) 0)
(and (not (equal x 0))
(not (equal y 0))
(iff (< x 0)
(< 0 y))))))|#
;;; After J gets the ``or hint'' into ACL2, consider using it with the
;;; following rule when things are stable-under-simplificationp to
;;; conditionally try rewriting equal to iff.
;;; Taken from rtl/rel5/arithmetic/predicate.lisp
;;; Rewrites an equality of two "predicates" to, essentially, an iff.
;;; This can save you from having to do two proofs, one for each of
;;; the forward and back directions.
;;; Feel free to add more predicates to this list as time goes on.
(defun predicate-p (term)
(and (consp term) ;drop this test?
(member (car term) '(equal <
integerp rationalp
#+non-standard-analysis realp
complex-rationalp
#+non-standard-analysis complexp
))))
;;; This can cause case-splits, but that's sort of the point.
(defthm equal-of-predicates-rewrite
(implies (and (syntaxp (and (predicate-p a)
(predicate-p b)))
(booleanp a)
(booleanp b))
(equal (equal a b)
(iff a b))))
|