/usr/share/acl2-4.3/books/unicode/rev.lisp is in acl2-books-source 4.3-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | ;; Processing Unicode Files with ACL2
;; Copyright (C) 2005-2006 by Jared Davis <jared@cs.utexas.edu>
;;
;; 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; if not, write to the Free Software Foundation, Inc., 59 Temple
;; Place - Suite 330, Boston, MA 02111-1307, USA.
(in-package "ACL2")
(include-book "revappend")
(include-book "reverse")
(include-book "append")
(defun revappend-without-guard (x y)
(declare (xargs :guard t))
(mbe :logic (revappend x y)
:exec (if (consp x)
(revappend-without-guard (cdr x)
(cons (car x) y))
y)))
(defund rev (x)
(declare (xargs :verify-guards nil
:guard t))
(mbe :logic (if (consp x)
(append (rev (cdr x))
(list (car x)))
nil)
:exec (revappend-without-guard x nil)))
(local (in-theory (enable rev)))
(defthm rev-when-not-consp
(implies (not (consp x))
(equal (rev x)
nil))
:hints(("Goal" :in-theory (enable rev))))
(defthm rev-of-cons
(equal (rev (cons a x))
(append (rev x)
(list a)))
:hints(("Goal" :in-theory (enable rev))))
(defthm true-listp-of-rev
(true-listp (rev x)))
(defthm rev-of-list-fix
(equal (rev (list-fix x))
(rev x))
:hints(("Goal" :induct (len x))))
(defthm len-of-rev
(equal (len (rev x))
(len x)))
(defthm rev-of-rev
(equal (rev (rev x))
(list-fix x)))
(defthm consp-of-rev
(equal (consp (rev x))
(consp x))
:hints(("Goal" :induct (len x))))
(defthm rev-under-iff
(iff (rev x) (consp x))
:hints(("Goal" :induct (len x))))
(defthm revappend-removal
(equal (revappend x y)
(append (rev x) y)))
(verify-guards rev)
(defthm reverse-removal
(implies (true-listp x)
(equal (reverse x)
(rev x))))
(defthm rev-of-append
(equal (rev (append x y))
(append (rev y) (rev x))))
(defthm character-listp-of-rev
(equal (character-listp (rev x))
(character-listp (list-fix x)))
:hints(("Goal" :induct (len x))))
(encapsulate
()
(local (defun cdr-cdr-induction (x y)
(if (or (atom x)
(atom y))
nil
(cdr-cdr-induction (cdr x) (cdr y)))))
(local (defthm lemma
(equal (equal (list a) (append y (list b)))
(and (atom y)
(equal a b)))))
(local (defthm lemma2
(implies (and (true-listp x)
(true-listp y))
(equal (equal (append x (list a))
(append y (list b)))
(and (equal x y)
(equal a b))))
:hints(("Goal" :induct (cdr-cdr-induction x y)))))
(defthm equal-of-rev-and-rev
(equal (equal (rev x) (rev y))
(equal (list-fix x) (list-fix y)))
:hints(("Goal" :induct (cdr-cdr-induction x y)))))
|