• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Debugging
    • Projects
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
      • Theories
      • Rule-classes
      • Proof-builder
      • Hons-and-memoization
      • Events
      • History
      • Parallelism
      • Programming
      • Start-here
      • Real
      • Debugging
      • Miscellaneous
      • Output-controls
      • Macros
        • Make-event
        • Defmacro
        • Untranslate-patterns
        • Tc
        • Macro-aliases-table
        • Macro-args
        • Defabbrev
        • User-defined-functions-table
        • Untranslate-for-execution
          • Convert-subexpression-to-mv
          • Ute-term-p
          • Reincarnate-mvs
          • Match-cons-nest
            • Match-cons-nest-aux
        • Trans
        • Add-macro-fn
        • Check-vars-not-free
        • Safe-mode
        • Macro-libraries
        • Defmacro-untouchable
        • Trans1
        • Set-duplicate-keys-action
        • Add-macro-alias
        • Magic-macroexpand
        • Defmacroq
        • Remove-macro-fn
        • Remove-macro-alias
        • Add-binop
        • Untrans-table
        • Trans!
        • Remove-binop
        • Tcp
        • Tca
      • Interfacing-tools
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
    • Testing-utilities
    • Math
  • Untranslate-for-execution

Match-cons-nest

Matches (cons x1 (cons ... (cons xn 'nil))).

Signature
(match-cons-nest x) → (mv matchp args)
Arguments
x — Guard (ute-term-p x).
Returns
matchp — Type (booleanp matchp).
args — Type (ute-termlist-p args), given the guard.

Definitions and Theorems

Function: match-cons-nest

(defun match-cons-nest (x)
       (declare (xargs :guard (ute-term-p x)))
       (let ((__function__ 'match-cons-nest))
            (declare (ignorable __function__))
            (if (and (consp x) (eq (car x) 'cons))
                (mv-let (matchp acc)
                        (match-cons-nest-aux x nil)
                        (mv matchp (rev acc)))
                (mv nil nil))))

Theorem: booleanp-of-match-cons-nest.matchp

(defthm booleanp-of-match-cons-nest.matchp
        (b* (((mv ?matchp ?args)
              (match-cons-nest x)))
            (booleanp matchp))
        :rule-classes :type-prescription)

Theorem: ute-termlist-p-of-match-cons-nest.args

(defthm ute-termlist-p-of-match-cons-nest.args
        (implies (and (ute-term-p x))
                 (b* (((mv ?matchp ?args)
                       (match-cons-nest x)))
                     (ute-termlist-p args)))
        :rule-classes :rewrite)

Subtopics

Match-cons-nest-aux