Repository navigation
v0.11.0
Added
- Homogenized DSL surface. Every declaration follows the unified
KIND NAME : SIGNATURE [k = v, ...] [~ INIT] [BODY]skeleton:morphism,object,composition,program,deduction,signature,encoder,decoder,loss,category,bundle,schema,rule,let,export. Per-role morphism keywords (latent,kernel,observed,embed,discretize) collapse intomorphism X : ... [role=ROLE]. Brace-bodied declarations (algebra X { ... },deduction X : ... { ... },signature X { sorts { ... } },marginalize ... in { ... },atoms { ... },lexicon { ... }) become indented bodies under the unified header. Effect signatures live in the option block as[effects = [Sample, Score, Marginal, Pure]]rather than! E1, E2, .... Observation fibrations are[via = idx]and grouping plates are[over = G, reduction = R]in the option block instead of keyword clauses. Morphism replication is[replicate = N]. The pragma surface is#[k = v, ...](outer, decorates the next declaration) and#; per-line rule and lexicon pragmas (#[learnable],#[bounded],parent = ...) replace the legacy@ learnablemarker. composition NAME as <level>keyword. A single surface for algebraic composition rules (algebra / semigroupoid / bilinear_form / rule), with either a registry lookup (composition product_fuzzy as algebra) or an indented inline body (composition my_godel as algebrafollowed bytensor_op(a, b) = ...).ContinuousSpacefamily registry. Eleven continuous-space constructors (Real,Simplex,PositiveReals,UnitInterval,Sphere,Ball,Covariance,Correlation,CholeskyFactor,Orthogonal,Stiefel,LowerTriangular,Diagonal) ship asContinuousSpacesubclasses dispatched by the homogenizedDiscreteConstructor/ContinuousConstructorAST nodes. Discrete and continuous space initialisers share the sameobject X : <init>surface.quivers.inference.liftsmodule. Four general-purpose Bayesian-lift helpers:bayesian_lift_parameterslifts every learnablenn.Parameterinto a Normal-prior sample site, returning aMonadicProgramthat SVI and NUTS consume uniformly. The newadditional_latentsargument lifts intermediate program latents as joint NUTS variables via an exact placeholder-cancellation construction; the lifted log-density equalslog p(theta) + log p_inner(z, y | x, theta)pointwise, with no Monte-Carlo noise across leapfrog steps. The module docstring includes a methodological-notes section justifying the Normal-prior choice (maximum entropy on R^n; equivalence to L2 regularization; computational fit with NUTS) and the placeholder-cancellation theorem with proof.lift_to_bayesian_programlifts a parameter-only morphism plus anytorch.distributions.Distributionobservation family into a Bayesian program, with a user-suppliedlocation_fnso the same lift works forrsample(x)-style,tensor-attribute, andprog(x)-forward shapes.lift_from_log_problifts a parameter-only model whose forward is already alog_prob(x, y)function (the VAE / encoder-decoder pattern).monte_carlo_log_jointwraps a program so itslog_jointMC-draws named intermediatesamplesites and returns the conditional data likelihood, with the prior-cancellation correction applied automatically. Documented honestly as a single-sample MC estimator valid for SVI as a stochastic gradient estimator; the function's docstring notes that for rigorous NUTS the joint lift viaadditional_latentsis the correct route.
quivers.stochastic.deductionpackage. Reorganised the deduction-system surface from the previous flatquivers.deduction_fitmodule into a coherent package with one canonical import path. Subpackages:primitives(the abstractAxiom,Deduction,Goal,Schedule,DeductiveSystembuilding blocks),fit(point-estimate gradient fitting viaadam_fit_deduction),bayes(posterior wrapping vianuts_program_from_deduction),sample(exact length-conditional forward sampling viasample_corpus). The model typeDeductionSystemis re-exported from the package root alongside the operations andbayesian_lift_parameters(re-exported fromquivers.inference.lifts).ScanMorphism.log_jointaccepts a dict signature. The recurrent-cell scan morphism'slog_jointnow accepts the hidden-state trajectory either positionally as a tensor or via a{state_key: tensor}dict (defaultstate_key = "h"), so the standard inference contractlog_joint(x, observations: dict)works without an adapter at the call site.qvr migratesubcommand. Forward-migrates user.qvrsource files across the QVR grammar release chain (v0.2.0 through HEAD). The CLI composes the adjacent-pair hop migrators inquivers.cli.migrationsautomatically;--from VERand--to VERpin the boundary,--dry-runreports without writing,--output DIRwrites migrated copies.--checkmode validates the migration chain against the panproto VCS schema diff and reports any rule removed in an adjacent grammar revision that the corresponding hop migrator has no converter for.- In-tree panproto VCS for the grammar.
grammars/qvr/vcs/.panproto/holds a content-addressed schema chain with one tagged commit per grammar release (v0.2.0throughv0.11.0).grammars/qvr/vcs/build_schemas.pywalks tagged grammar revisions, builds apanproto.Schemakeyed by rule name, and commits each as a tagged VCS commit. The migration system uses these commits to derive coverage reports and detect uncovered removed-rule gaps in any adjacent-pair migrator. - Comprehensive
## Try itsections in every example doc. All 28 gallery examples (regressions, latent-variable models, state-space and time-series, language models, encoder-decoder, weighted deductions) ship a verified three-block runnable Try-it section: synthetic-data generation under known true parameters, an SVI fit, and a Bayesian posterior block. Every block executes in CI viatest_gallery_try_it_blocks_execute. Illustrative-budget caveat at the top of each section explicitly notes the SVI / NUTS budgets are sized for tens-of-seconds CI runs, not production convergence. - Example walkthrough alignment. All 28 example docs'
## Overviewand## Walkthroughprose audited against the actual.qvrsource; the 13 docs with prose-vs-source drift (most severelypcfg.mdandmontague-nli.md, whose embedded## QVR Sourceblocks described entirely different models than the actual source) were rewritten in place. - Examples gallery index restructured as a flat grouped list of one-line example descriptions linking to each gallery doc.
- API reference structure expanded. New pages for
api/inference/lifts,api/inference/mcmc,api/inference/elbo,api/continuous/scan,api/continuous/inline,api/stochastic/agenda,api/stochastic/deduction(+ four subpages:primitives,fit,bayes,sample). Theqvr migrate,qvr repl, andqvr lspsubcommands are documented inapi/cli.md. - Denotational semantics extensions.
docs/semantics/programs.mdgains a §7 "Bayesian lifts" with five propositions and proofs (placeholder-cancellation for the parameter lift, the observation-family lift, the log-prob lift, the single-sample MC bias bound via Jensen, the CRF-vs-PCFG distinction fornuts_program_from_deduction).docs/semantics/adequacy.mdgains a §3.7b on adequacy of the lift theorems.docs/semantics/types-and-spaces.md§1 and §4 cover all 13ContinuousSpacevariants with set-builder denotations.docs/semantics/grammar.mdrewritescomposition_rule_declEBNF to match the unified surface.docs/semantics/expressions.md§3.4 notes the dict-signature route onScanMorphism.log_joint. qvr migratedocumentation.docs/guides/migration.mdcovers the--from/--to/--dry-run/--output/--checkflag set with worked examples.
Changed
quivers.deduction_fitmodule removed. Imports move toquivers.stochastic.deduction(orquivers.inference.liftsforbayesian_lift_parameters). Pre-1.0 clean break, no compat shim. The 20+ docs and tests that referenced the old path are updated.- Docstring cross-references converted to mkdocstrings autorefs. All 1103 Sphinx-style
:func:X/ `:class:`X/:mod:X/ `:meth:`X/:attr:X/ `:data:`X/:exc:X`` role markers in source docstrings (132 files) are now either mkdocstrings autorefs (for internal symbols the docs build resolves) or plain inline code (for external / unresolved references). Sphinx role markers no longer render as ugly grey code spans in the API docs. - DSL surface drift across the entire test and doc corpus. Every fixture, every embedded source string, every walkthrough prose reference is on the current homogenized surface.
mkdocs build --strictproduces zero warnings;pytest tests/reports 2009 passing, 140 skipped, zero failing.
Fixed
- Grammar parser-recovery bugs.
encoder_declandcomposition_declpreviously usedoptional(body), $._newline, which let the trailing$._newlineswallow the next top-level statement after an indented body. Replaced withchoice(body, $._newline)so the$._dedentproperly terminates and the following statement parses.parser.c,grammar.json, andnode-types.jsonregenerated. ScanMorphism.log_jointdict-vs-positional adapter unified into the morphism itself so call sites no longer need aDictWrapshim._TruncNormdistribution shim inquivers.continuous.inlinenow carriesevent_shapeandbatch_shapeattributes so the generic family-log_probpath treats it uniformly with stocktorch.distributionsfamilies.- Formula compiler (
quivers.formulas.compile) emitsobject Resp : FinSet Nvia the homogenizedDiscreteConstructorinitialiser and accepts both old and new shapes on the reverse-pass decoder. - Dataset schema (
quivers.data.schema) emitsobject X : FinSet Nin the prelude returned fromDatasetSchema.declarations_qvrand thecomposewrapper. - Compiler template-locals walker (
quivers.dsl.compiler.programs._collect_template_local_names) now walks the surfaceSampleStep/ObserveStep/MarginalizeStepnodes (was only walking the legacyBindStepIR), so locally-bound names in parametric program templates are correctly captured during alpha-renaming. - Compiler structural pass (
quivers.dsl.compiler.structural._compile_signature) readsdimandvocabfrom each sort and vertex-kind'soptionsblock (the homogenized surface) rather than from removed direct attributes._compile_lossaccepts numeric-literalweight = Nin the loss option block. docs/developer/homogenization-plan.mdremoved. Internal design-tracking doc with phase counts and version anchors; not appropriate for shipped documentation.
Editor packages
- VS Code extension
editors/vscode-qvrbumped to 0.6.0. Syntax highlighting refreshed for the homogenized grammar (the unified declaration keywords, the option-block surface, the new pragma markers, thecomposition NAME as <level>keyword, thesample/observe/score/marginalize/bindersprogram-step keywords). Tracks the new sharedSTYLE_TABLEso VS Code, the REPL TUI, the Pygments lexer, and the LSP semantic-tokens legend all paint the same source the same colour. - Zed extension
editors/zed-extension-qvrbumped to 0.2.0. Tree-sitterhighlights.scmregenerated from the homogenized grammar via the sharedgrammars/qvr/queries/_generate.pyscript, so the Zed mirror tracks the canonical highlights file automatically.
Full Changelog: v0.10.0...v0.11.0