• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Debugging
    • Projects
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
      • Gl
      • Esim
      • Vl2014
      • Sv
        • Svex-stvs
        • Svex-fixpoint-decomposition-methodology
        • Sv-versus-esim
        • Svex-decomp
        • Svex-compose-dfs
        • Moddb
        • Svex-compilation
        • Svmods
          • Address
          • Wire
          • Module
          • Lhs
            • Lhs.lisp
            • Lhs-p
            • Lhs-fix
              • Lhrange
              • Lhs-eval-zero
              • Lhs-equiv
              • Lhs-eval
              • Lhs->svex
            • Svar-add-namespace
            • Path
            • Design
            • Modinst
            • Lhs-add-namespace
            • Modalist
            • Path-add-namespace
            • Modname->submodnames
            • Name
            • Svex-alist-addr-p
            • Constraintlist-addr-p
            • Svar-map-addr-p
            • Lhspairs-addr-p
            • Assigns-addr-p
            • Modname
            • Lhs-addr-p
            • Lhatom-addr-p
            • Modhier-measure
            • Modhier-list-measure
            • Attributes
            • Modhier-list-measure-aux
            • Modhier-loopfreelist-p
            • Modhier-loopfree-p
          • Svstmt
          • Sv-tutorial
          • Expressions
          • Symbolic-test-vector
          • Vl-to-svex
        • Fgl
        • Vl
        • X86isa
        • Svl
        • Rtl
      • Software-verification
      • Testing-utilities
      • Math
    • Lhs

    Lhs-fix

    (lhs-fix x) is a usual fty list fixing function.

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

    In the logic, we apply lhrange-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: lhs-fix$inline

    (defun lhs-fix$inline (x)
           (declare (xargs :guard (lhs-p x)))
           (let ((__function__ 'lhs-fix))
                (declare (ignorable __function__))
                (mbe :logic (if (atom x)
                                nil
                                (cons (lhrange-fix (car x))
                                      (lhs-fix (cdr x))))
                     :exec x)))

    Theorem: lhs-p-of-lhs-fix

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

    Theorem: lhs-fix-when-lhs-p

    (defthm lhs-fix-when-lhs-p
            (implies (lhs-p x)
                     (equal (lhs-fix x) x)))

    Function: lhs-equiv$inline

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

    Theorem: lhs-equiv-is-an-equivalence

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

    Theorem: lhs-equiv-implies-equal-lhs-fix-1

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

    Theorem: lhs-fix-under-lhs-equiv

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

    Theorem: equal-of-lhs-fix-1-forward-to-lhs-equiv

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

    Theorem: equal-of-lhs-fix-2-forward-to-lhs-equiv

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

    Theorem: lhs-equiv-of-lhs-fix-1-forward

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

    Theorem: lhs-equiv-of-lhs-fix-2-forward

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

    Theorem: car-of-lhs-fix-x-under-lhrange-equiv

    (defthm car-of-lhs-fix-x-under-lhrange-equiv
            (lhrange-equiv (car (lhs-fix x))
                           (car x)))

    Theorem: car-lhs-equiv-congruence-on-x-under-lhrange-equiv

    (defthm car-lhs-equiv-congruence-on-x-under-lhrange-equiv
            (implies (lhs-equiv x x-equiv)
                     (lhrange-equiv (car x) (car x-equiv)))
            :rule-classes :congruence)

    Theorem: cdr-of-lhs-fix-x-under-lhs-equiv

    (defthm cdr-of-lhs-fix-x-under-lhs-equiv
            (lhs-equiv (cdr (lhs-fix x)) (cdr x)))

    Theorem: cdr-lhs-equiv-congruence-on-x-under-lhs-equiv

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

    Theorem: cons-of-lhrange-fix-x-under-lhs-equiv

    (defthm cons-of-lhrange-fix-x-under-lhs-equiv
            (lhs-equiv (cons (lhrange-fix x) y)
                       (cons x y)))

    Theorem: cons-lhrange-equiv-congruence-on-x-under-lhs-equiv

    (defthm cons-lhrange-equiv-congruence-on-x-under-lhs-equiv
            (implies (lhrange-equiv x x-equiv)
                     (lhs-equiv (cons x y) (cons x-equiv y)))
            :rule-classes :congruence)

    Theorem: cons-of-lhs-fix-y-under-lhs-equiv

    (defthm cons-of-lhs-fix-y-under-lhs-equiv
            (lhs-equiv (cons x (lhs-fix y))
                       (cons x y)))

    Theorem: cons-lhs-equiv-congruence-on-y-under-lhs-equiv

    (defthm cons-lhs-equiv-congruence-on-y-under-lhs-equiv
            (implies (lhs-equiv y y-equiv)
                     (lhs-equiv (cons x y) (cons x y-equiv)))
            :rule-classes :congruence)

    Theorem: consp-of-lhs-fix

    (defthm consp-of-lhs-fix
            (equal (consp (lhs-fix x)) (consp x)))

    Theorem: lhs-fix-under-iff

    (defthm lhs-fix-under-iff
            (iff (lhs-fix x) (consp x)))

    Theorem: lhs-fix-of-cons

    (defthm lhs-fix-of-cons
            (equal (lhs-fix (cons a x))
                   (cons (lhrange-fix a) (lhs-fix x))))

    Theorem: len-of-lhs-fix

    (defthm len-of-lhs-fix
            (equal (len (lhs-fix x)) (len x)))

    Theorem: lhs-fix-of-append

    (defthm lhs-fix-of-append
            (equal (lhs-fix (append std::a std::b))
                   (append (lhs-fix std::a)
                           (lhs-fix std::b))))

    Theorem: lhs-fix-of-repeat

    (defthm lhs-fix-of-repeat
            (equal (lhs-fix (repeat acl2::n x))
                   (repeat acl2::n (lhrange-fix x))))

    Theorem: list-equiv-refines-lhs-equiv

    (defthm list-equiv-refines-lhs-equiv
            (implies (list-equiv x y)
                     (lhs-equiv x y))
            :rule-classes :refinement)

    Theorem: nth-of-lhs-fix

    (defthm nth-of-lhs-fix
            (equal (nth acl2::n (lhs-fix x))
                   (if (< (nfix acl2::n) (len x))
                       (lhrange-fix (nth acl2::n x))
                       nil)))

    Theorem: lhs-equiv-implies-lhs-equiv-append-1

    (defthm lhs-equiv-implies-lhs-equiv-append-1
            (implies (lhs-equiv x fty::x-equiv)
                     (lhs-equiv (append x y)
                                (append fty::x-equiv y)))
            :rule-classes (:congruence))

    Theorem: lhs-equiv-implies-lhs-equiv-append-2

    (defthm lhs-equiv-implies-lhs-equiv-append-2
            (implies (lhs-equiv y fty::y-equiv)
                     (lhs-equiv (append x y)
                                (append x fty::y-equiv)))
            :rule-classes (:congruence))

    Theorem: lhs-equiv-implies-lhs-equiv-nthcdr-2

    (defthm lhs-equiv-implies-lhs-equiv-nthcdr-2
            (implies (lhs-equiv acl2::l l-equiv)
                     (lhs-equiv (nthcdr acl2::n acl2::l)
                                (nthcdr acl2::n l-equiv)))
            :rule-classes (:congruence))

    Theorem: lhs-equiv-implies-lhs-equiv-take-2

    (defthm lhs-equiv-implies-lhs-equiv-take-2
            (implies (lhs-equiv acl2::l l-equiv)
                     (lhs-equiv (take acl2::n acl2::l)
                                (take acl2::n l-equiv)))
            :rule-classes (:congruence))