• 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
              • Transdeps-aux
              • Transdeps-direct-for-nodes
              • Transdeps-direct-for-node
              • Transdeps-allnodes
              • Transdeps-free
            • Invert
            • 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
  • Depgraph

Transdeps

Compute the transitive dependencies for a list of nodes.

Signature
(transdeps nodes graph) → deps
Arguments
nodes — The list of nodes to compute dependencies for.
graph — Alist that binds nodes to the lists of nodes they (directly) depend on. See below.
Returns
deps — The ordered set of nodes that nodes depend on. Always includes nodes themselves.
    Type (true-listp deps).

We implement a general-purpose, transitive closure operation for dependency graph reachability. We determine all nodes in the graph that are reachable from the starting nodes.

After calling this function you may wish to use transdeps-free to clear out the relevant memo tables.

Definitions and Theorems

Function: transdeps

(defun transdeps (nodes graph)
  (declare (xargs :guard t))
  (let ((__function__ 'transdeps))
    (declare (ignorable __function__))
    (let ((orig (mergesort nodes)))
      (with-fast-alist graph
                       (transdeps-aux orig nil orig graph)))))

Theorem: true-listp-of-transdeps

(defthm true-listp-of-transdeps
  (b* ((deps (transdeps nodes graph)))
    (true-listp deps))
  :rule-classes :rewrite)

Theorem: setp-of-transdeps

(defthm setp-of-transdeps
  (b* ((deps (transdeps nodes graph)))
    (setp deps))
  :rule-classes :rewrite)

Theorem: transdeps-subset

(defthm transdeps-subset
  (subset (transdeps nodes graph)
          (union (mergesort nodes)
                 (transdeps-allnodes graph))))

Subtopics

Transdeps-aux
Main algorithm for collecting transitive dependencies.
Transdeps-direct-for-nodes
Get the set of direct dependencies for a set of nodes.
Transdeps-direct-for-node
Memoized. Get the set of dependencies for a single node.
Transdeps-allnodes
Overapproximation of all of the nodes in the graph.
Transdeps-free
Free memo tables associated with transdeps.