/usr/share/acl2-4.3/books/unicode/two-nats-measure.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 126 127 | ;; 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")
(local (include-book "arithmetic/top-with-meta" :dir :system))
(defund two-nats-measure (a b)
(declare (xargs :guard (and (natp a)
(natp b))))
(make-ord 2
(+ 1 (nfix a))
(make-ord 1 (+ 1 (nfix b)) 0)))
(in-theory (disable (:executable-counterpart two-nats-measure)))
(defthm o-p-of-two-nats-measure
(equal (o-p (two-nats-measure a b))
t)
:hints(("Goal" :in-theory (enable two-nats-measure))))
(defthm o<-of-two-nats-measure
(equal (o< (two-nats-measure a b)
(two-nats-measure c d))
(or (< (nfix a) (nfix c))
(and (equal (nfix a) (nfix c))
(< (nfix b) (nfix d)))))
:hints(("Goal" :in-theory (enable two-nats-measure))))
(defund nat-list-measure (a)
(declare (xargs :guard t
:verify-guards nil))
(if (atom a)
(nfix a)
(make-ord (len a) (+ 1 (nfix (car a)))
(nat-list-measure (cdr a)))))
(in-theory (disable (:executable-counterpart nat-list-measure)))
(defthm consp-nat-list-measure
(equal (consp (nat-list-measure a))
(consp a))
:hints(("Goal" :in-theory (enable nat-list-measure))))
(defthm atom-caar-nat-list-measure
(equal (caar (nat-list-measure a))
(and (consp a)
(len a)))
:hints(("Goal" :in-theory (enable nat-list-measure))))
(defthm o-p-of-nat-list-measure
(o-p (nat-list-measure a))
:hints(("Goal" :in-theory (enable o-p nat-list-measure))))
(defun cons-list-or-quotep (x)
(if (atom x)
(equal x nil)
(case (car x)
(quote t)
(cons (and (eql (len x) 3)
(cons-list-or-quotep (third x)))))))
(defthm o<-of-nat-list-measure
(implies (syntaxp (and (cons-list-or-quotep a)
(cons-list-or-quotep b)))
(equal (o< (nat-list-measure a)
(nat-list-measure b))
(or (< (len a) (len b))
(and (equal (len a) (len b))
(if (consp a)
(or (< (nfix (car a)) (nfix (car b)))
(and (equal (nfix (car a)) (nfix (car b)))
(o< (nat-list-measure (cdr a))
(nat-list-measure (cdr b)))))
(< (nfix a) (nfix b)))))))
:hints(("Goal" :in-theory (enable nat-list-measure))))
(defun nat-list-< (a b)
(o< (nat-list-measure a) (nat-list-measure b)))
(defthm nat-list-wfr
(and (o-p (nat-list-measure x))
(implies (nat-list-< x y)
(o< (nat-list-measure x)
(nat-list-measure y))))
:rule-classes :well-founded-relation)
(defthm open-nat-list-<
(implies (syntaxp (and (cons-list-or-quotep a)
(cons-list-or-quotep b)))
(equal (nat-list-< a b)
(or (< (len a) (len b))
(and (equal (len a) (len b))
(if (consp a)
(or (< (nfix (car a)) (nfix (car b)))
(and (equal (nfix (car a)) (nfix (car b)))
(nat-list-< (cdr a) (cdr b))))
(< (nfix a) (nfix b)))))))
:hints (("goal" :use o<-of-nat-list-measure
:in-theory (disable o<-of-nat-list-measure))))
(defthm natp-nat-list-<
(implies (and (atom a) (atom b))
(equal (nat-list-< a b)
(< (nfix a) (nfix b))))
:hints (("goal" :use o<-of-nat-list-measure
:in-theory (disable o<-of-nat-list-measure))))
(in-theory (disable nat-list-<))
|