Skip to content
Rainbow docs menu

Reference · The Applied Higher-Order Functions catalogue

rainbow.algorithms.proofs.ahof.karger

The Applied Higher-Order Functions cataloguesrc/rainbow/algorithms/proofs/ahof/karger.clj1 definitions, 3 theorems

AHoF Karger's Min-Cut Algorithm (randomized): estimate the minimum cut of an undirected graph -- the fewest edges whose removal disconnects it -- by repeatedly CONTRACTING a uniformly random edge (merging its endpoints, keeping parallel edges) until two supernodes remain; the edges between them form a cut. A single trial finds the true minimum with probability >= 2/(n(n-1)), so running many trials and keeping the smallest result succeeds with high probability. Across trials the best cut is updated by: keep-smaller-cut? candidate current-best = decide (candidate <= current-best) over exact-rational (integer) cut sizes. Proved native and axiom-free: the keep-smaller test; that a smaller candidate cut replaces the current best; the certificate that a kept candidate is at most the previous best (native nnrat/at-most) -- the running minimum only decreases; and that a larger candidate is discarded. The random contraction and trial loop are executable; what is proved is the best-cut update decision. Requires nnrat/at-most, audit/decide-nnrat-at-most, nnrat/decide-at-most-true-sound (all in the D63 checkpoint). Scope (measured by the kernel): this module has 3 worked instances (statements about specific values). None of its theorems is a guarantee about the algorithm for all inputs; `lein verify rainbow.algorithms.proofs.ahof.karger` prints this classification.

karger/keep-smaller-cut?

DefinitionSource, line 60

karger/keep-smaller-cut? :
  (x₁ x₂ : ℚ≥0)
  → data/Bool

ℚ≥0 = nnrat/NonnegativeRational

karger/smaller-cut-kept

TheoremWorked exampleNo axiomsSource, line 71

karger/smaller-cut-kept :
  → ce-is/elite? 2 5 = data/true

= = equality/Eq

karger/kept-cut-at-most-previous

TheoremWorked exampleNo axiomsSource, line 80

karger/kept-cut-at-most-previous :
  → 2 ≤ 5

≤ = nnrat/at-most

karger/larger-cut-discarded

TheoremWorked exampleNo axiomsSource, line 86

karger/larger-cut-discarded :
  → ce-is/elite? 7 5 = data/false

= = equality/Eq