Snarky

All projectsUsable prototype

Combine symbolic inference, finite constraint solving, and optimization in one language.

Rules · Constraints · Factors

Finite domains, rules, propagation and reversible choices; a 3 × 3 magic-square example.

Conceptual view: shared facts and domains, reversible choices, and preferences among solutions.

Overview

Snarky is a language and Python system for symbolic reasoning, constraint solving, and optimization. It revisits a line of artificial intelligence in which knowledge is expressed through explicit rules and constraints, and extends it with factors for scoring solutions and defining probability measures.

Explore the code and examples · Read the documentation

Rules, constraints, and factors

Rules derive new facts from what is already known. Constraints restrict the combinations of values a solution may take. Factors express preferences or weights, so that the system can compare feasible solutions or work with an explicit probability measure.

Snarky lets these ingredients cooperate. A choice made during constraint solving can trigger a rule; the facts derived by that rule can activate further constraints. Search explores alternatives, with facts and domains restored together when it backtracks.

Historical influences

The project is inspired by Jean-Louis Laurière’s SNARK and Jean-Luc Dormoy’s BOOJUM. Related precedents include Yves Caseau’s LAURE and CLAIRE. Snarky develops its own implementation and language while documenting its relationship to these earlier systems.

Applications and examples

The repository includes examples in finite constraint solving, scheduling, Sudoku, constrained Markov generation, and four-part harmonization. These applications provide concrete settings for investigating how inference, propagation, preferences, and search can work together.

Current status

Read the reference semantics (work in progress). The reference semantics describes facts, inference, persistent constraints, choices and backtracking. This formalization evolves alongside the system.

Snarky is in progress but already usable from source, with documentation, executable examples, and benchmarks. It is a research prototype, and parts of the language and API are still evolving. There is no dedicated published paper on Snarky yet.

GitHub repository · Benchmarks · All projects