• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
      • Theories
      • Rule-classes
      • Proof-builder
      • Recursion-and-induction
      • Hons-and-memoization
      • Events
      • Parallelism
      • History
      • Programming
        • Defun
        • Declare
        • System-utilities
        • Stobj
        • State
        • Mutual-recursion
        • Memoize
        • Mbe
        • Io
        • Defpkg
        • Apply$
        • Loop$
        • Programming-with-state
        • Arrays
        • Characters
        • Time$
        • Defmacro
        • Loop$-primer
        • Fast-alists
        • Defconst
        • Evaluation
        • Guard
        • Equality-variants
        • Compilation
        • Hons
        • ACL2-built-ins
        • Developers-guide
        • System-attachments
        • Advanced-features
        • Set-check-invariant-risk
        • Numbers
        • Efficiency
        • Irrelevant-formals
        • Introduction-to-programming-in-ACL2-for-those-who-know-lisp
        • Redefining-programs
        • Lists
        • Invariant-risk
        • Errors
        • Defabbrev
        • Conses
        • Alists
          • Omaps
          • Std/alists
          • Fast-alists
          • Alistp
          • Misc/records
          • Remove-assocs
          • Assoc
          • Symbol-alistp
          • Rassoc
          • Remove-assoc
          • Remove1-assoc
          • Alist-map-vals
          • Depgraph
            • Toposort
            • Transdeps
            • Invert
              • Invert-outer-loop
              • Invert-inner-loop
              • Mergesort-alist-values
              • Alist-values-are-sets-p
              • Topologically-ordered-p
              • Dependency-chain-p
            • Alist-map-keys
            • Put-assoc
            • Strip-cars
            • Pairlis$
            • Strip-cdrs
            • Sublis
            • Acons
            • Eqlable-alistp
            • Assoc-string-equal
            • Alist-to-doublets
            • Character-alistp
            • String-alistp
            • Alist-keys-subsetp
            • R-symbol-alistp
            • R-eqlable-alistp
            • Pairlis
            • Pairlis-x2
            • Pairlis-x1
            • Delete-assoc
          • Set-register-invariant-risk
          • Strings
          • Program-wrapper
          • Get-internal-time
          • Basics
          • Packages
          • Oracle-eval
          • Defmacro-untouchable
          • <<
          • Primitive
          • Revert-world
          • Unmemoize
          • Set-duplicate-keys-action
          • Symbols
          • Def-list-constructor
          • Easy-simplify-term
          • Defiteration
          • Fake-oracle-eval
          • Defopen
          • Sleep
        • Operational-semantics
        • Real
        • Start-here
        • Debugging
        • Miscellaneous
        • Output-controls
        • Macros
        • Interfacing-tools
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Invert

    Invert-inner-loop

    Add a parent dependency to each of its children.

    Signature
    (invert-inner-loop parent children acc) → acc
    Arguments
    parent — A node in the original graph.
    children — List of nodes that parent depends on, in the original graph.
    acc — New, inverted graph we are building. Fast alist.
    Returns
    acc — Extended by adding parent as a dependency of each child.

    Definitions and Theorems

    Function: invert-inner-loop

    (defun invert-inner-loop (parent children acc)
      (declare (xargs :guard t))
      (let ((__function__ 'invert-inner-loop))
        (declare (ignorable __function__))
        (b* (((when (atom children)) acc)
             (child1 (car children))
             (curr-parents (cdr (hons-get child1 acc)))
             (new-parents (cons parent curr-parents))
             (acc (hons-acons child1 new-parents acc)))
          (invert-inner-loop parent (cdr children)
                             acc))))

    Theorem: invert-inner-loop-correct

    (defthm invert-inner-loop-correct
     (iff
        (member
             par
             (cdr (hons-assoc-equal
                       child
                       (invert-inner-loop parent children orig-alist))))
        (or (member par
                    (cdr (hons-assoc-equal child orig-alist)))
            (and (equal par parent)
                 (member child children)))))