Skip to content

v0.2.0

Choose a tag to compare

@github-actions github-actions released this 06 May 20:31
· 107 commits to main since this release

This release migrates every quivers value type onto didactic Models, delegates .qvr parsing to panproto via a new in-tree tree-sitter grammar, lifts every compiled program to a panproto Schema, and ships a formal denotational semantics for the DSL.

Highlights

  • Every record-shaped value type is a dx.Model. AST nodes (38 classes), Token, the 5-variant Category union, RuleSystem, FinSet / ProductSet / CoproductSet / FreeMonoid, Euclidean / Simplex / PositiveReals / ProductSpace / UnitInterval, and Diagram. Recursive sums (TypeExpr, CatPattern, SpaceExpr, Expr, LetExprNode, ProgramStep, Statement) are dx.TaggedUnion roots discriminated by kind: Literal[...]. JSON round-trips via model_dump_json / model_validate_json are now uniformly available.
  • QVR has a tree-sitter grammar. grammars/qvr/ ships the grammar source and generated artefacts; it is registered in panproto-grammars-all and consumed at runtime by quivers.dsl.parser. The hand-written lexer and recursive-descent parser are removed.
  • Resolution is a dx.Lens family. quivers.dsl.resolution exposes TypeExprToSetObject(env) and SpaceExprToContinuousSpace(env_spaces, env_objects, name) as dx.Lens instances. The resolution environment is carried on the lens instance — the dependent-optics shape — and the GetPut / PutGet round-trip laws hold by construction.
  • Programs are panproto schemas. quivers.dsl.program_theory defines QVR_PROGRAM_PROTOCOL (a panproto protocol enumerating every SetObject / ContinuousSpace variant plus the QVR declaration variants) and extract_program_schema, which walks a compiled environment and emits a panproto.Schema. panproto schema diff, panproto lens generate, and the rest of the panproto toolbox now apply to .qvr programs out of the box.
  • Cross-field axioms on RuleSystem. binary_weights / unary_weights lengths must match binary_rules / unary_rules when supplied, enforced via __axioms__.
  • Formal denotational semantics. New documentation section under docs/semantics/ gives a compositional semantics for the DSL across the discrete, stochastic, and continuous strata: setting and notation, quantales and base change, types and spaces, morphisms, expressions, programs (Giry-monadic), the grammar fragment (categorial grammars + chart parsers), the program theory, and an adequacy theorem connecting the compiler implementation to the denotation.

Breaking changes

  • Python 3.14+ required (was 3.13).
  • Variadic constructors removed. ProductSet(A, B, C) → ProductSet(components=(A, B, C)). Same for CoproductSet. The flattening converter preserves prior behaviour: nested products / coproducts collapse on construction.
  • Public field names on continuous spaces. Euclidean(_name=..., _dim=...) → Euclidean(name=..., dim=...). Same for Simplex, PositiveReals, ProductSpace, UnitInterval.
  • LexError removed. Lexical errors now surface as ParseError (tree-sitter integrates lexing with parsing).
  • quivers.dsl.lexer and quivers.dsl.tokens removed. Use quivers.dsl.parser directly; from quivers.dsl import parse, parse_file, loads, load.

Pre-1.0 policy: clean breaking changes, no compat shims.

Dependencies

  • torch >= 2.0
  • didactic >= 0.6.0
  • panproto >= 0.45.0
  • panproto-grammars-all >= 0.45.0

Infrastructure

  • Release workflow at .github/workflows/release.yml builds an sdist + wheel on v* tag push and publishes to PyPI via the FACTSlab/quivers OIDC trusted publisher (no API tokens).
  • Pull request template at .github/PULL_REQUEST_TEMPLATE.md.
  • Issue templates at .github/ISSUE_TEMPLATE/{bug_report,feature_request,config}.yml.
  • Pyright configuration in pyproject.toml suppresses upstream torch typing noise (reportPrivateImportUsage) and demotes didactic-FieldValue-widening symptoms to warnings.

Issues filed upstream during the migration

Test surface

  • 940 tests pass; 0 xfail; 0 errors.
  • New test files: tests/test_resolution_lenses.py (49 lens tests), tests/test_program_theory.py (36 schema-extraction tests), tests/test_model_roundtrips.py (57 JSON round-trip cases for every migrated dx.Model).
  • Tree-sitter fixtures under grammars/qvr/test/corpus/ cover every example in src/quivers/dsl/examples/.

Documentation

Links