packages feed

lazyppl-singlesite-0.2.0: ChangeLog.md

# Changelog for lazyppl-singlesite

## 0.2.0

- Site discovery follows blackholes and indirections and inspects evaluated
  tree constructors, boxed `Double` labels and list cells. A `Double` label is
  decoded from its machine words with `castWord64ToDouble` on a 64-bit platform.
- A module compiled with both `-fno-cse` and `-fno-full-laziness` can be
  miscompiled by GHC (see GHC issue #27886); add `-fno-float-in` to such a
  module. The tests also pass for a client built with plain `-O2`. Tested on
  Linux x86_64 with GHC 9.6.7, 9.12.4 and 9.14.1 and `lazyppl-1.1.0.1`.
- The guided kernel's invariance argument assumes ideal independent prior
  draws and reproducible evaluation. Finite 52-bit midpoint acceptance labels
  and rounded logarithms mean that argument does not establish exact
  machine-level invariance.
- Matrix checks compare assessed probabilities with rational references;
  separate frequency checks sample transitions from the actual random source.
- `mkSiteLaw` derives its draw from the supplied masses; `mkSiteLawUnchecked`
  accepts an explicitly supplied draw. `Completion` includes terminal `Failed`,
  reported through `InitialFailed` or `TransitionFailed`. Permanent callback
  errors use `CallbackFailed`, distinct from retryable `CallbackInterrupted`.
- Selectors return `KernelError` values directly, including `InvalidSiteLaw`
  for an empty uniform site law. A returned `Failed` is permanent; a thrown
  synchronous exception suspends, and an explicit resume calls the selector
  again. Callers must stop resuming a deterministic exception.
- A synchronous failure while drawing a site or its proposal and acceptance
  labels suspends the transition and retains the current chain for resumption.
- Add explicit completed evaluators, deterministic site-selection laws and
  transition records in `LazyPPL.SingleSite.Hooks`.
- Refactor the existing local transition driver so legacy `mhStep` and the
  completed path share source selection, proposal and decision sequencing.
- Complete each pass on a fresh heap of the same logical source, and discover
  sites only on the successful heap. Mutation recipes retain their source
  generators so earlier forced labels are not inserted into the new heap.
- A typed interruption retains the accepted snapshot and exact pending attempt.
  Resuming completes that attempt before a proposal generator can advance.
- A completed rejection retains the actual accepted snapshot. State-dependent
  guides are reassessed at the candidate, including zero reverse support.
- Add a fixed-probability whole-prior-tree `RefreshAll` component for coordinates
  excluded by a local site guide.
- Existing `mh1` keeps its API, arithmetic and source order. The new hooks qualify finite forceable outputs
  of referentially stable programs; they do not repair hidden mutable core values.
- Depends on `lazyppl ==1.1.*`, as before.

## 0.1.0

- The single-site Metropolis-Hastings sampler `mh1` was part of `lazyppl` 1.0.1. From `lazyppl` 1.1.0 it is in this package, so that `lazyppl` no longer depends on `ghc-heap`.
- Import `LazyPPL.SingleSite` as before and depend on `lazyppl-singlesite`, which works with `lazyppl ==1.1.*`.
- `lazyppl-singlesite` depends on `ghc-heap >=9.6.1 && <9.15` and is tested with GHC 9.6.7, 9.12.4 and 9.14.1.
- `mh1` changes one random choice per step. It finds the random choices that a model has evaluated by inspecting GHC's heap, so garbage collection can change which ones it finds. A known limit: `mh1` evaluates each result to normal form, so for an infinite result, such as an infinite list, it yields the initial draw and then never yields the next pair. `mh` from `LazyPPL.Inference.Run` has no such limit and is the general recommendation.
- `mh1` rejects a proposal when the reverse site is absent from the proposed tree's evaluated sites. Otherwise, while the current weight is zero, it accepts every proposal.
- `mh1` accepts a move when its uniform draw is below the acceptance ratio. It used to accept on equality, so a uniform draw of 0 accepted a move to weight 0.
- `mh1` draws its proposed labels from the open interval (0,1) and takes its generator from `newStdGen`. It raises an error when a total log weight overflows to positive infinity.