• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
      • Gl
      • Esim
      • Vl2014
      • Sv
      • Fgl
        • Fgl-rewrite-rules
        • Fgl-function-mode
        • Fgl-object
        • Fgl-solving
        • Fgl-handling-if-then-elses
        • Fgl-getting-bits-from-objects
        • Fgl-primitive-and-meta-rules
        • Fgl-counterexamples
        • Fgl-interpreter-overview
        • Fgl-correctness-of-binding-free-variables
        • Fgl-debugging
        • Fgl-testbenches
        • Def-fgl-boolean-constraint
        • Fgl-stack
          • Scratchobj
          • Minor-frame
          • Major-frame
          • Major-stack
            • Major-stack-fix
              • Major-stack-equiv
              • Major-stack-p
            • Scratchlist
            • Minor-stack
          • Fgl-rewrite-tracing
          • Def-fgl-param-thm
          • Def-fgl-thm
          • Fgl-fast-alist-support
          • Fgl-array-support
          • Advanced-equivalence-checking-with-fgl
          • Fgl-fty-support
          • Fgl-internals
        • Vwsim
        • Vl
        • X86isa
        • Svl
        • Rtl
      • Software-verification
      • Math
      • Testing-utilities
    • Major-stack

    Major-stack-fix

    (major-stack-fix x) is a usual ACL2::fty list fixing function.

    Signature
    (major-stack-fix x) → fty::newx
    Arguments
    x — Guard (major-stack-p x).
    Returns
    fty::newx — Type (major-stack-p fty::newx).

    In the logic, we apply major-frame-fix to each member of the x. In the execution, none of that is actually necessary and this is just an inlined identity function.

    Definitions and Theorems

    Function: major-stack-fix$inline

    (defun major-stack-fix$inline (x)
      (declare (xargs :guard (major-stack-p x)))
      (let ((__function__ 'major-stack-fix))
        (declare (ignorable __function__))
        (mbe :logic
             (if (consp (cdr x))
                 (cons (major-frame-fix (car x))
                       (major-stack-fix (cdr x)))
               (cons (major-frame-fix (car x)) nil))
             :exec x)))

    Theorem: major-stack-p-of-major-stack-fix

    (defthm major-stack-p-of-major-stack-fix
      (b* ((fty::newx (major-stack-fix$inline x)))
        (major-stack-p fty::newx))
      :rule-classes :rewrite)

    Theorem: major-stack-fix-when-major-stack-p

    (defthm major-stack-fix-when-major-stack-p
      (implies (major-stack-p x)
               (equal (major-stack-fix x) x)))

    Function: major-stack-equiv$inline

    (defun major-stack-equiv$inline (x y)
      (declare (xargs :guard (and (major-stack-p x)
                                  (major-stack-p y))))
      (equal (major-stack-fix x)
             (major-stack-fix y)))

    Theorem: major-stack-equiv-is-an-equivalence

    (defthm major-stack-equiv-is-an-equivalence
      (and (booleanp (major-stack-equiv x y))
           (major-stack-equiv x x)
           (implies (major-stack-equiv x y)
                    (major-stack-equiv y x))
           (implies (and (major-stack-equiv x y)
                         (major-stack-equiv y z))
                    (major-stack-equiv x z)))
      :rule-classes (:equivalence))

    Theorem: major-stack-equiv-implies-equal-major-stack-fix-1

    (defthm major-stack-equiv-implies-equal-major-stack-fix-1
      (implies (major-stack-equiv x x-equiv)
               (equal (major-stack-fix x)
                      (major-stack-fix x-equiv)))
      :rule-classes (:congruence))

    Theorem: major-stack-fix-under-major-stack-equiv

    (defthm major-stack-fix-under-major-stack-equiv
      (major-stack-equiv (major-stack-fix x)
                         x)
      :rule-classes (:rewrite :rewrite-quoted-constant))

    Theorem: equal-of-major-stack-fix-1-forward-to-major-stack-equiv

    (defthm equal-of-major-stack-fix-1-forward-to-major-stack-equiv
      (implies (equal (major-stack-fix x) y)
               (major-stack-equiv x y))
      :rule-classes :forward-chaining)

    Theorem: equal-of-major-stack-fix-2-forward-to-major-stack-equiv

    (defthm equal-of-major-stack-fix-2-forward-to-major-stack-equiv
      (implies (equal x (major-stack-fix y))
               (major-stack-equiv x y))
      :rule-classes :forward-chaining)

    Theorem: major-stack-equiv-of-major-stack-fix-1-forward

    (defthm major-stack-equiv-of-major-stack-fix-1-forward
      (implies (major-stack-equiv (major-stack-fix x)
                                  y)
               (major-stack-equiv x y))
      :rule-classes :forward-chaining)

    Theorem: major-stack-equiv-of-major-stack-fix-2-forward

    (defthm major-stack-equiv-of-major-stack-fix-2-forward
      (implies (major-stack-equiv x (major-stack-fix y))
               (major-stack-equiv x y))
      :rule-classes :forward-chaining)

    Theorem: car-of-major-stack-fix-x-under-major-frame-equiv

    (defthm car-of-major-stack-fix-x-under-major-frame-equiv
      (major-frame-equiv (car (major-stack-fix x))
                         (car x)))

    Theorem: car-major-stack-equiv-congruence-on-x-under-major-frame-equiv

    (defthm
          car-major-stack-equiv-congruence-on-x-under-major-frame-equiv
      (implies (major-stack-equiv x x-equiv)
               (major-frame-equiv (car x)
                                  (car x-equiv)))
      :rule-classes :congruence)

    Theorem: cdr-of-major-stack-fix-x-under-major-stack-equiv

    (defthm cdr-of-major-stack-fix-x-under-major-stack-equiv
      (major-stack-equiv (cdr (major-stack-fix x))
                         (cdr x)))

    Theorem: cdr-major-stack-equiv-congruence-on-x-under-major-stack-equiv

    (defthm
          cdr-major-stack-equiv-congruence-on-x-under-major-stack-equiv
      (implies (major-stack-equiv x x-equiv)
               (major-stack-equiv (cdr x)
                                  (cdr x-equiv)))
      :rule-classes :congruence)

    Theorem: cons-of-major-frame-fix-x-under-major-stack-equiv

    (defthm cons-of-major-frame-fix-x-under-major-stack-equiv
      (major-stack-equiv (cons (major-frame-fix x) y)
                         (cons x y)))

    Theorem: cons-major-frame-equiv-congruence-on-x-under-major-stack-equiv

    (defthm
         cons-major-frame-equiv-congruence-on-x-under-major-stack-equiv
      (implies (major-frame-equiv x x-equiv)
               (major-stack-equiv (cons x y)
                                  (cons x-equiv y)))
      :rule-classes :congruence)

    Theorem: consp-of-major-stack-fix

    (defthm consp-of-major-stack-fix
      (consp (major-stack-fix x)))

    Theorem: consp-cdr-of-major-stack-fix

    (defthm consp-cdr-of-major-stack-fix
      (equal (consp (cdr (major-stack-fix x)))
             (consp (cdr x))))

    Theorem: car-of-major-stack-fix

    (defthm car-of-major-stack-fix
      (equal (car (major-stack-fix x))
             (major-frame-fix (car x))))

    Theorem: major-stack-fix-under-iff

    (defthm major-stack-fix-under-iff
      (major-stack-fix x))

    Theorem: major-stack-fix-of-cons

    (defthm major-stack-fix-of-cons
      (equal (major-stack-fix (cons a x))
             (cons (major-frame-fix a)
                   (and (consp x) (major-stack-fix x)))))

    Theorem: len-of-major-stack-fix

    (defthm len-of-major-stack-fix
      (equal (len (major-stack-fix x))
             (max 1 (len x))))