• 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
            • 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
  • Alists

Depgraph

A small library for working with dependency graphs.

This is just a small collection of basic graph algorithms for working with dependency graphs.

Graph Representation

We represent dependency graphs as simple ACL2::alists that bind nodes to the lists of nodes they (directly) depend on. For instance, a graph like

A ----->  B ---> C
          |      |
          |      |
          v      |
          D  <---+

Could be represented as:

((A . (B))        ; A only depends on B
 (B . (C D))      ; B depends on C and D
 (C . (D))        ; C only depends on D
 (D . NIL))       ; D depends on nothing

Our algorithms treat graph as an alist, i.e., any "shadowed" entries are ignored.

There are no restrictions on the kinds of nodes that a graph can contain. However, our algorithms are generally based on ACL2::fast-alists, so for good performance:

  • It is helpful for the nodes to be ACL2::normed objects. (This isn't strictly necessary; the nodes will be normed as needed.)
  • It is helpful for graph to be a fast alist. (This isn't strictly necessary; the graph will be made fast if needed.)

Subtopics

Toposort
General-purpose, depth-first topological sort for dependency graphs.
Transdeps
Compute the transitive dependencies for a list of nodes.
Invert
Invert a dependency graph.
Mergesort-alist-values
Sort all of the values bound in an alist.
Alist-values-are-sets-p
Recognizer for alists whose every value is an ordered set.
Topologically-ordered-p
(topologically-ordered-p nodes graph) determines if a list of nodes is topologically ordered with respect to a graph.
Dependency-chain-p
(dependency-chain-p nodes graph) determines if a list of nodes indeed follows a set of dependencies in graph.