; RTL - A Formal Theory of Register-Transfer Logic and Computer Arithmetic 
; Copyright (C) 1995-2013 Advanced Mirco Devices, Inc. 
;
; Contact:
;   David Russinoff
;   1106 W 9th St., Austin, TX 78703
;   http://www.russsinoff.com/
;
; This program is free software; you can redistribute it and/or modify it under
; the terms of the GNU General Public License as published by the Free Software
; Foundation; either version 2 of the License, or (at your option) any later
; version.
;
; This program is distributed in the hope that it will be useful but WITHOUT ANY
; WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
; PARTICULAR PURPOSE.  See the GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License along with
; this program; see the file "gpl.txt" in this directory.  If not, write to the
; Free Software Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA
; 02110-1335, USA.
;
; Author: David M. Russinoff (david@russinoff.com)

(in-package "ACL2")

;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 predicatep (term)
  (and (consp term) ;drop this test?
       (member (car term) '(< integerp power2p complex-rationalp rationalp bvecp))))

;This can cause case-splits, but that's sort of the point.
;We could actually rewrite to iff instead of the and of the implies...
(defthm equal-of-preds-rewrite
  (implies (and (syntaxp (and (predicatep a)
                              (predicatep b)))
                (case-split (booleanp a)) ;or force?
                (case-split (booleanp b)) ;or force?
                )
           (equal (equal a b)
                  (and (implies a b)
                       (implies b a)))))




