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
|
; 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")
(set-enforce-redundancy t)
(include-book "rtl")
(include-book "rtlarr")
(local (include-book "../support/bvecp-helpers"))
(defthm bv-arrp-implies-nonnegative-integerp
(implies (bv-arrp obj size)
(and (integerp (ag index obj))
(<= 0 (ag index obj))))
:rule-classes (:rewrite :type-prescription)
)
; The two events following the next local include-book were added by Matt
; K. June 2004: Some proofs require calls of expt to be evaluated, but some
; calls are just too large (2^2^n for large n). So we use the following hack,
; which allows calls of 2^n for n<130 to be evaluated even when the
; executable-counterpart of expt is disabled. The use of 130 is somewhat
; arbitrary, chosen in the hope that it suffices for relieving of hyps related
; to widths of bit vectors
(local (include-book "../../arithmetic/basic"))
(defun expt-exec (r i)
(declare (xargs :guard
(and (acl2-numberp r)
(integerp i)
(not (and (eql r 0) (< i 0))))))
(mbe :logic (hide (expt r i)) ; hide may avoid potential loop
:exec (expt r i)))
(defthm expt-2-evaluator
(implies (syntaxp (and (quotep n)
(natp (cadr n))
(< (cadr n) 130)
))
(equal (expt 2 n)
(expt-exec 2 n))))
|