Filtering...

var-book

books/acl2s/defdata/var-book
other
(in-package "ACL2S")
other
(include-book "splitnat")
other
(include-book "switchnat")
other
(include-book "defdata-core")
other
(include-book "random-state")
other
(include-book "enumerators-gen")
other
(include-book "defdata-util")
other
(include-book "library-support")
other
(include-book "register-data-constructor")
other
(include-book "register-type")
other
(include-book "register-combinator")
other
(include-book "listof")
other
(include-book "tau-characterization")
other
(include-book "tools/rulesets" :dir :system)
other
(defdata var-char
  (enum '(#\X #\Y
      #\L
      #\N
      #\Z
      #\I
      #\J
      #\K
      #\A
      #\B
      #\C
      #\M
      #\D
      #\E
      #\F
      #\G
      #\H
      #\0
      #\1
      #\O
      #\P
      #\Q
      #\R
      #\S
      #\T
      #\U
      #\V
      #\W
      #\2
      #\3
      #\4
      #\5
      #\6
      #\7
      #\8
      #\9
      #\-)))
other
(def-const *non-nil-non-t-fix* '(#\X))
other
(defdata var-char-num
  (enum '(#\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\9)))
other
(defthm char-var-char
  (implies (var-charp x)
    (characterp x))
  :rule-classes ((:compound-recognizer) (:forward-chaining)))
non-nil-non-t-char-listpfunction
(defun non-nil-non-t-char-listp
  (l)
  (declare (xargs :guard t))
  (and (not (equal l '(#\N #\I #\L)))
    (not (equal l '(#\T)))))
var-char-listp-auxfunction
(defun var-char-listp-aux
  (l)
  (declare (xargs :guard t))
  (if (consp l)
    (and (var-charp (car l))
      (var-char-listp-aux (cdr l)))
    (equal l nil)))
var-char-listpfunction
(defun var-char-listp
  (l)
  (declare (xargs :guard t))
  (and (consp l)
    (non-nil-non-t-char-listp l)
    (not (var-char-nump (car l)))
    (var-char-listp-aux l)))
other
(defthm var-char-listp-aux-char-listp
  (implies (var-char-listp-aux l)
    (character-listp l))
  :rule-classes ((:forward-chaining)))
other
(defthm var-char-listp-char-listp
  (implies (var-char-listp l)
    (character-listp l))
  :rule-classes ((:forward-chaining)))
other
(encapsulate nil
  (local (include-book "arithmetic-5/top" :dir :system)))
other
(set-ignore-ok t)
other
(verify-termination nth-var-char-builtin)
other
(set-ignore-ok nil)
get-var-char-list-aux-from-positionsfunction
(defun get-var-char-list-aux-from-positions
  (l)
  (declare (xargs :guard (nat-listp l)))
  (if (endp l)
    nil
    (cons (nth-var-char-builtin (car l))
      (get-var-char-list-aux-from-positions (cdr l)))))
fix-char-listfunction
(defun fix-char-list
  (l)
  (declare (xargs :guard t))
  (cond ((atom l) '(#\X))
    ((var-char-nump (car l)) (cons #\X l))
    (t l)))
get-var-char-list-from-positionsfunction
(defun get-var-char-list-from-positions
  (l)
  (declare (xargs :guard (nat-listp l)))
  (b* ((res (get-var-char-list-aux-from-positions l)) (res1 (fix-char-list res))
      ((when (non-nil-non-t-char-listp res1)) res1))
    *non-nil-non-t-fix*))
nth-var-stringfunction
(defun nth-var-string
  (n)
  (b* ((str-len (1+ (mod n 5))) (char-pos-list (split-nat str-len n))
      (charlist (get-var-char-list-from-positions char-pos-list))
      (clist (fix-char-list charlist)))
    (coerce clist 'string)))
nth-var-builtinfunction
(defun nth-var-builtin
  (n)
  (intern$ (nth-var-string n) "ACL2S"))
varpfunction
(defun varp
  (x)
  (declare (xargs :guard t))
  (b* (((unless (legal-variablep x)) nil) (name (symbol-name x))
      (clist (coerce name 'list)))
    (var-char-listp clist)))
other
(register-type var
  :predicate varp
  :enumerator nth-var-builtin)
other
(defthm legal-variable-is-symbol
  (and (implies (legal-variablep x)
      (symbolp x)))
  :hints (("goal" :in-theory (enable legal-variable-or-constant-namep)))
  :rule-classes (:compound-recognizer :forward-chaining))
other
(defthm legal-variable-disjoint-with-keys
  (implies (keywordp x)
    (not (legal-variablep x)))
  :hints (("goal" :in-theory (enable legal-variable-or-constant-namep)))
  :rule-classes ((:rewrite :backchain-limit-lst 1)))
other
(defthm legal-variable-disjoint-with-bool
  (implies (booleanp x)
    (not (legal-variablep x)))
  :hints (("goal" :in-theory (enable legal-variable-or-constant-namep)))
  :rule-classes ((:rewrite :backchain-limit-lst 1)))
other
(defthm legal-variable-disjoint-with-legal-constant
  (implies (legal-constantp x)
    (not (legal-variablep x)))
  :hints (("goal" :in-theory (enable legal-variable-or-constant-namep)))
  :rule-classes ((:rewrite :backchain-limit-lst 1)))
other
(in-theory (disable legal-variablep
    legal-constantp))
other
(defthm var-symbolp
  (implies (varp x) (symbolp x))
  :hints (("goal" :in-theory (enable legal-variable-or-constant-namep)))
  :rule-classes ((:compound-recognizer) (:forward-chaining)))
other
(defthm var-legal-variablep
  (implies (varp x)
    (legal-variablep x))
  :rule-classes ((:rewrite :backchain-limit-lst 1)))
other
(defthm legal-variablep-proper-symbolp
  (implies (legal-variablep x)
    (proper-symbolp x))
  :hints (("goal" :in-theory (e/d (proper-symbolp) (keywordp))))
  :rule-classes ((:rewrite :backchain-limit-lst 1)))
other
(in-theory (disable varp))
other
(defthm var-disjoint-with-keys
  (implies (keywordp x)
    (not (varp x)))
  :hints (("goal" :in-theory (e/d nil (keywordp))))
  :rule-classes ((:rewrite :backchain-limit-lst 1)))
other
(defthm var-disjoint-with-bool
  (implies (booleanp x)
    (not (varp x)))
  :hints (("goal" :in-theory (enable legal-variable-or-constant-namep)))
  :rule-classes ((:rewrite :backchain-limit-lst 1)))
other
(defthm var-proper-symbolp
  (implies (varp x)
    (proper-symbolp x))
  :hints (("goal" :in-theory (enable proper-symbolp)))
  :rule-classes ((:rewrite :backchain-limit-lst 1)))