Solving Combinatorial Counting Problems with Weighted First-Order Model Counting
Pith reviewed 2026-06-30 11:39 UTC · model grok-4.3
The pith
Cofola reduces combinatorial counting problems to weighted first-order model counting through a three-phase compilation pipeline that preserves symmetry.
A machine-rendered reading of the paper's core claim, the machinery that carries it, and where it could break.
Core claim
Cofola maps combinatorial objects and constraints to WFOMC instances via preprocessing, decomposition, and symmetry-preserving encoding that groups indistinguishable entities, breaks unordered groupings lexicographically, and encodes sequences and circles with order axioms, thereby keeping the instances inside domain-liftable fragments and enabling practical end-to-end solving of problems ranging from textbook enumerations to multi-object scenarios.
What carries the argument
The three-phase compilation pipeline (preprocessing, decomposition, symmetry-preserving encoding) that reduces a Cofola program to a WFOMC instance augmented with coefficient-extraction constraints.
If this is right
- Textbook combinatorial problems receive concise declarative specifications instead of manual closed-form derivations.
- Multi-object counting scenarios that prior frameworks cannot express become uniformly solvable.
- The same pipeline handles sets, multisets, permutations, partitions and compositions under structural and arithmetic constraints.
- Exchangeability is retained during encoding rather than destroyed by propositional flattening.
- Solving reduces to coefficient extraction from the WFOMC output.
Where Pith is reading between the lines
- The same language could serve as a front-end for probabilistic programming systems that already rely on lifted counting.
- Extending the primitives to graphs or hypergraphs would test whether the symmetry techniques generalize beyond linear and circular orders.
- Automated verification that a given Cofola program stays inside a domain-liftable fragment would remove the main practical uncertainty.
- Integration with existing constraint solvers could handle the arithmetic constraints that fall outside pure counting.
Load-bearing premise
The symmetry-preserving encoding, grouping of indistinguishable entities, and order axioms for sequences and circles keep the compiled WFOMC instances inside known domain-liftable fragments.
What would settle it
A counting problem whose Cofola encoding produces a WFOMC instance that falls outside all known domain-liftable fragments and cannot be solved by existing lifted inference algorithms.
Figures
read the original abstract
Combinatorial counting problems pervade artificial intelligence, statistics, and discrete mathematics. Whether the task is enumerating subsets, multisets, permutations, partitions, or compositions under structural and arithmetic constraints, solving it remains a stubbornly manual exercise. Closed-form derivations are powerful but brittle, while naive encodings to propositional model counting or constraint satisfaction destroy the exchangeability that makes counting tractable in the first place. We present Cofola (COmbinatorial counting LAnguage with First-Order logic), a typed declarative language whose primitives are the combinatorial objects that recur in everyday counting questions, including sets, bags, tuples, sequences, circles, partitions, and compositions, together with natural relational and arithmetic constraints over them. A denotational semantics maps every Cofola program to a well-defined combinatorial counting problem, and a three-phase compilation pipeline (preprocessing, decomposition, and symmetry-preserving encoding) reduces this problem to a weighted first-order model counting (WFOMC) instance augmented with coefficient-extraction constraints. To stay inside known domain-liftable fragments whenever possible, the encoding groups indistinguishable entities, breaks the symmetry of unordered groupings lexicographically, and encodes sequences and circles via order axioms. On a suite of representative combinatorial counting problems, ranging from textbook math problems to multi-object scenarios that the closest prior framework cannot express, Cofola produces concise specifications and a uniform solving pipeline that is practical end-to-end.
Editorial analysis
A structured set of objections, weighed in public.
Referee Report
Summary. The paper introduces Cofola, a typed declarative language whose primitives include sets, bags, tuples, sequences, circles, partitions and compositions together with relational and arithmetic constraints. A denotational semantics maps Cofola programs to combinatorial counting problems, which are then reduced via a three-phase pipeline (preprocessing, decomposition, symmetry-preserving encoding) to WFOMC instances augmented with coefficient-extraction constraints. The encoding groups indistinguishable entities, applies lexicographic symmetry breaking on unordered groupings, and encodes sequences/circles via order axioms in an attempt to remain inside known domain-liftable fragments. Experiments on textbook problems and multi-object scenarios unreachable by prior frameworks are reported to show concise specifications and practical end-to-end solving.
Significance. If the symmetry-preserving encoding demonstrably keeps the compiled WFOMC instances inside domain-liftable fragments for the evaluated problems, the work supplies a uniform, declarative interface that re-uses existing WFOMC machinery for a broad class of counting tasks previously handled by ad-hoc closed forms or symmetry-destroying encodings. The explicit handling of exchangeability via grouping and order axioms is a concrete strength that could be reusable beyond the reported suite.
major comments (2)
- [§4.3] §4.3 (Symmetry-preserving encoding): the claim that lexicographic symmetry breaking on unordered groupings together with order axioms for sequences and circles keeps the resulting WFOMC formula inside a domain-liftable fragment is stated without reference to the precise syntactic restrictions (e.g., the no-function-symbol or quantifier-pattern conditions from the cited WFOMC literature) that are preserved. Because the central efficiency guarantee rests on this property for the multi-object benchmarks, an explicit preservation argument or counter-example check is required.
- [Table 2] Table 2 (runtime results on multi-object problems): the reported solving times are given without the corresponding WFOMC instance sizes or a verification step confirming that the compiled formulas satisfy the domain-liftability criteria used by the underlying solver. If any instance falls outside those fragments, the uniform-pipeline claim for the full suite does not hold.
minor comments (2)
- [abstract / §3] The term 'coefficient-extraction constraints' is used in the abstract and §3 but first defined only in §4.2; a one-sentence gloss in the introduction would improve readability.
- [Definition 3.1] Notation for the denotational semantics mapping (Definition 3.1) uses an overloaded [[·]] symbol that is also used for the WFOMC reduction; a distinct symbol or explicit disambiguation would reduce confusion.
Simulated Author's Rebuttal
We thank the referee for the careful review and positive assessment of the work's significance. We address the two major comments point by point below.
read point-by-point responses
-
Referee: [§4.3] §4.3 (Symmetry-preserving encoding): the claim that lexicographic symmetry breaking on unordered groupings together with order axioms for sequences and circles keeps the resulting WFOMC formula inside a domain-liftable fragment is stated without reference to the precise syntactic restrictions (e.g., the no-function-symbol or quantifier-pattern conditions from the cited WFOMC literature) that are preserved. Because the central efficiency guarantee rests on this property for the multi-object benchmarks, an explicit preservation argument or counter-example check is required.
Authors: We agree that the current text in §4.3 only states an intent to remain inside domain-liftable fragments without an explicit mapping to the syntactic restrictions (no function symbols, quantifier patterns, etc.) from the cited WFOMC literature. In the revised manuscript we will add a dedicated subsection that (i) recalls the precise conditions from the relevant theorems, (ii) shows step-by-step how the grouping of indistinguishable entities, lexicographic symmetry breaking, and order axioms for sequences/circles preserve those conditions, and (iii) verifies the property for each multi-object benchmark instance. revision: yes
-
Referee: [Table 2] Table 2 (runtime results on multi-object problems): the reported solving times are given without the corresponding WFOMC instance sizes or a verification step confirming that the compiled formulas satisfy the domain-liftability criteria used by the underlying solver. If any instance falls outside those fragments, the uniform-pipeline claim for the full suite does not hold.
Authors: We accept that the absence of instance sizes and an explicit liftability verification weakens the experimental support for the uniform-pipeline claim. In the revision we will extend Table 2 with a column reporting the number of predicates, constants, and clauses in each compiled WFOMC instance, and we will add a short verification paragraph (or appendix entry) confirming that every instance satisfies the domain-liftability criteria used by the solver, based on the syntactic preservation argument added to §4.3. revision: yes
Circularity Check
No circularity: compilation pipeline reduces to external WFOMC without self-referential fitting or load-bearing self-citation
full rationale
The paper defines Cofola as a declarative language whose semantics map to combinatorial counting problems, then describes a three-phase pipeline that reduces them to WFOMC instances while using grouping, lexicographic symmetry breaking, and order axioms to remain in domain-liftable fragments. No step equates a derived quantity to its own input by construction, renames a fitted parameter as a prediction, or relies on a uniqueness theorem or ansatz imported solely via self-citation. The central claim (practical end-to-end solving on the evaluated suite) rests on the syntactic restrictions of the encoding and the known properties of WFOMC, which are treated as external. This is the normal case of a reduction to an independent solver technology.
Axiom & Free-Parameter Ledger
axioms (2)
- domain assumption Existence of domain-liftable fragments of weighted first-order model counting that admit efficient inference
- standard math Standard denotational semantics for first-order logic can be extended to combinatorial objects without introducing inconsistencies
invented entities (1)
-
Cofola language
no independent evidence
Reference graph
Works this paper leans on
-
[1]
Qutip 5: The quantum toolbox in Python,
¨Ozg¨ur Akg ¨un, Alan M. Frisch, Ian P. Gent, Bilal Syed Hussain, Christopher Jefferson, Lars Kotthoff, Ian Miguel, and Peter Nightingale. Conjure: Automatic generation of constraint models from problem specifications.Artificial Intelligence, 310:103751, 2022. doi: 10.1016/j. artint.2022.103751
work page doi:10.1016/j 2022
-
[2]
Symmetric Weighted First-Order Model Counting
Paul Beame, Guy Van den Broeck, Eric Gribkoff, and Dan Suciu. Symmetric Weighted First-Order Model Counting. InProceedings of the 34th ACM SIGMOD-SIGACT-SIGAI Symposium on Principles of Database Systems, volume 31 ofSIGMOD/PODS’15, pages 313–328, Melbourne Victoria Australia, May 2015. ACM. ISBN 978-1-4503-2757-2. doi: 10.1145/2745754.2745760
-
[3]
First-order probabilistic inference
David Poole 0001. First-order probabilistic inference. InIJCAI-03, Proceedings of the Eighteenth International Joint Conference on Artificial Intelligence, Acapulco, Mexico, August 9-15, 2003, IJCAI 2003, pages 985–991. Morgan Kaufmann, 2003. 35
2003
-
[4]
ProbLog: A Probabilistic Prolog and Its Application in Link Discovery
Luc De Raedt, Angelika Kimmig, and Hannu Toivonen. ProbLog: A Probabilistic Prolog and Its Application in Link Discovery. InIJCAI 2007, Proceedings of the 20th International Joint Conference on Artificial Intelligence, Hyderabad, India, January 6-12, 2007, volume 7 of IJCAI 2007, pages 2462–2467. Hyderabad, 2007
2007
-
[5]
Solving Probability Problems in Natural Language
Anton Dries, Angelika Kimmig, Jesse Davis, Vaishak Belle, and Luc de Raedt. Solving Probability Problems in Natural Language. InPro- ceedings of the Twenty-Sixth International Joint Conference on Artificial Intelligence, IJCAI-2017, pages 3981–3987, Melbourne, Australia, August 2017. International Joint Conferences on Artificial Intelligence Organization....
-
[6]
Essence: A constraint language for specifying combinatorial problems.Constraints : an international journal, 13:268–306, 2008
Alan M Frisch, Warwick Harvey, Chris Jefferson, Bernadette Mart ´ınez-Hern´andez, and Ian Miguel. Essence: A constraint language for specifying combinatorial problems.Constraints : an international journal, 13:268–306, 2008
2008
-
[7]
Springer Nature, 2022
Martin Gebser, Roland Kaminski, Benjamin Kaufmann, and Torsten Schaub.Answer Set Solving in Practice. Springer Nature, 2022
2022
-
[8]
Gent, Christopher Jefferson, and Ian Miguel
Ian P. Gent, Christopher Jefferson, and Ian Miguel. Minion: A fast, scalable, constraint solver. InProceedings of the 17th European Conference on Artificial Intelligence, pages 98–102. IOS Press, 2006
2006
-
[9]
On the Completeness of First-Order Knowledge Compilation for Lifted Probabilistic Inference
Guy Van den Broeck. On the Completeness of First-Order Knowledge Compilation for Lifted Probabilistic Inference. InAdvances in Neural Information Processing Systems 24: 25th Annual Conference on Neural Information Processing Systems 2011. Proceedings of a Meeting Held 12-14 December 2011, Granada, Spain., volume 24 ofNIPS 2011, pages 1386–1394. Curran Ass...
2011
-
[10]
Measuring mathematical problem solving with the MATH dataset.NeurIPS Datasets and Benchmarks, 2021
Dan Hendrycks, Collin Burns, Saurav Kadavath, Akul Arora, Steven Basart, Eric Tang, Dawn Song, and Jacob Steinhardt. Measuring mathematical problem solving with the MATH dataset.NeurIPS Datasets and Benchmarks, 2021
2021
-
[11]
New liftable classes for first-order probabilistic inference
Seyed Mehran Kazemi, Angelika Kimmig, Guy Van den Broeck, and David Poole. New liftable classes for first-order probabilistic inference. Advances in Neural Information Processing Systems, 29, 2016
2016
-
[12]
Algebraic model counting.Journal of Applied Logic, 22:46–62, July 2017
Angelika Kimmig, Guy Van den Broeck, and Luc De Raedt. Algebraic model counting.Journal of Applied Logic, 22:46–62, July 2017. ISSN 15708683. doi: 10.1016/j.jal.2016.11.031
-
[13]
Bridging Weighted First Order Model Counting and Graph Polynomials, July 2024
Qipeng Kuang, Ond ˇrej Kuˇzelka, Yuanhong Wang, and Yuyi Wang. Bridging Weighted First Order Model Counting and Graph Polynomials, July 2024
2024
-
[14]
Qipeng Kuang, V ´aclav K˚ula, Ondˇrej Kuˇzelka, Yuanhong Wang, and Yuyi Wang. Weighted first order model counting for two-variable logic with axioms on two relations.arXiv preprint arXiv:2508.11515, 2025
-
[15]
Weighted model counting beyond two-variable logic
Antti Kuusisto and Carsten Lutz. Weighted model counting beyond two-variable logic. InProceedings of the 33rd Annual ACM/IEEE Symposium on Logic in Computer Science, LICS ’18, pages 619–628, Oxford United Kingdom, July 2018. ACM. ISBN 978-1-4503-5583-4. doi: 10.1145/3209108.3209168
-
[16]
A Complexity Upper Bound for Some Weighted First-Order Model Counting Problems With Counting Quantifiers
Ondrˇej Kuzˇelka. A Complexity Upper Bound for Some Weighted First-Order Model Counting Problems With Counting Quantifiers
-
[17]
Ondrej Kuzelka. Weighted First-Order Model Counting in the Two-Variable Fragment With Counting Quantifiers.Journal of Artificial Intelligence Research, 70:1281–1307, 2021. ISSN 10769757. doi: 10.1613/jair.1.12320
-
[18]
Counting and Sampling Models in First-Order Logic
Ond ˇrej Kuˇzelka. Counting and Sampling Models in First-Order Logic. InProceedings of the Thirty-Second International Joint Conference on Artificial Intelligence, IJCAI-2023, pages 7020–7025, Macau, SAR China, August 2023. International Joint Conferences on Artificial Intelligence Organization. ISBN 978-1-956792-03-4. doi: 10.24963/ijcai.2023/801
-
[19]
Lifted Inference beyond First-Order Logic, August 2023
Sagar Malhotra, Davide Bizzaro, and Luciano Serafini. Lifted Inference beyond First-Order Logic, August 2023
2023
-
[20]
The design of the Zinc modelling language.Constraints : an international journal, 13:229–267, 2008
Kim Marriott, Nicholas Nethercote, Reza Rafeh, Peter J Stuckey, Maria Garcia De La Banda, and Mark Wallace. The design of the Zinc modelling language.Constraints : an international journal, 13:229–267, 2008
2008
-
[21]
A more practical algorithm for weighted first-order model counting with linear order axiom
Qiaolan Meng, Jan T ´oth, Yuanhong Wang, Yuyi Wang, and Ond ˇrej Ku ˇzelka. A more practical algorithm for weighted first-order model counting with linear order axiom. In Ulle Endriss, Francisco S. Melo, Kerstin Bach, Alberto Bugar ´ın-Diz, Jos´e M. Alonso-Moral, Sen ´en Barro, and Fredrik Heintz, editors,Frontiers in Artificial Intelligence and Applicati...
2024
-
[22]
MiniZinc: Towards a standard CP modelling language
Nicholas Nethercote, Peter J Stuckey, Ralph Becket, Sebastian Brand, Gregory J Duck, and Guido Tack. MiniZinc: Towards a standard CP modelling language. InInternational Conference on Principles and Practice of Constraint Programming, pages 529–543. Springer, February 2023
2023
-
[23]
Shubham Sharma, Subhajit Roy, Mate Soos, and Kuldeep S. Meel. GANAK: A scalable probabilistic exact model counter. InProceedings of the Twenty-Eighth International Joint Conference on Artificial Intelligence, pages 1169–1176. International Joint Conferences on Artificial Intelligence Organization, 2019. doi: 10.24963/ijcai.2019/162
-
[24]
sharpSAT–counting models with advanced component caching and implicit BCP
Marc Thurley. sharpSAT–counting models with advanced component caching and implicit BCP. InInternational Conference on Theory and Applications of Satisfiability Testing, pages 424–429. Springer, 2006
2006
-
[25]
Faster lifting for two-variable logic using cell graphs
Timothy van Bremen and Ondrej Kuzelka. Faster lifting for two-variable logic using cell graphs. InProceedings of the Thirty-Seventh Conference on Uncertainty in Artificial Intelligence, UAI 2021, Virtual Event, 27-30 July 2021, UAI 2021, pages 1393–1402, 2021
2021
-
[26]
Jan T ´oth and Ondˇrej Kuˇzelka. Lifted Inference with Linear Order Axiom.Proceedings of the AAAI Conference on Artificial Intelligence, 37 (10):12295–12304, 2022. doi: 10.1609/aaai.v37i10.26449
-
[27]
Pietro Totis, Jesse Davis, Luc De Raedt, and Angelika Kimmig. Lifted Reasoning for Combinatorial Counting.Journal of Artificial Intelli- gence Research, 76:1–58, January 2023. ISSN 1076-9757. doi: 10.1613/jair.1.14062
-
[28]
Leslie G. Valiant. The Complexity of Enumeration and Reliability Problems.SIAM Journal on Computing, 8(3):410–421, August 1979. ISSN 0097-5397, 1095-7111. doi: 10.1137/0208032
-
[29]
Lifted Inference with Tree Axioms
Timothy van Bremen and Ond ˇrej Kuˇzelka. Lifted Inference with Tree Axioms. InProceedings of the Eighteenth International Conference on Principles of Knowledge Representation and Reasoning, KR-2021, pages 599–608, Hanoii, Vietnam, September 2021. International Joint Conferences on Artificial Intelligence Organization. doi: 10.24963/kr.2021/57
-
[30]
Lifted inference with tree axioms.Artificial Intelligence, 324:103997, 2023
Timothy van Bremen and Ond ˇrej Kuˇzelka. Lifted inference with tree axioms.Artificial Intelligence, 324:103997, 2023. ISSN 0004-3702. doi: 10.1016/j.artint.2023.103997
-
[31]
Guy Van den Broeck and Jesse Davis. Conditioning in First-Order Knowledge Compilation and Lifted Probabilistic Inference.Proceedings of the AAAI Conference on Artificial Intelligence, 26(1):1961–1967, 2012. doi: 10.1609/aaai.v26i1.8404
-
[32]
Lifted Probabilistic Inference by First-Order Knowl- edge Compilation
Guy Van Den Broeck, Nima Taghipour, Wannes Meert, Jesse Davis, and Luc De Raedt. Lifted Probabilistic Inference by First-Order Knowl- edge Compilation. InIJCAI 2011, Proceedings of the 22nd International Joint Conference on Artificial Intelligence, Barcelona, Catalonia, 36 Spain, July 16-22, 2011, volume 29 ofIJCAI 2011, pages 2178–2185, 2011. ISBN 978-1-...
-
[33]
Guy Van den Broeck, Kristian Kersting, Sriraam Natarajan, and David Poole.An Introduction to Lifted Probabilistic Inference. The MIT Press, August 2021. ISBN 978-0-262-36559-8. doi: 10.7551/mitpress/10548.001.0001
-
[34]
Yuanhong Wang, Juhua Pu, Yuyi Wang, and Ondˇrej Kuˇzelka. Lifted algorithms for symmetric weighted first-order model sampling.Artificial Intelligence, 331:104114, June 2024. ISSN 00043702. doi: 10.1016/j.artint.2024.104114
-
[35]
Faster lifting for ordered domains with predecessor relations, 2025
Kuncheng Zou, Jiahao Mai, Yonggang Zhang, Yuyi Wang, Ond ˇrej Ku ˇzelka, Yuanhong Wang, and Yi Chang. Faster lifting for ordered domains with predecessor relations, 2025. 37 Appendix A. The Formal Semantics of Cofola Appendix A.1. Combinatorics Notations Table A.12 consolidates all combinatorial notations used in the paper. For a setS, thepower setis2 S ;...
2025
discussion (0)
Sign in with ORCID, Apple, or X to comment. Anyone can read and Pith papers without signing in.