CountingLib v0.1.1 preview

COUNTING COMPLEXITY IN LEAN

Counting complexity in Lean

CountingLib brings finite counting, weighted partition models, algorithms, and classification results into one reusable Lean 4 library.

Start with a small interface

Use a focused import for a definition or algorithm. Add a flagship module when you need a classification theorem. The Lean package is named countingComplexity; its public namespace is Counting.

import Counting.Foundation.Witness

open Counting.Foundation

example : countAccepted (fun b : Bool => decide (b = true)) = 1 :=
  countAccepted_singleton true

Four flagship directions

The library is anchored in full research results. Public entry points retain their original hypotheses, exact representations, and reduction models.

DirectionPublic importScope
HolantCounting.Flagships.HolantFull Boolean dichotomy and binary-disequality variants
Complex-weighted CSPCounting.Flagships.ComplexCSPStructural collapse, effective recognition, and fixed-language classification
Planar homomorphismsCounting.Flagships.PlanarHomNonnegative symmetric algebraic interactions on planar multigraphs
Matchgate widthCounting.Flagships.MatchgateWidthQutrit structure, exact realizations, and width obstructions

How the library fits together

Shared definitions have one source provider. Bridges prove compatibility between representations; machine contracts remain separate from semantic identities.

LayerResponsibilityEntry points
FoundationsFinite counts, witnesses, encodings, and reductionsCounting
Weighted modelsOrdered occurrences, open partitions, and gadgetsCounting.Model.Basic; Counting.Gadget.Composition
AlgorithmsEvaluators, correctness, and explicitly scoped cost boundsCounting.Algorithms
Reusable bridgesModel translation, resource elimination, and complexity transportCounting.Reuse
ClassificationFixed research endpoints and their precise contractsCounting.Flagships.*

About this reference

The searchable API presents 333 selected declarations from 80 provider modules, organized into 30 contract families. It is an entry point to the library rather than an inventory of every internal declaration. Signatures come from recorded Lean environment exports; complete explicit types remain available alongside readable views.

This is a local design preview for v0.1.1. Source links identify the existing 6ca34e1 snapshot. The published release remains v0.1.0.