Filtering...

listof

books/acl2s/defdata/listof
other
(in-package "DEFDATA")
other
(include-book "tools/templates" :dir :system)
other
(include-book "register-combinator")
other
(def-const *listof-export-defthms*
  '((defthm _pred_-implies-tlp
     (implies (_pred_ x)
       (true-listp x))
     :hints (("Goal" :in-theory (enable true-listp)))
     :rule-classes ((:forward-chaining) (:compound-recognizer)
       (:rewrite :backchain-limit-lst 1))) (:@ :atom-list-subtype-p (defthm _pred_-subtype-of-atom-list
        (implies (_pred_ x)
          (atom-listp x))
        :rule-classes :tau-system))))
other
(program)
listof-theory-eventsfunction
(defun listof-theory-events
  (name cbody
    new-types
    kwd-alist
    wrld)
  (declare (xargs :mode :program))
  (b* ((m (append new-types
         (table-alist 'type-metadata-table
           wrld))) (a (table-alist 'type-alias-table
          wrld))
      (pred (predicate-name name
          a
          m))
      ((when (not (proper-symbolp pred))) (er hard?
          'listof-theory-events
          "~| Couldnt find predicate name for ~x0.~%"
          name))
      ((mv atom-list-subtypep ?cpred) (if (and (proper-symbolp cbody)
            (assoc-eq cbody m))
          (mv (subtype-p (predicate-name cbody
                a
                m)
              'atom
              wrld)
            (predicate-name cbody
              a
              m))
          (mv nil :undef)))
      (disabled (get1 :disabled kwd-alist))
      (curr-pkg (get1 :current-package kwd-alist))
      (pkg-sym (pkg-witness curr-pkg))
      (local-events-template nil)
      (export-defthms-template *listof-export-defthms*)
      (features (and atom-list-subtypep '(:atom-list-subtype-p)))
      (splice-alist `((_disabled-runes_ . ,DEFDATA::DISABLED)))
      (atom-alist `((_pred_ . ,DEFDATA::PRED) (_cpred_ . ,DEFDATA::CPRED)))
      (str-alist `(("_PRED_" . ,(SYMBOL-NAME DEFDATA::PRED)) ("_CPRED_" . ,(SYMBOL-NAME DEFDATA::CPRED))))
      (local-events (template-subst local-events-template
          :features features
          :splice-alist splice-alist
          :atom-alist atom-alist
          :str-alist str-alist
          :pkg-sym pkg-sym))
      (export-defthms (template-subst export-defthms-template
          :features features
          :splice-alist splice-alist
          :atom-alist atom-alist
          :str-alist str-alist
          :pkg-sym pkg-sym))
      (all-defthm-names (get-event-names export-defthms))
      (theory-name (get1 :theory-name kwd-alist)))
    `(,@(AND DEFDATA::LOCAL-EVENTS
       `((DEFDATA::LOCAL (PROGN . ,DEFDATA::LOCAL-EVENTS)))) ,@DEFDATA::EXPORT-DEFTHMS
      (def-ruleset! ,DEFDATA::THEORY-NAME
        ',DEFDATA::ALL-DEFTHM-NAMES))))
listof-theory-evfunction
(defun listof-theory-ev
  (p top-kwd-alist wrld)
  (b* (((cons name a) p) ((assocs pdef new-types kwd-alist) a)
      (kwd-alist (append kwd-alist top-kwd-alist)))
    (case-match pdef
      (('listof cbody) (listof-theory-events name
          cbody
          new-types
          kwd-alist
          wrld))
      (& 'nil))))
other
(defloop user-listof-theory-events1
  (ps kwd-alist wrld)
  (for ((p in ps))
    (append (listof-theory-ev p
        kwd-alist
        wrld))))
user-listof-theory-eventsfunction
(defun user-listof-theory-events
  (ps kwd-alist wrld)
  (b* ((events (user-listof-theory-events1 ps
         kwd-alist
         wrld)))
    (and (consp events)
      (append `((commentary ,(DEFDATA::GET1 :PRINT-COMMENTARY DEFDATA::KWD-ALIST)
           "~| Listof theory events...~%") (value-triple (progn$ (time-tracker :listof-theory-events :end)
              (time-tracker :listof-theory-events :init :times '(2 7)
                :interval 5
                :msg "Elapsed runtime in theory events for listof is ~st secs;~|~%")
              :invisible)))
        events))))
other
(logic)
other
(deflabel listof)
other
(register-user-combinator listof
  :arity 1
  :verbose t
  :aliases (subset subset listof)
  :expansion (lambda (_name _args)
    `(or nil (cons ,(CAR DEFDATA::_ARGS) ,DEFDATA::_NAME)))
  :polymorphic-type-form (listof :a)
  :post-pred-hook-fns (user-listof-theory-events))