• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Debugging
    • Projects
    • Std
    • Proof-automation
      • Gl
      • Witness-cp
      • Ccg
      • Install-not-normalized
      • Rewrite$
      • Removable-runes
      • Efficiency
      • Rewrite-bounds
      • Bash
      • Def-dag-measure
      • 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-interpreter-overview
        • Fgl-counterexamples
        • Fgl-correctness-of-binding-free-variables
        • Fgl-debugging
        • Fgl-testbenches
        • Def-fgl-boolean-constraint
        • Fgl-stack
        • Fgl-rewrite-tracing
        • Def-fgl-param-thm
        • Def-fgl-thm
        • Fgl-fast-alist-support
        • Advanced-equivalence-checking-with-fgl
          • Solve-lane-by-lane-masked
          • Solve-lane-by-lane-masked+
          • Top-level-equal
          • Solve-lane-by-lane
          • Replace-equal-with-top-level-equal-rec
            • Lookup-previous-stack-frame-binding
            • Monolithic-sat-with-transforms
            • Ipasir-sat-limit100
          • Fgl-array-support
          • Fgl-internals
        • Bdd
        • Remove-hyps
        • Contextual-rewriting
        • Simp
        • Rewrite$-hyps
        • Bash-term-to-dnf
        • Use-trivial-ancestors-check
        • Minimal-runes
        • Clause-processor-tools
        • Fn-is-body
        • Without-subsumption
        • Rewrite-equiv-hint
        • Def-bounds
        • Rewrite$-context
        • Try-gl-concls
        • Hint-utils
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Testing-utilities
      • Math
    • Advanced-equivalence-checking-with-fgl

    Replace-equal-with-top-level-equal-rec

    Signature
    (replace-equal-with-top-level-equal-rec x) → new-x
    Arguments
    x — Guard (pseudo-termp x).
    Returns
    new-x — Type (pseudo-termp new-x).

    Definitions and Theorems

    Function: replace-equal-with-top-level-equal-rec

    (defun
     replace-equal-with-top-level-equal-rec
     (x)
     (declare (xargs :guard (pseudo-termp x)))
     (let
      ((__function__ 'replace-equal-with-top-level-equal-rec))
      (declare (ignorable __function__))
      (pseudo-term-case
       x
       :fncall
       (cond
        ((eq x.fn 'equal)
         (pseudo-term-fncall 'top-level-equal
                             x.args))
        ((eq x.fn 'implies)
         (pseudo-term-fncall
          'implies
          (list
             (first x.args)
             (replace-equal-with-top-level-equal-rec (second x.args)))))
        ((eq x.fn 'if)
         (if
          (equal (third x.args) ''nil)
          (pseudo-term-fncall
           'if
           (list
                (replace-equal-with-top-level-equal-rec (first x.args))
                (replace-equal-with-top-level-equal-rec (second x.args))
                ''nil))
          (pseudo-term-fncall
           'if
           (list
             (first x.args)
             (replace-equal-with-top-level-equal-rec (second x.args))
             (replace-equal-with-top-level-equal-rec (third x.args))))))
        ((eq x.fn 'return-last)
         (pseudo-term-fncall
          'return-last
          (list
              (first x.args)
              (second x.args)
              (replace-equal-with-top-level-equal-rec (third x.args)))))
        (t (pseudo-term-fix x)))
       :lambda (pseudo-term-lambda
                    x.formals
                    (replace-equal-with-top-level-equal-rec x.body)
                    x.args)
       :otherwise (pseudo-term-fix x))))

    Theorem: pseudo-termp-of-replace-equal-with-top-level-equal-rec

    (defthm pseudo-termp-of-replace-equal-with-top-level-equal-rec
            (b* ((new-x (replace-equal-with-top-level-equal-rec x)))
                (pseudo-termp new-x))
            :rule-classes :rewrite)

    Theorem: replace-equal-with-top-level-equal-rec-correct

    (defthm
        replace-equal-with-top-level-equal-rec-correct
        (equal (repl-equal-ev (replace-equal-with-top-level-equal-rec x)
                              a)
               (repl-equal-ev x a)))