design

Status: accepted (2026-10-24, Daniel: “keep both methods”; proposed 2026-10-23 on review-argon). Related: Messages are Inversions §5, lens, passing, gaussian §4, L-SPEC-001 The Factor Interface §2, §5.

Context

In AutoBayes (Definition 10), the Bayesian inversion of a lens returns the posterior belief over the unobserved channel given the prior and observation : . In belief propagation on a factor graph, however, the factor-to-variable message must be the likelihood contribution (with the cavity prior divided out, using at most as an expansion point for linearisation or Laplace approximation); otherwise a variable of degree counts its prior times.

Previously, Mycelium.factor_message’s generic fallback called LenticulumCore.invert(lens, prior, inputs, ps, st), while individual factors (ImplicitLayers, AdversarialFactors, VariationalDiffusion) returned likelihoods from invert and Lenticulum’s GaussianFactor returned posteriors from invert and bypassed invert in factor_message.

Options

  1. Have invert return the likelihood message everywhere, departing from AutoBayes Definition 10.
  2. Have invert return the posterior everywhere and divide out the prior in Mycelium.factor_message via a belief division operation.
  3. Add LenticulumCore.likelihood_message(lens, π, inputs, ps, st) -> (belief, st) for the cavity-free BP likelihood message (defaulting to invert(lens, π, inputs, ps, st) for lenses whose invert already returns a likelihood or point estimate), define invert on Gaussian/Laplace factors as combine(π, likelihood_message(...)), and have Mycelium.factor_message call likelihood_message.

Decision

Option 3. Belief division is ill-defined when the prior or message is improper or non-Gaussian (SampleBelief, DiracBelief), whereas forward multiplication (Mycelium.combine(π, msg)) is always well-defined. Separating likelihood_message (BP factor-to-variable likelihood) from invert (AutoBayes posterior) allows both contracts to hold without division or double-counting.

Consequences

  • LenticulumCore.invert(lens, π, inputs, ps, st) returns the posterior on GaussianFactor, LinearConstraintFactor, NonlinearFactor, and LikelihoodFactor.
  • LenticulumCore.likelihood_message(lens, π, inputs, ps, st) returns the likelihood message , using only where needed as an expansion point (NonlinearFactor, LikelihoodFactor, DiffusionFactor).
  • Mycelium.factor_message’s generic fallback calls LenticulumCore.likelihood_message(lens, prior, inputs, ps, st).