• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
      • Ipasir
      • Aignet
      • Aig
      • Satlink
      • Truth
      • Ubdds
      • Bdd
      • Faig
      • Bed
      • 4v
        • 4v-sexprs
          • 4v-sexpr-vars
          • 4v-sexpr-eval
          • 4v-sexpr-to-faig
          • 4v-sexpr-restrict-with-rw
          • 4vs-constructors
          • 4v-sexpr-compose-with-rw
          • 4v-sexpr-restrict
          • 4v-sexpr-alist-extract
          • 4v-sexpr-compose
          • 4v-nsexpr-p
          • 4v-sexpr-purebool-p
          • 4v-sexpr-<=
          • Sfaig
          • Sexpr-equivs
          • 3v-syntax-sexprp
          • Sexpr-rewriting
          • 4v-sexpr-ind
            • 4v-alist-extract
          • 4v-monotonicity
          • 4v-operations
          • Why-4v-logic
          • 4v-<=
          • 4vp
          • 4vcases
          • 4v-fix
          • 4v-lookup
      • Projects
      • Debugging
      • Std
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Testing-utilities
      • Math
    • 4v-sexprs

    4v-sexpr-ind

    Basic structural induction scheme for s-expressions.

    Definitions and Theorems

    Function: 4v-sexpr-ind

    (defun 4v-sexpr-ind (x)
      (declare (xargs :guard t))
      (if (atom x)
          x
        (cons (car x)
              (4v-sexpr-ind-list (cdr x)))))

    Function: 4v-sexpr-ind-list

    (defun 4v-sexpr-ind-list (x)
      (declare (xargs :guard t))
      (if (atom x)
          nil
        (cons (4v-sexpr-ind (car x))
              (4v-sexpr-ind-list (cdr x)))))

    Function: 4v-sexpr-flag

    (defun 4v-sexpr-flag (flag x)
      (declare (xargs :non-executable t))
      (declare (ignorable x))
      (prog2$ (throw-nonexec-error '4v-sexpr-flag
                                   (list flag x))
              (cond ((equal flag 'sexpr)
                     (if (consp x)
                         (cons (car x)
                               (4v-sexpr-flag 'sexpr-list (cdr x)))
                       x))
                    (t (if (consp x)
                           (cons (4v-sexpr-flag 'sexpr (car x))
                                 (4v-sexpr-flag 'sexpr-list (cdr x)))
                         'nil)))))

    Theorem: 4v-sexpr-flag-equivalences

    (defthm 4v-sexpr-flag-equivalences
      (and (equal (4v-sexpr-flag 'sexpr x)
                  (4v-sexpr-ind x))
           (equal (4v-sexpr-flag 'sexpr-list x)
                  (4v-sexpr-ind-list x))))