Documentation

Docs / Related work

Scallop

What it is

Scallop is a language for neurosymbolic programming from the University of Pennsylvania (Li, Huang, Naik, PLDI 2023). It is Datalog with recursion, negation and aggregation, where every fact carries a tag, and tags are combined by a provenance semiring. The same program can then compute plain truth, probabilities, top-k proofs or gradients, depending on which semiring is chosen. It is written in Rust with Python bindings for PyTorch.

Model

  • Entities: typed relations, as in Datalog.
  • Rule forms: Datalog rules with stratified negation and aggregation; facts can have probabilities (0.9::fact).
  • Combining: the semiring decides. "Or" between derivations is semiring addition, "and" within a derivation is semiring multiplication. Examples: Boolean (plain Datalog), max-min (fuzzy), add-mult probability, top-k proofs (keep the k most likely proofs and compute their probability exactly), differentiable versions of these.
  • Default: closed world.

Formal semantics and what is proved

  • Fixed-point semantics parameterised by the provenance semiring (extending Green, Karvounarakis and Tannen 2007). The PLDI paper gives the formal semantics and the conditions under which evaluation terminates.
  • Top-k proofs gives a controllable approximation of exact probabilistic inference. On the paper's benchmarks it scales much better than DeepProbLog with similar accuracy.
  • No mechanized proofs.

Purpose and use case

Not built in.

Uncertainty

Yes, through the choice of semiring. Model readings can enter as tagged facts.

History and state

None.

What we can reuse

  • One rule program, several meanings. We can run the same rules with the Boolean semiring for the certain decision and with a probability semiring for the uncertain one, and prove that the Boolean result is the "support" of the probabilistic one.
  • Top-k proofs as both the probability and the explanation: the few derivations that made the decision.
  • A ready engine for step 6 of the plan.

What it lacks for us

  • Not a policy language: no algebra of effects, no forms, no boundaries.
  • Non-monotone operations (negation, aggregation) interact with probability in ways that need care; the semantics of negation over uncertain facts must be stated per semiring.
  • No history.

Key references

  • Li, Huang, Naik, "Scallop: A Language for Neurosymbolic Programming", PLDI 2023 (PACMPL 7). https://doi.org/10.1145/3591280 ; preprint https://arxiv.org/abs/2304.04812
  • Scallop website and documentation. https://www.scallop-lang.org/

Last built 2026-11-25