Algebra โ€” Semiring implementations

This library defines the semiring abstraction used throughout SWAL and provides all concrete implementations.

Core interface

Algebra.Semiring defines Algebra.Semiring.T, the module type every semiring must satisfy. It bundles the carrier type, the semiring operations (โŠ• and โŠ—) with their identities, and the SMT sub-module that lifts those operations into Smtml expressions. Every functor in the Encoding and Learner libraries is parameterized over a value of type (module Algebra.Semiring.T).

Semiring modules

How to add a new semiring

Implement Algebra.Semiring.T (in particular its SMT sub-module) and add a get function following the pattern of Algebra.Nat or Algebra.Tropical_lia. Register the new semiring in Lang.Lang by adding a variant to Lang.t and a case in Lang.get.