• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Community
    • Proof-automation
      • Gl
      • Witness-cp
      • Ccg
      • Install-not-normalized
      • Rewrite$
      • 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
          • Def-ctrex-rule
          • Fgl-counterexample-implementation-details
            • Cgraph
              • Cgraph-p
              • Ctrex-rule
              • Cgraph-fix
                • Cgraph-equiv
              • Cgraph-derive-assignments-for-vars
              • Cgraph-derive-assignments-obj
              • Cgraph-derive-assignments-bindings
          • Fgl-interpreter-overview
          • 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
          • Fgl-array-support
          • Advanced-equivalence-checking-with-fgl
          • Fgl-fty-support
          • Fgl-internals
        • Removable-runes
        • Efficiency
        • Rewrite-bounds
        • Bash
        • Def-dag-measure
        • 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
      • Math
      • Testing-utilities
    • Cgraph

    Cgraph-fix

    (cgraph-fix x) is an ACL2::fty alist fixing function that follows the drop-keys strategy.

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

    Note that in the execution this is just an inline identity function.

    Definitions and Theorems

    Function: cgraph-fix$inline

    (defun cgraph-fix$inline (x)
     (declare (xargs :guard (cgraph-p x)))
     (let ((__function__ 'cgraph-fix))
      (declare (ignorable __function__))
      (mbe
          :logic
          (if (atom x)
              nil
            (let ((rest (cgraph-fix (cdr x))))
              (if (and (consp (car x))
                       (fgl-object-p (caar x)))
                  (let ((fty::first-key (caar x))
                        (fty::first-val (cgraph-outedges-fix (cdar x))))
                    (cons (cons fty::first-key fty::first-val)
                          rest))
                rest)))
          :exec x)))

    Theorem: cgraph-p-of-cgraph-fix

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

    Theorem: cgraph-fix-when-cgraph-p

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

    Function: cgraph-equiv$inline

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

    Theorem: cgraph-equiv-is-an-equivalence

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

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

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

    Theorem: cgraph-fix-under-cgraph-equiv

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

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

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

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

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

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

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

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

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

    Theorem: cons-of-cgraph-outedges-fix-v-under-cgraph-equiv

    (defthm cons-of-cgraph-outedges-fix-v-under-cgraph-equiv
      (cgraph-equiv (cons (cons k (cgraph-outedges-fix v))
                          x)
                    (cons (cons k v) x)))

    Theorem: cons-cgraph-outedges-equiv-congruence-on-v-under-cgraph-equiv

    (defthm
          cons-cgraph-outedges-equiv-congruence-on-v-under-cgraph-equiv
      (implies (cgraph-outedges-equiv v v-equiv)
               (cgraph-equiv (cons (cons k v) x)
                             (cons (cons k v-equiv) x)))
      :rule-classes :congruence)

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

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

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

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

    Theorem: cgraph-fix-of-acons

    (defthm cgraph-fix-of-acons
      (equal (cgraph-fix (cons (cons a b) x))
             (let ((rest (cgraph-fix x)))
               (if (and (fgl-object-p a))
                   (let ((fty::first-key a)
                         (fty::first-val (cgraph-outedges-fix b)))
                     (cons (cons fty::first-key fty::first-val)
                           rest))
                 rest))))

    Theorem: hons-assoc-equal-of-cgraph-fix

    (defthm hons-assoc-equal-of-cgraph-fix
      (equal (hons-assoc-equal k (cgraph-fix x))
             (let ((fty::pair (hons-assoc-equal k x)))
               (and (fgl-object-p k)
                    fty::pair
                    (cons k
                          (cgraph-outedges-fix (cdr fty::pair)))))))

    Theorem: cgraph-fix-of-append

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

    Theorem: consp-car-of-cgraph-fix

    (defthm consp-car-of-cgraph-fix
      (equal (consp (car (cgraph-fix x)))
             (consp (cgraph-fix x))))