AST Nodes¶
The AST node classes of QVR, each a didactic Model, record the structure of a parsed module: a
declaration holds its name, arguments, and expressions, so tools can read and transform these
parts. Elaboration, the compiler step that
rewrites declarations into explicit core terms, then resolves names and makes implicit operations
explicit (correspondences).
ast_nodes
¶
AST node definitions for the quivers DSL ().
The AST is a direct representation of the parsed .qvr source. Each
node carries source-location info for error reporting. Recursive sums
use dx.TaggedUnion with a kind discriminator: variants subclass
their sum's root and pin kind to a Literal[...] value.
This package's submodules group the node families:
._sharedfor shared helpers (AxisSpec,CompositionLevel, the option-value tagged union).typesfor type expressions.let_expressionsfor let-arith expressions.expressionsfor value (morphism) expressions.program_stepsfor monadic program steps.structuralfor structural-compression helpers.declarationsfor top-level statements (sixteen variants).modulefor the file-levelModulecontainer
Every public class is re-exported here so from quivers.dsl.ast_nodes
import X keeps working.
MODULE_STATEMENT_TYPES
module-attribute
¶
MODULE_STATEMENT_TYPES: tuple[type[Statement], ...] = (ImportDecl, OpenDecl, HoleDecl, LinkDecl)
The statements that belong to the module system rather than the program.
A share stays in the program: elaboration reads it to tie sites and
parameters.
MODULE_LANGUAGE_STATEMENT_TYPES
module-attribute
¶
MODULE_LANGUAGE_STATEMENT_TYPES: tuple[type[Statement], ...] = (SignatureDecl, ModuleDecl, ImplicitDecl, QiecComputationSpec, DeductionSpec)
Module-language statements, which static interpretation consumes.
LINKING_STATEMENT_TYPES
module-attribute
¶
The linking statements, which the module system consumes.
META_STATEMENT_TYPES
module-attribute
¶
META_STATEMENT_TYPES = (MetaDecl, StaticAssertDecl, SpliceDecl, DerivingDecl)
The statement classes that belong to the meta phase.
NOTATION_STATEMENT_TYPES
module-attribute
¶
NOTATION_STATEMENT_TYPES: tuple[type[Statement], ...] = (NotationDecl, OpenNotationDecl, NameSpellingsDecl)
The statement classes of the notation surface.
QiecValue
module-attribute
¶
QiecValue = LetExprNode
A QIEC value, which is the shared pure-expression tree.
Variables, literals, operators, tuples, and builtin applications are
the same nodes a program let step uses; constructor application
joins that tree, so there is one value language rather than two
isomorphic ones.
THEORY_STATEMENT_TYPES
module-attribute
¶
THEORY_STATEMENT_TYPES = (TheoryDecl, ViewDecl, ModelDecl)
The declarations of the theory layer, which elaborate at check time.
SEMIRING_STATEMENT_TYPES
module-attribute
¶
SEMIRING_STATEMENT_TYPES = (SemiringDecl,)
The semiring declarations, which elaborate at check time.
CompositionLevel
¶
Algebraic level the file declares for its composition rule.
The four levels correspond to the
quivers.core.algebras.CompositionRule-hierarchy:
"algebra"requires a fullAlgebra(unit, zero, meet, negate, identity, dagger, cup/cap)."semigroupoid"requires aSemigroupoid(associative composition, no identity required); everySemiringalgebra qualifies."magmoid"requires aMagmoid, a rule declared to satisfy no composition law."composition_rule"is permissive: anyCompositionRuleis accepted.
MorphismRole
¶
Role attribute on a morphism declaration.
parameter (learnable point estimate), observed (fixed
structural input), kernel (parametric Markov kernel with a family
prior), embed (FinSet -> ContinuousSpace boundary),
discretize (ContinuousSpace -> FinSet boundary), let
(deterministic let-bound morphism), function (learned deterministic
map between continuous spaces). Optional; when the option block
carries no role, the morphism is a kernel. Every other role is
explicit.
LetBinaryOperator
¶
LetBinaryOperator = Literal['+', '-', '*', '/', '%', '==', '!=', '<', '<=', '>', '>=', '&&', '||', '++', '\\']
The operator of a binary let expression: arithmetic, comparison, boolean, concatenation of records or of case functions, or restriction of a record.
QiecHandlerImplementation
¶
Whether a handler's clause bodies are written in source.
An "authored" handler carries a body for every clause; a
"foreign" handler may give clause signatures without bodies, which
the target runtime supplies.
QiecResumptionGrade
¶
How many times an operation clause may resume its continuation.
"0" never resumes, "aff" resumes at most once, "1" resumes
exactly once, and "omega" resumes any number of times. The
"interval" form uses the clause's inclusive integer bounds.
QiecStaticArgument
¶
QiecStaticArgument = QiecTypeExpr | QiecIndexLiteral
A static argument: a type or effect written as type syntax, or an index literal.
AxisSpec
didactic-model
¶
Bases: Model
Axis-role specification on a distribution clause.
Surface form: over <axes> [iid over <axes>].
over names the event axes, the axes on which the family's
joint structure (an MVN covariance, a MatrixNormal Kronecker pair,
a GP kernel) lives. The axis count must match the family's
declared event rank; the positional ordering corresponds
positionally to the family's event-axis ordering.
iid_over is an optional readability assertion naming the batch
axes (the complement of over in the surrounding morphism's
type signature). Inconsistency with the type signature or with
over is a compile-time error.
Axis names resolve against the named factors of the surrounding
morphism's dom/cod. The reserved tokens dom and cod are
legal shortcuts only when the corresponding side is a single
unfactored object.
BundleDecl
didactic-model
¶
BundleDecl(*, name: str, rules: tuple[str, ...], docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['bundle_decl'] = 'bundle_decl')
Bases: Statement
bundle NAME : [rule1, rule2, ...] first-class schema bundle.
Binds NAME to a tuple of schema references; parser(rules=NAME)
and chart_fold(binary=NAME, ...) resolve the bundle by name
and splice its members into the rule list.
CategoryDecl
didactic-model
¶
CompositionDecl
didactic-model
¶
CompositionDecl(*, name: str, level: CompositionLevel | None = None, body: tuple[CompositionRuleEntry, ...] = (), docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['composition_decl'] = 'composition_decl')
Bases: Statement
composition NAME [level=LEVEL] [: body] declaration.
level records which algebraic level the option block
advertises; the optional body defines the rule's operations
inline.
CompositionRuleEntry
didactic-model
¶
CompositionRuleEntry(*, key: str, params: tuple[str, ...] = (), body: LetExprNode, line: int = 0, col: int = 0)
Bases: Model
One entry of a composition body block.
Function-valued entries (tensor_op, join, negation,
meet) declare a lambda over named parameters; value-valued
entries (unit, zero) declare a numeric literal. The
params tuple is empty for value-valued entries.
ContractionDecl
didactic-model
¶
ContractionDecl(*, name: str, inputs: tuple[ContractionInput, ...], domain: ObjectExpr, codomain: ObjectExpr, options: tuple[OptionEntry, ...] = (), docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['contraction_decl'] = 'contraction_decl')
Bases: Statement
contraction NAME(inputs) : DOM -> COD [options].
The option block carries:
rule=<NAME>(required): names the composition rule whosejoinis the fold operation for contracted axes.share=[ax1, ax2, ...]: keep listed axes element-wise even when they appear in multiple inputs.wiring="<einsum>": explicit escape hatch; verbatim einsum string.
ContractionInput
didactic-model
¶
ContractionInput(*, name: str, input_domain: ObjectExpr, input_codomain: ObjectExpr, line: int = 0, col: int = 0)
Bases: Model
One input wire of a ContractionDecl declaration.
DecoderDecl
didactic-model
¶
DecoderDecl(*, name: str, signature: str, sig_args: tuple[str, ...] = (), options: tuple[OptionEntry, ...] = (), dims: tuple[SortDim, ...] = (), structure: LetExprNode | None = None, structure_arg: str | None = None, primitive: LetExprNode | None = None, primitive_arg: str | None = None, factor: LetExprNode | None = None, factor_arg: str | None = None, binder_select: LetExprNode | None = None, binder_select_arg: str | None = None, recursive_default: bool = True, docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['decoder_decl'] = 'decoder_decl')
DeductionDecl
didactic-model
¶
DeductionDecl(*, name: str, domain: ObjectExpr, codomain: ObjectExpr, options: tuple[OptionEntry, ...] = (), atoms: tuple[str, ...] = (), binders: tuple[str, ...] = (), rules: tuple[SequentRule, ...] = (), lexicon: tuple[LexiconEntry, ...] = (), lexicon_from_file: str | None = None, lexicon_from_file_options: tuple[OptionEntry, ...] = (), docs: tuple[str, ...] = (), line: int = 0, col: int = 0, deriving: tuple[DerivingClass, ...] = (), extends: tuple[DeductionExtension, ...] = (), lexicons: tuple[LexiconReference, ...] = (), instantiations: tuple[RuleInstantiation, ...] = (), origins: tuple[SymbolOrigin, ...] = (), rule_origins: tuple[SymbolOrigin, ...] = (), cores: tuple[DeductionCore, ...] = (), semiring: DeductionSemiring | None = None, category_sets: tuple[CategorySetDecl, ...] = (), semantics: SemanticsDecl | None = None, templates: tuple[LexicalTemplate, ...] = (), lexical_rules: tuple[LexicalRuleDecl, ...] = (), features: tuple[AtomFeatures, ...] = (), refines: str = '', kind: Literal['deduction_decl'] = 'deduction_decl')
Bases: Statement
deduction NAME : DOM -> COD [options] : body.
Body is an indented block of atoms, rule, lexicon
entries. semiring is the header's semiring parameter
([S = I] or [S : T]), None for the log semiring. The
option block carries start=..., depth=..., axioms=...,
signature=..., encoder=.... deriving holds the classes of
the header's deriving (...) clause, derived for the deduction's
generated item family.
extends, lexicons, and instantiations are the
signatures, lexicon modules, and schema instantiations the body
names; composition (quivers.dsl.deduction_composition) replaces
them by the rules, atoms, and entries they stand for and records
each atom's declaration in origins, each rule's in
rule_origins, and the signatures extended in cores.
category_sets, semantics, templates, lexical_rules,
features, and refines are the body's categories,
semantics, template, lexical rule, featured atoms, and
refines lines; lexicon expansion (quivers.dsl.lexical) turns a
deduction that uses them into one that does not.
EncoderDecl
didactic-model
¶
EncoderDecl(*, name: str, signature: str, sig_args: tuple[str, ...] = (), options: tuple[OptionEntry, ...] = (), dims: tuple[SortDim, ...] = (), iterations: int | None = None, readout: LetExprNode | None = None, op_rules: tuple[EncoderRule, ...] = (), init_rules: tuple[EncoderInitRule, ...] = (), message_rules: tuple[EncoderMessageRule, ...] = (), update_rules: tuple[EncoderUpdateRule, ...] = (), var_inits: tuple[EncoderVarInit, ...] = (), docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['encoder_decl'] = 'encoder_decl')
Bases: Statement
encoder NAME : SIG[(sig_args)] [options] [: body].
The option block carries factory=... (factory-backed form)
plus any factory keyword arguments. Body entries are
dim, iterations, readout, per-op rules,
init/message/update rules, var_init rules.
ExportDecl
didactic-model
¶
ExportDecl(*, expr: Expr, docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['export_decl'] = 'export_decl')
DefineDecl
didactic-model
¶
DefineDecl(*, name: str, expr: Expr, where: tuple[Statement, ...] = (), docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['define_decl'] = 'define_decl')
Bases: Statement
define NAME = EXPR [where: nested-defines] value binding.
Unlike a MorphismDecl with role=let, this is a
value-level binding: its RHS is an arbitrary morphism Expr, not a
morphism signature with an init. The program-step let binds
tensor arithmetic instead; the two forms never share a keyword.
The where field is typed as tuple[Statement, ...] (the
union root) because didactic does not yet accept self-referential
forward refs in field annotations. The parser only ever writes
DefineDecl instances into the tuple.
LexiconCategory
didactic-model
¶
Bases: TaggedUnion
Category position in a lexicon entry. Three shapes:
LexiconCategoryFixed-- a known category, e.g.Det.LexiconCategoryWildcard-- the*wildcard. The compiler treats the entry's category as a latent random variable and learns a Categorical distribution over the deduction's full atom set; one learnable weight is allocated per atom.LexiconCategoryRestricted-- a candidate set{A, B}. Same as wildcard but the Categorical is restricted to the listed atoms; one learnable weight per listed atom.
LexiconCategoryFixed
didactic-model
¶
LexiconCategoryFixed(*, category: ObjectExpr, kind: Literal['fixed'] = 'fixed')
LexiconCategoryPolymorphic
didactic-model
¶
LexiconCategoryPolymorphic(*, binders: tuple[CategoryBinder, ...], category: ObjectExpr, kind: Literal['polymorphic'] = 'polymorphic')
Bases: LexiconCategory
"and" : ∀ X in Conj. Fwd(Bwd(X, X), X) = coord[X].
A category schema: one entry per assignment of members of the named
category sets to the variables (quivers.dsl.lexical).
LexiconCategoryRestricted
didactic-model
¶
LexiconCategoryWildcard
didactic-model
¶
LexiconEntry
didactic-model
¶
LexiconEntry(*, words: tuple[str, ...], category: LexiconCategory, lf: LetExprNode | None = None, options: tuple[OptionEntry, ...] = (), line: int = 0, col: int = 0, weights: tuple[str, ...] = (), stands_for: str = '', derived_by: str = '')
Bases: Model
One lexicon-block entry: "word", ... : CAT = LF.
Each word maps to the same category and logical form. A typed entry
with an entry name may omit the logical form. weights
names the learned weight families the entry's weight multiplies:
a written entry names them with #[shared = F], and lexicon
expansion gives every instance of a polymorphic entry its entry's
family and an entry a lexical rule derives the rule's family.
stands_for names, for an instance of a lazily instantiated entry
in the deduction the agenda engine runs (an agenda plan), the
placeholder atom whose item stands for it in the chart: such an entry
is no axiom, and under normalize=lhs it is a production of its
category, read by the rules specialized to the placeholder, while the
placeholder's own entry is an axiom and no production.
derived_by names, for an entry a lexical rule in chart mode derives
from a lexical item, that rule: the agenda engine derives the entry's
item from the lexical item by the rule, and reads the rule's conclusion
back as an axiom occurrence of the entry.
LossDecl
didactic-model
¶
LossDecl(*, name: str, options: tuple[OptionEntry, ...] = (), body: LetExprNode, docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['loss_decl'] = 'loss_decl')
Bases: Statement
loss NAME [options] : body.
Option keys: weight=<expr>, on=<attachment>. The
on value is an OptionCall of one of program(NAME),
deduction(NAME), encoder(NAME), decoder(NAME),
rule(RULE, DEDUCTION), chart(DEDUCTION), or an
OptionFlag global.
MorphismDecl
didactic-model
¶
MorphismDecl(*, names: tuple[str, ...], domain: ObjectExpr, codomain: ObjectExpr, options: tuple[OptionEntry, ...] = (), init_family: MorphismInitFamily | None = None, init_expr: Expr | None = None, docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['morphism_decl'] = 'morphism_decl')
Bases: Statement
morphism NAME, ... : DOM -> COD [options] [~ init].
Each name declares an independent morphism (fresh parameters)
with the same signature, options, and initializer. The morphism's
role travels in the option block; the compiler reads
options["role"] (kernel when absent) to pick the runtime
construction.
Initializer (~ clause, optional):
init_family:~ Family(args)family call (used for kernel priors, latent priors, distribution-driven init).init_expr:~ <expression>arbitrary morphism-expression (used for explicit values, composition pipelines,~ autonamed recipes).
The two init slots are mutually exclusive; exactly zero or one is populated.
MorphismInitFamily
didactic-model
¶
MorphismInitFamily(*, family: str, args: tuple[DrawArg, ...] = (), line: int = 0, col: int = 0)
Bases: Model
~ Family(args) distribution-family initializer.
MorphismParam
didactic-model
¶
MorphismParam(*, name: str, domain: ObjectExpr, codomain: ObjectExpr, line: int = 0, col: int = 0, kind: Literal['morphism_param'] = 'morphism_param')
ObjectParam
didactic-model
¶
OptionCall
didactic-model
¶
OptionCall(*, func: str, args: tuple[OptionValue, ...] = (), kind: Literal['option_call'] = 'option_call')
OptionEntry
didactic-model
¶
OptionEntry(*, key: str, value: OptionValue = field(default_factory=OptionFlag), line: int = 0, col: int = 0)
Bases: Model
One key=value (or bare key) entry in an option block.
The list-of-entries layout (rather than a dict) preserves source order; downstream code typically realises a dict on first use.
OptionFlag
didactic-model
¶
OptionList
didactic-model
¶
OptionList(*, items: tuple[OptionValue, ...] = (), kind: Literal['option_list'] = 'option_list')
OptionName
didactic-model
¶
OptionNumber
didactic-model
¶
OptionString
didactic-model
¶
OptionValue
didactic-model
¶
Bases: TaggedUnion
Value inhabiting one entry of an option block.
Surface shapes:
- Bare flag
[role]->OptionFlag(no value) role=parameter->OptionName(identifier)depth=8/scale=0.1->OptionNumberpath="lex.tsv"->OptionStringover=[a, b]->OptionListvia=product(a, b)->OptionCall
ProgramDecl
didactic-model
¶
ProgramDecl(*, name: str, params: tuple[str, ...] | None = None, type_params: tuple[ProgramParam, ...] | None = None, binders: tuple[QiecBinder, ...] = (), value_parameters: tuple[QiecValueParameter, ...] = (), domain: ObjectExpr, codomain: ObjectExpr, options: tuple[OptionEntry, ...] = (), draws: tuple[ProgramStep, ...] = (), return_vars: tuple[str, ...] = (), return_labels: tuple[str, ...] | None = None, docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['program_decl'] = 'program_decl')
Bases: Statement
A program's static binders, runtime interface, and effectful body.
binders holds the shared QIEC static telescope. type_params
records object/morphism specialization and scalar partial application.
value_parameters declares checked runtime values; params names
domain factors when their types are inferred from the domain instead.
The body contains executable steps and a terminal return.
ProgramParam
didactic-model
¶
Bases: TaggedUnion
Program-specific specialization and scalar-application metadata.
RuleDecl
didactic-model
¶
RuleDecl(*, name: str, variables: tuple[str, ...], premises: tuple[ObjectExpr, ...], conclusion: ObjectExpr, docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['rule_decl'] = 'rule_decl')
Bases: Statement
rule NAME[variables] : premises |- conclusion declaration.
Premises and conclusion are ObjectExpr patterns drawn from
the unified type-expression family.
ScalarParam
didactic-model
¶
ScalarParam(*, name: str, scalar_kind: Literal['Real', 'Nat'], line: int = 0, col: int = 0, kind: Literal['scalar_param'] = 'scalar_param')
Bases: ProgramParam
Runtime scalar metadata for s : Real or s : Nat.
The checked runtime declaration is recorded in value_parameters;
this metadata also supports named scalar partial application.
SchemaDecl
didactic-model
¶
SchemaDecl(*, name: str, parameters: tuple[SchemaParameter, ...], domain: ObjectExpr, codomain: ObjectExpr, docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['schema_decl'] = 'schema_decl')
SchemaParameter
didactic-model
¶
SchemaParameter(*, names: tuple[str, ...], type_expr: ObjectExpr, line: int = 0, col: int = 0)
Bases: Model
One names : type group inside a schema's parameter list.
SequentRule
didactic-model
¶
SequentRule(*, name: str, premises: tuple[ObjectExpr, ...], conclusion: ObjectExpr, options: tuple[OptionEntry, ...] = (), line: int = 0, col: int = 0, parameters: tuple[QiecBinder, ...] = (), weight_source: SpecializedWeight | None = None)
Bases: Model
A named sequent inside a deduction block.
rule NAME : premises |- conclusion [pragma]. Premise and
conclusion type-expressions may contain single-uppercase
wildcards (X, Y) that bind to actual category
subexpressions when the rule fires.
The trailing pragma carries optional rule-level options:
#[learnable]-- allocate one learnable log-weight per distinct binding tuple observed at run time. The bindings tuple is(rule_name, *sorted_binding_values). The conclusion weight becomessemiring_product(premise_weights, param[bindings]).#[weight = expr]-- the conclusion weight issemiring_product(premise_weights, expr)whereexpris a let-expression evaluated in the rule's binding scope (wildcards bound by the match are in scope). Most general form; subsumeslearnable.#[parent = rule_name]-- compose this rule's weight additively with the named parent rule's weight on the same bindings. Specialisation as a correction term.#[shared = F(p, q)]-- the rule's weight is the learnable weight familyFat the index(p, q): one log-weight per index, read by every rule that names the same family and index.
parameters is the static telescope of a rule schema
(rule r[n : Nat, e : Dir] : ...); a rule with parameters is a
family of rules that a rules line instantiates.
weight_source is set only on the rules lexicon expansion
(quivers.dsl.lexical) specializes to a lazily instantiated entry:
such a rule reads its source rule's learned weight on the source's
own bindings.
SyntaxDecl
didactic-model
¶
SyntaxDecl(*, name: str, params: tuple[str, ...] = (), sorts: tuple[SortDecl, ...] = (), constructors: tuple[ConstructorDecl, ...] = (), vertex_kinds: tuple[VertexKindDecl, ...] = (), edge_kinds: tuple[EdgeKindDecl, ...] = (), equations: tuple[EquationDecl, ...] = (), equation_options: tuple[OptionEntry, ...] = (), assume_terminating: bool = False, docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['syntax_decl'] = 'syntax_decl')
Bases: Statement
syntax NAME[(params)]: a second-order binding signature.
Its body declares sorts, constructors with per-argument binding arities, equations, and vertex and edge kinds.
ObjectDecl
didactic-model
¶
ObjectDecl(*, names: tuple[str, ...], init: TypeInitializer, docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['object_decl'] = 'object_decl')
Bases: Statement
object NAME, ... : VALUE declaration.
Each name registers an independent object with the same VALUE.
The VALUE's shape picks the
discrete-vs-continuous and reference-vs-initializer distinction;
the compiler reads init to decide what kind of object
(FinSet, EnumSet, FreeResiduated, FreeMonoid, ContinuousSpace) to
register in the env.
TypeEnumSet
didactic-model
¶
TypeFreeMonoid
didactic-model
¶
TypeFreeResiduated
didactic-model
¶
TypeFromExpr
didactic-model
¶
TypeFromExpr(*, expr: ObjectExpr, kind: Literal['type_from_expr'] = 'type_from_expr')
Bases: TypeInitializer
type X : <type-expression> for every non-special-form value.
Covers integer cardinalities, identifiers, products, coproducts, slashes, effect-applies, and constructor calls (FinSet, Real, Simplex, ...).
TypeInitializer
didactic-model
¶
Bases: TaggedUnion
Sum of type NAME : VALUE value shapes.
The grammar's _object_value choice corresponds 1:1 to this
union.
Expr
didactic-model
¶
Bases: TaggedUnion
Sum of value-expression node kinds (morphism computations).
ExprCap
didactic-model
¶
ExprChangeBase
didactic-model
¶
ExprChangeBase(*, inner: Expr, phi: Expr, line: int = 0, col: int = 0, kind: Literal['expr_change_base'] = 'expr_change_base')
Bases: Expr
Change-of-base: apply a transformation (a carrier map, such
as an algebra homomorphism, or a MorphismTransformation) to a
morphism.
The transformation is a first-class value: phi is any
expression whose compile-time value is a
MorphismTransformation or
CarrierMap. Concretely:
- A bare identifier resolving a registered singleton
(
f.change_base(expectation)) or a let-bound trans value (f.change_base(t)). - A constructor call (
f.change_base(softmax(B))). - A composition (
f.change_base(t1 >>> t2)).
ExprChartFold
didactic-model
¶
ExprChartFold(*, lex: Expr, binary: Expr | None = None, unary: Expr | None = None, start: str | int = 'S', depth: int = 1, effect_depth: int = 0, line: int = 0, col: int = 0, kind: Literal['expr_chart_fold'] = 'expr_chart_fold')
Bases: Expr
Desugared parser-construction primitive.
Surface form: chart_fold(lex=, binary=, unary=, start=, depth=,
effect_depth=).
Constructs a chart parser from morphism-valued arguments rather
than from a list of named rule schemas. lex is a morphism
Token -> Cat; binary is a Cat * Cat -> Cat morphism (the
union of all binary rule schemas); unary is an optional
Cat -> Cat morphism (the union of all unary rule schemas);
start is the goal category name (or integer index);
depth is the maximum category nesting depth; effect_depth
bounds effect-stack nesting (defaults to 0).
ExprCompose
didactic-model
¶
ExprCompose(*, left: Expr, right: Expr, op: str = '>>', line: int = 0, col: int = 0, kind: Literal['expr_compose'] = 'expr_compose')
Bases: Expr
Algebra-typed sequential composition.
The op field selects which enrichment algebra's monoidal
structure to use for the V-Cat composition:
">>"for ProductFuzzyAlgebra noisy-OR (the default)."<<"for reverse ProductFuzzyAlgebra.">=>"for Kleisli composition (operands' shared algebra)."*>"for Markov sum-product."~>"for LogProb (log-space sum-product)."||>"for Gödel (lattice min/max with Heyting implication)."?>"for Viterbi (max-plus tropical, best path)."&&>"for Boolean (∧/∨)."+>"for Łukasiewicz (probabilistic sum bounded by 1).
Each operator carries its own algebra; cross-operator
composition in one chain requires explicit .change_base(φ)
between segments.
ExprCup
didactic-model
¶
ExprCurry
didactic-model
¶
ExprCurry(*, inner: Expr, direction: Literal['right', 'left'], line: int = 0, col: int = 0, kind: Literal['expr_curry'] = 'expr_curry')
Bases: Expr
The curry combinator.
For f : X * Y -> Z, f.curry_right denotes the curried
morphism X -> Y * Z and f.curry_left denotes Y -> X * Z:
in the compact closed category of V-matrices the internal hom
[Y, Z] is the product set Y * Z, and currying is the
bijection Hom(X * Y, Z) ≅ Hom(X, [Y, Z]) (see
quivers.core.morphisms.CurriedMorphism). The domain must factor
as a product.
ExprDagger
didactic-model
¶
ExprDagger(*, inner: Expr, line: int = 0, col: int = 0, kind: Literal['expr_dagger'] = 'expr_dagger')
ExprFan
didactic-model
¶
ExprFan(*, exprs: tuple[Expr, ...], line: int = 0, col: int = 0, kind: Literal['expr_fan'] = 'expr_fan')
ExprFreeze
didactic-model
¶
ExprFreeze(*, inner: Expr, line: int = 0, col: int = 0, kind: Literal['expr_freeze'] = 'expr_freeze')
Bases: Expr
Detach gradients: inner.freeze materialises inner's
tensor with detach() and wraps the result as a frozen
ObservedMorphism. Used to pin a learned composition
as a structural input that the downstream model treats as
constant.
ExprFromData
didactic-model
¶
ExprFromData(*, key: str, line: int = 0, col: int = 0, kind: Literal['expr_from_data'] = 'expr_from_data')
Bases: Expr
Data-derived initializer from_data("KEY").
The string key is resolved against the runtime data dictionary
at fit time; the morphism's tensor is the looked-up value.
The resulting morphism is ObservedMorphism: its
entries are frozen / structural inputs, not learnable
parameters.
ExprIdent
didactic-model
¶
ExprIdentity
didactic-model
¶
ExprMarginalize
didactic-model
¶
ExprMarginalize(*, inner: Expr, names: tuple[str, ...], line: int = 0, col: int = 0, kind: Literal['expr_marginalize'] = 'expr_marginalize')
ExprMorphismCall
didactic-model
¶
ExprMorphismCall(*, callee: str, args: tuple[str, ...], static_args: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['expr_morphism_call'] = 'expr_morphism_call')
Bases: Expr
Call expression callee(arg1, arg2, ...) resolving to a
morphism-level operation.
Used by ContractionDecl declarations: when the user
writes let out = op_apply(arg1, arg2, kernel), the
op_apply identifier resolves to a registered contraction
and the arguments are looked up in the morphism scope.
ExprParser
didactic-model
¶
ExprRepeat
didactic-model
¶
ExprRepeat(*, expr: Expr, count: int | None, line: int = 0, col: int = 0, kind: Literal['expr_repeat'] = 'expr_repeat')
ExprScan
didactic-model
¶
ExprScan(*, expr: Expr, init: str = 'zeros', outputs: Literal['last', 'all'] = 'last', reverse: bool = False, line: int = 0, col: int = 0, kind: Literal['expr_scan'] = 'expr_scan')
Bases: Expr
Temporal scan: scan(cell) with its options.
The options are init (zeros, learned, or a binding of
the scanning program), outputs (last for the final state,
all for the state after every position, in input order), and
reverse (visit the positions from the last to the first).
ExprStack
didactic-model
¶
ExprStack(*, expr: Expr, count: int, line: int = 0, col: int = 0, kind: Literal['expr_stack'] = 'expr_stack')
ExprTensorProduct
didactic-model
¶
ExprTrace
didactic-model
¶
ExprTrace(*, inner: Expr, object_name: str, line: int = 0, col: int = 0, kind: Literal['expr_trace'] = 'expr_trace')
ExprTransCompose
didactic-model
¶
ExprTransCompose(*, left: Expr, right: Expr, line: int = 0, col: int = 0, kind: Literal['expr_trans_compose'] = 'expr_trans_compose')
Bases: Expr
Composition of two transformations: t1 >>> t2 denotes
sequential application, first apply t1, then t2.
Required: t1.target == t2.source (typed at compile time;
a mismatch raises CompileError). The result behaves
as a transformation with source = t1.source and
target = t2.target.
LetExprBinOp
didactic-model
¶
LetExprBinOp(*, op: LetBinaryOperator, left: LetExprNode, right: LetExprNode, line: int = 0, col: int = 0, kind: Literal['let_expr_binop'] = 'let_expr_binop')
Bases: LetExprNode
Binary operation in an expression.
| PARAMETER | DESCRIPTION |
|---|---|
op
|
The operator: arithmetic, comparison, or boolean.
TYPE:
|
left
|
The left operand.
TYPE:
|
right
|
The right operand.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
LetExprCall
didactic-model
¶
LetExprCall(*, func: str, args: tuple[LetExprNode, ...], arg_names: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['let_expr_call'] = 'let_expr_call')
Bases: LetExprNode
Function application in an expression.
| PARAMETER | DESCRIPTION |
|---|---|
func
|
The callee's authored name.
TYPE:
|
args
|
The arguments, in order.
TYPE:
|
arg_names
|
The parallel authored names, or empty for a positional application. An empty name marks a positional argument in a mixed application.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
LetExprFactor
didactic-model
¶
LetExprFactor(*, binders: tuple[LetFactorBinder, ...], body: LetExprNode | None = None, cases: tuple[LetFactorCase, ...] = (), line: int = 0, col: int = 0, kind: Literal['let_expr_factor'] = 'let_expr_factor')
Bases: LetExprNode
Multi-axis factor expression: assemble an indexed tensor.
Surface forms:
factor v1 : I1, v2 : I2, ..., vn : In in <body> denotes the
tensor of shape (|I1|, ..., |In|, *body_shape) whose value
at position (i1, ..., in) is body[v_k := i_k].
factor v : I in { 0 -> e0, 1 -> e1, ... } denotes the
single-axis case-structured form: the body at index k is the
expression labelled k, and the labels must cover
{0, ..., |I|-1} exactly. Multi-axis case form is not
accepted; the uniform body form (which can itself contain
conditionals on the binders) is the general construction.
Categorically the left adjoint of indexing. Single-axis is a
section of the trivial bundle I -> body_type; multi-axis is
a section over the product I1 x ... x In. The dual
operation is the index pullback arr[i1, ..., in]
(LetExprIndex); together they realize the indexed-family
colim / lim pair in the slice category over FinSet.
LetExprIndex
didactic-model
¶
LetExprIndex(*, array: LetExprNode, indices: tuple[LetExprNode, ...], line: int = 0, col: int = 0, kind: Literal['let_expr_index'] = 'let_expr_index')
Bases: LetExprNode
Indexed access into a finite-domain-indexed family a[i].
Categorically the pullback morphism: given a finite-index-map
index : N → A and a per-A morphism arr : A → B, the
indexed expression arr[index[n]] denotes
arr ∘ index : N → B, the natural Kleisli pullback of
arr along index.
| ATTRIBUTE | DESCRIPTION |
|---|---|
array |
The indexed-family expression (typically a
TYPE:
|
indices |
The index expressions; supports multi-dim indexing for
nested plates (
TYPE:
|
LetExprLambda
didactic-model
¶
LetExprLambda(*, param: str, body: LetExprNode, line: int = 0, col: int = 0, kind: Literal['let_expr_lambda'] = 'let_expr_lambda')
Bases: LetExprNode
Lambda expression param -> body in a let expression.
Closes over the surrounding let-environment at instantiation time. Categorically a curried function in the Kleisli setting; used as the argument to fold / map / filter / reduce combinators.
LetExprList
didactic-model
¶
LetExprList(*, items: tuple[LetExprNode, ...], line: int = 0, col: int = 0, kind: Literal['let_expr_list'] = 'let_expr_list')
Bases: LetExprNode
List literal in a let expression: [a, b, c].
Categorically a free-monoid element over the value sublanguage; the runtime represents it as a Python list (with autograd flowing through tensor-valued items).
LetExprLiteral
didactic-model
¶
LetExprLiteral(*, value: int | float, integral: bool = False, line: int = 0, col: int = 0, kind: Literal['let_expr_literal'] = 'let_expr_literal')
Bases: LetExprNode
Numeric literal in an expression.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
The literal's value.
TYPE:
|
integral
|
Whether the source spelled an integer, with no fraction or
exponent. Integer lexemes retain an exact integer carrier. The
QIEC lowerer types them as
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
LetExprMethodCall
didactic-model
¶
LetExprMethodCall(*, receiver: LetExprNode, method: str, args: tuple[LetExprNode, ...], line: int = 0, col: int = 0, kind: Literal['let_expr_method_call'] = 'let_expr_method_call')
Bases: LetExprNode
Method call receiver.method(args) in a let expression.
The receiver is itself a let-expression (typically a variable
reference to a let-bound chart-valued, list-valued, or other
object-valued value); the method is dispatched at runtime
against the receiver's type. Used primarily for chart-view
queries (chart.weight(item), chart.enumerate(pattern),
chart.goal_weight()).
LetExprNode
didactic-model
¶
Bases: TaggedUnion
Sum of pure expression nodes.
One expression tree serves both surfaces: a program let step and a
QIEC value position parse to the same nodes. Every node carries the
1-based source line and column of its first token, which the QIEC
lowerer needs for diagnostics and stable provenance; a program step
ignores them.
LetExprString
didactic-model
¶
LetExprString(*, value: str, line: int = 0, col: int = 0, kind: Literal['let_expr_string'] = 'let_expr_string')
Bases: LetExprNode
String literal in a let expression.
Used for tokenisation, lexicon keys, and as ground-atom names
in LF constructors like pred("dog") and
forall("x", body). The runtime represents these as plain
Python strings.
LetExprUnaryOp
didactic-model
¶
LetExprUnaryOp(*, operand: LetExprNode, op: Literal['-', 'not'] = '-', line: int = 0, col: int = 0, kind: Literal['let_expr_unary'] = 'let_expr_unary')
Bases: LetExprNode
Unary negation or boolean negation in an expression.
| PARAMETER | DESCRIPTION |
|---|---|
operand
|
The operand.
TYPE:
|
op
|
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
LetExprVar
didactic-model
¶
LetExprVar(*, name: str, line: int = 0, col: int = 0, kind: Literal['let_expr_var'] = 'let_expr_var')
Bases: LetExprNode
Variable reference in an expression.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The variable's name.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
LetExprBool
didactic-model
¶
LetExprBool(*, value: bool, line: int = 0, col: int = 0, kind: Literal['let_expr_bool'] = 'let_expr_bool')
Bases: LetExprNode
Boolean literal true or false.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
The literal's value.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
LetExprUnit
didactic-model
¶
Bases: LetExprNode
The unit literal unit.
| PARAMETER | DESCRIPTION |
|---|---|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
LetExprTuple
didactic-model
¶
LetExprTuple(*, items: tuple[LetExprNode, ...], line: int = 0, col: int = 0, kind: Literal['let_expr_tuple'] = 'let_expr_tuple')
Bases: LetExprNode
Tuple construction (a, b, ...) with at least two components.
| PARAMETER | DESCRIPTION |
|---|---|
items
|
The components, in order.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
LetFactorBinder
didactic-model
¶
LetFactorBinder(*, var: str, index: ObjectExpr, line: int = 0, col: int = 0)
Bases: Model
One <var> : <Index> binder in a multi-axis factor expression.
The variable name binds to integer index values 0, 1, ..., |Index|-1 in the surrounding factor body. The index type expression resolves to a finite-set object whose cardinality is the corresponding axis size of the constructed tensor.
LetFactorCase
didactic-model
¶
LetFactorCase(*, label: int, value: LetExprNode, line: int = 0, col: int = 0)
Bases: Model
One <integer> -> <body> case in a factor pattern-match.
The label is the integer index this case populates; the body
is the value at that index. The compiler verifies that the
union of labels across all cases covers {0, ..., |Index|-1}
exactly.
Module
didactic-model
¶
Module(*, statements: tuple[Statement, ...] = field(default_factory=tuple), tests: tuple[TestDecl, ...] = field(default_factory=tuple), experiments: tuple[ExperimentDecl, ...] = field(default_factory=tuple))
Bases: Model
A complete .qvr program (sequence of statements).
| PARAMETER | DESCRIPTION |
|---|---|
statements
|
The module's code, in source order.
TYPE:
|
tests
|
Its
TYPE:
|
experiments
|
Its
TYPE:
|
ImportDecl
didactic-model
¶
ImportDecl(*, path: str, alias: str | None = None, items: tuple[str, ...] | None = None, hidden: tuple[str, ...] = (), reexport: bool = False, docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['import_decl'] = 'import_decl')
Bases: Statement
import a.b [as L] [(x, y) | hiding (z)].
| ATTRIBUTE | DESCRIPTION |
|---|---|
path |
The dotted module path.
TYPE:
|
alias |
The name the module is reachable under, when
TYPE:
|
items |
The selected names, or
TYPE:
|
hidden |
The names
TYPE:
|
reexport |
Whether
TYPE:
|
docs |
Doc-comment lines.
TYPE:
|
line, col |
The location of the
TYPE:
|
OpenDecl
didactic-model
¶
OpenDecl(*, module: str, items: tuple[str, ...] | None = None, hidden: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['open_decl'] = 'open_decl')
Bases: Statement
open L [(x, y) | hiding (z)].
| ATTRIBUTE | DESCRIPTION |
|---|---|
module |
The opened module's alias or path.
TYPE:
|
items |
The selected names, or
TYPE:
|
hidden |
The names
TYPE:
|
line, col |
The location of the
TYPE:
|
DeductionSpec
didactic-model
¶
DeductionSpec(*, name: str, domain: ObjectExpr, codomain: ObjectExpr, docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['deduction_spec'] = 'deduction_spec')
Bases: Statement
deduction G : A -> B without a body.
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
The deduction's name.
TYPE:
|
domain, codomain |
Its header objects.
TYPE:
|
docs |
Doc-comment lines.
TYPE:
|
line, col |
The location of the declaration.
TYPE:
|
ImplicitDecl
didactic-model
¶
ImplicitDecl(*, declaration: ModuleDecl, line: int = 0, col: int = 0, kind: Literal['implicit_decl'] = 'implicit_decl')
Bases: Statement
implicit module ...: a module offered to implicit parameters.
| ATTRIBUTE | DESCRIPTION |
|---|---|
declaration |
The module.
TYPE:
|
line, col |
The location of
TYPE:
|
ModuleApplication
didactic-model
¶
ModuleApplication(*, functor: str, arguments: tuple[ModuleExpr, ...] = (), line: int = 0, col: int = 0, kind: Literal['module_application'] = 'module_application')
Bases: ModuleExpr
A functor applied to module arguments.
| ATTRIBUTE | DESCRIPTION |
|---|---|
functor |
The functor's path as written.
TYPE:
|
arguments |
The arguments, in parameter order.
TYPE:
|
line, col |
Its location.
TYPE:
|
ModuleDecl
didactic-model
¶
ModuleDecl(*, name: str, parameters: tuple[ModuleParameter, ...] = (), signature: SignatureExpr | None = None, sealed: bool = False, definition: ModuleExpr | None = None, body: tuple[Statement, ...] = (), docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['module_decl'] = 'module_decl')
Bases: Statement
module M[(params)] [: S | :> S] with a body or = E.
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
The module's name.
TYPE:
|
parameters |
The functor parameters (empty for a structure or a binding).
TYPE:
|
signature |
The ascribed signature, if any.
TYPE:
|
sealed |
Whether the ascription seals (
TYPE:
|
definition |
The bound module expression, for the
TYPE:
|
body |
The body's statements, for a structure or a functor.
TYPE:
|
docs |
Doc-comment lines.
TYPE:
|
line, col |
The location of the declaration.
TYPE:
|
ModuleExpr
didactic-model
¶
Bases: TaggedUnion
A module expression: a path, an application, or a sealing.
ModuleParameter
didactic-model
¶
ModuleParameter(*, name: str, signature: SignatureExpr, implicit: bool = False, line: int = 0, col: int = 0)
Bases: Model
One parameter of a functor or of a computation.
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
The parameter's name.
TYPE:
|
signature |
The signature its arguments must match.
TYPE:
|
implicit |
Whether calls leave the argument to instance resolution
(
TYPE:
|
line, col |
Its location.
TYPE:
|
ModulePath
didactic-model
¶
Bases: ModuleExpr
A module named by a path (an import, a declared module, a parameter).
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
The path as written.
TYPE:
|
line, col |
Its location.
TYPE:
|
ModuleSeal
didactic-model
¶
ModuleSeal(*, module: ModuleExpr, signature: SignatureExpr, line: int = 0, col: int = 0, kind: Literal['module_seal'] = 'module_seal')
Bases: ModuleExpr
M :> S: a module sealed by a signature.
| ATTRIBUTE | DESCRIPTION |
|---|---|
module |
The sealed module.
TYPE:
|
signature |
The signature it is sealed by.
TYPE:
|
line, col |
Its location.
TYPE:
|
QiecComputationSpec
didactic-model
¶
QiecComputationSpec(*, name: str, binders: tuple[QiecBinder, ...] = (), parameters: tuple[QiecValueParameter, ...] = (), result_type: QiecTypeExpr, effects: QiecEffectRow, docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['computation_spec'] = 'computation_spec')
Bases: Statement
define f[binders](params) : T !{row} without a body.
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
The computation's name.
TYPE:
|
binders |
The static telescope.
TYPE:
|
parameters |
The value parameters.
TYPE:
|
result_type |
The result type.
TYPE:
|
effects |
The effect row.
TYPE:
|
docs |
Doc-comment lines.
TYPE:
|
line, col |
The location of the declaration.
TYPE:
|
QiecFamilySpec
didactic-model
¶
QiecFamilySpec(*, name: str, parameters: tuple[QiecBinder, ...] = (), indices: tuple[QiecIndexBinder, ...] = (), result_kind: QiecKindExpr, definition: QiecTypeExpr | None = None, docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['family_spec'] = 'family_spec')
Bases: Statement
family T[params](indices) : Type [= U], a family without constructors.
Inside a signature it specifies an abstract family, or, with = U,
a manifest one. In a module, the = U form declares T a name for
the type U.
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
The family's name.
TYPE:
|
parameters |
Its static parameters.
TYPE:
|
indices |
Its refinable indices.
TYPE:
|
result_kind |
Its kind.
TYPE:
|
definition |
The type it equals, when manifest.
TYPE:
|
docs |
Doc-comment lines.
TYPE:
|
line, col |
The location of the declaration.
TYPE:
|
SharingConstraint
didactic-model
¶
SharingConstraint(*, name: str, type_expr: QiecTypeExpr, line: int = 0, col: int = 0)
Bases: Model
with family T = U: an abstract family of a signature made manifest.
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
The family item of the refined signature.
TYPE:
|
type_expr |
The type it equals.
TYPE:
|
line, col |
The location of the constraint.
TYPE:
|
SignatureDecl
didactic-model
¶
SignatureDecl(*, name: str, items: tuple[Statement, ...] = (), definition: SignatureExpr | None = None, equations: tuple[EquationDecl, ...] = (), docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['signature_decl'] = 'signature_decl')
Bases: Statement
signature S with items, or signature S = T with ....
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
The signature's name.
TYPE:
|
items |
Its items, in order.
TYPE:
|
definition |
The refined signature it abbreviates, for the
TYPE:
|
equations |
The laws of its
TYPE:
|
docs |
Doc-comment lines.
TYPE:
|
line, col |
The location of the declaration.
TYPE:
|
SignatureExpr
didactic-model
¶
SignatureExpr(*, base: str, constraints: tuple[SharingConstraint, ...] = (), line: int = 0, col: int = 0)
Bases: Model
A signature reference refined by sharing constraints.
| ATTRIBUTE | DESCRIPTION |
|---|---|
base |
The signature's name, as name resolution reads it.
TYPE:
|
constraints |
The
TYPE:
|
line, col |
The location of the reference.
TYPE:
|
HoleDecl
didactic-model
¶
HoleDecl(*, path: str, signature: str, docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['hole_decl'] = 'hole_decl')
Bases: Statement
hole P : S.
| ATTRIBUTE | DESCRIPTION |
|---|---|
path |
The dotted module path the hole occupies.
TYPE:
|
signature |
The signature the hole is checked against, as written.
TYPE:
|
docs |
Doc-comment lines.
TYPE:
|
line, col |
The location of the statement.
TYPE:
|
LinkDecl
didactic-model
¶
LinkDecl(*, hole: str, module: str, docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['link_decl'] = 'link_decl')
Bases: Statement
link P = M.
| ATTRIBUTE | DESCRIPTION |
|---|---|
hole |
The dotted path of the hole filled.
TYPE:
|
module |
The dotted path of the module that fills it.
TYPE:
|
docs |
Doc-comment lines.
TYPE:
|
line, col |
The location of the statement.
TYPE:
|
ShareDecl
didactic-model
¶
ShareDecl(*, site: str, target: str, docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['share_decl'] = 'share_decl')
Bases: Statement
share x with y.
| ATTRIBUTE | DESCRIPTION |
|---|---|
site |
The path whose sites and parameters are tied, as resolved.
TYPE:
|
target |
The path they are tied to, as resolved.
TYPE:
|
docs |
Doc-comment lines.
TYPE:
|
line, col |
The location of the statement.
TYPE:
|
BindStep
didactic-model
¶
BindStep(*, vars: tuple[str, ...], morphism: str, args: tuple[DrawArg, ...] | None = None, index: ObjectExpr | None = None, mode: Literal['sample', 'score', 'marginal'] = 'sample', scope: tuple[ProgramStep, ...] | None = None, axes: AxisSpec | None = None, over: str | None = None, over_objs: tuple[str, ...] | None = None, via: str | None = None, via_axes: tuple[str, ...] | None = None, reduction: str | None = None, weights: str | float | None = None, event: ObservationEvent | None = None, bindings: tuple[ApplyBinding, ...] = (), line: int = 0, col: int = 0, kind: Literal['bind_step'] = 'bind_step')
Bases: ProgramStep
Internal compiler IR: a unified Kleisli bind.
Synthesized from surface SampleStep / ObserveStep
/ MarginalizeStep during template instantiation. The
surface AST never carries this shape directly.
CallStep
didactic-model
¶
CallStep(*, name: str, call: QiecCallComputation, bindings: tuple[ApplyBinding, ...] = (), forwards_inputs: bool = False, line: int = 0, col: int = 0, kind: Literal['call_step'] = 'call_step')
Bases: ProgramStep
let name <- computation(args) [bindings] binding step.
The bound name takes the result of a named computation declared in the module; the computation's effects join the program's row. A call of a program supplies its leading parameters as arguments and binds the program's remaining data inputs, its input labels, in the bracket block; the program's observations and the parameters of the morphisms it draws from, which the module names, are this program's under the same names.
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
The name bound to the result.
TYPE:
|
call |
The call.
TYPE:
|
bindings |
The bindings of the called program's input labels.
TYPE:
|
forwards_inputs |
Whether every input of the called program the arguments leave unsupplied is an input of this program under its own label. Only the step program a scan generates around its cell forwards its inputs, its own input labels being the cell's; no source spelling sets it.
TYPE:
|
line |
The 1-based source line, or 0 when unknown.
TYPE:
|
col |
The 0-based source column, or 0 when unknown.
TYPE:
|
kind |
The variant tag.
TYPE:
|
DrawArg
didactic-model
¶
Bases: TaggedUnion
A single argument in a draw step. Variants cover all four surface shapes the parser can produce: bare identifier (variable reference), numeric literal, distribution-call expression (compositional measure algebra), and list of args.
Sum-type representation rather than a Python union so the panproto translation can carry the AST through the grammar walker, the migration lens, and the pretty-printer uniformly.
DrawArgDist
didactic-model
¶
DrawArgDist(*, family: str, args: tuple[DrawArg, ...], line: int = 0, col: int = 0, kind: Literal['dist'] = 'dist')
Bases: DrawArg
Nested Family(...) call inside the args of a draw step.
Surfaces the compositional measure algebra (Mixture,
Restrict, Pushforward, PointMass, ...) so distributions
can be expressed as ordinary draw-arg expressions:
observe y <- Mixture([0.3, 0.7], [PointMass(0), Poisson(rate)])
The compiler recurses into args to build the inner measure
before passing it to the outer family's builder.
DrawArgIndex
didactic-model
¶
DrawArgIndex(*, name: str, indices: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['index'] = 'index')
Bases: DrawArg
Bracket-indexed reference in a draw step. name is the base
tensor identifier; indices is the tuple of index-tensor
identifiers referenced inside the brackets (typically length
one, e.g. theta[N]). Both the base name and every index
identifier count as dependencies for plate-graph edge emission.
DrawArgList
didactic-model
¶
DrawArgList(*, items: tuple[DrawArg, ...], line: int = 0, col: int = 0, kind: Literal['list'] = 'list')
Bases: DrawArg
List-of-draw-args, e.g. [0.3, 0.7] for mixture weights or
[PointMass(0), Poisson(rate)] for mixture components. The
compiler unpacks the list into a vector or list of inner
distributions depending on the consuming family's argument
schema.
DrawArgName
didactic-model
¶
Bases: DrawArg
Bare identifier reference in a draw step. Carries only the
identifier text; bracket-indexed forms (theta[N]) parse to
the dedicated DrawArgIndex
variant.
DrawArgNamed
didactic-model
¶
DrawArgNamed(*, parameter: str, value: DrawArg, line: int = 0, col: int = 0, kind: Literal['named'] = 'named')
Bases: DrawArg
One keyword argument in a distribution-family construction.
The parameter name is structural: it wraps the argument value instead of being optional metadata on that value. Rewriters must therefore preserve or deliberately transform the complete named entry, and cannot accidentally erase a parameterization while rebuilding its value.
DrawArgScalar
didactic-model
¶
DrawStep
didactic-model
¶
DrawStep(*, vars: tuple[str, ...], morphism: str, args: tuple[DrawArg, ...] | None = None, is_observed: bool = False, axes: AxisSpec | None = None, weights: str | float | None = None, event: ObservationEvent | None = None, bindings: tuple[ApplyBinding, ...] = (), line: int = 0, col: int = 0, kind: Literal['draw_step'] = 'draw_step')
Bases: ProgramStep
Internal compiler IR: a scalar sample or score step.
Synthesised from a SampleStep/ObserveStep with
no index annotation; is_observed distinguishes sample
(False) from score (True). A draw from a program keeps
its bindings of the program's input labels.
GroupedBodyObserveStep
didactic-model
¶
GroupedBodyObserveStep(*, response_var: str, morphism: str, args: tuple[DrawArg, ...] | None = None, index_set: ObjectExpr | None = None, index_var: str = '', latent_name: str = '', class_size: int = 0, index_map_var: str | None = None, index_map_axes: tuple[str, ...] | None = None, ll_slot: str = '', weights: str | float | None = None, event: ObservationEvent | None = None, line: int = 0, col: int = 0, kind: Literal['grouped_body_observe_step'] = 'grouped_body_observe_step')
GroupedLatentInitStep
didactic-model
¶
GroupedLatentInitStep(*, latent_name: str, class_size: int, line: int = 0, col: int = 0, kind: Literal['grouped_latent_init_step'] = 'grouped_latent_init_step')
Bases: ProgramStep
Internal compiler IR: initialise the latent's env slot to
torch.arange(class_size) at the start of a grouped
marginalize block's body.
GroupedMarginalizeStep
didactic-model
¶
GroupedMarginalizeStep(*, var_name: str, class_size: int, probs_var: str | None = None, probs_indices: tuple[str, ...] = (), parameterization: Literal['probs', 'logits'] = 'probs', over_obj: str | None = None, over_objs: tuple[str, ...] | None = None, body_ll_var: str = '', body_observes: tuple[GroupedObserveEntry, ...] | None = None, reduction: str | None = None, line: int = 0, col: int = 0, kind: Literal['grouped_marginalize_step'] = 'grouped_marginalize_step')
Bases: ProgramStep
Internal compiler IR: a marginalisation pushforward.
The compiler lowers a surface MarginalizeStep into this
shape after expanding the scope. class_size is the resolved
cardinality of the latent index; probs_var names the env
slot holding the family's probability or logits tensor, which
probs_indices gather rows of, left to right, when the prior is
written probs[latent] against an enclosing latent;
parameterization records whether that tensor is probabilities or
logits; over_obj
/ over_objs carry the grouping object (single or product);
body_ll_var names the env slot that the grouped observe
pushed its (N_m, K) log-likelihood into; body_observes lists
the (ll_slot, index map) entries that the runtime callable
consumes for grouped pushforward.
GroupedObserveEntry
didactic-model
¶
GroupedObserveEntry(*, ll_slot: str, index_map_var: str | None = None, index_map_axes: tuple[str, ...] | None = None, inner_groups: tuple[str, ...] | None = None, line: int = 0, col: int = 0)
Bases: Model
One entry in a GroupedMarginalizeStep's
body_observes list.
Pairs an env slot (where the captured observe writes its
(N_m, K) log-likelihood) with the index map that carries
those rows into the shared grouping plate. An entry with no
index map is a nested grouped block: the slot holds the inner
block's per-position aggregates over inner_groups, which the
enclosing block projects onto its own grouping plate.
LetStep
didactic-model
¶
LetStep(*, name: str, value: LetExprNode, line: int = 0, col: int = 0, kind: Literal['let_step'] = 'let_step')
Bases: ProgramStep
let name = value deterministic step.
The value is a let-arithmetic expression evaluated against the surrounding program env.
MarginalizeStep
didactic-model
¶
MarginalizeStep(*, var: str, morphism: str, args: tuple[DrawArg, ...] | None = None, static_args: tuple[DrawArg, ...] = (), index: ObjectExpr | None = None, over: str | None = None, over_objs: tuple[str, ...] | None = None, reduction: str | None = None, options: tuple[OptionEntry, ...] = (), scope: tuple[ProgramStep, ...] = (), line: int = 0, col: int = 0, kind: Literal['marginalize_step'] = 'marginalize_step')
Bases: ProgramStep
marginalize var[: index] <- morphism(args) [options] : scope.
Introduces a coordinate, executes the scope's steps with that
coordinate in trace context, and at the end of the scope pushes
forward through the projection (logsumexp for discrete, fibrewise
integration for continuous). When the option block carries
over=..., the reduction is grouped (grouped marginalize); the
via clause on each inner observe names the per-observe
index map.
ObserveStep
didactic-model
¶
ObserveStep(*, vars: tuple[str, ...], morphism: str, args: tuple[DrawArg, ...] | None = None, static_args: tuple[DrawArg, ...] = (), index: ObjectExpr | None = None, axes: AxisSpec | None = None, via: str | None = None, via_axes: tuple[str, ...] | None = None, options: tuple[OptionEntry, ...] = (), morphism_is_module_bound: bool = False, line: int = 0, col: int = 0, kind: Literal['observe_step'] = 'observe_step')
Bases: ProgramStep
observe vars[: index] <- morphism(args) [options].
Scored Kleisli bind; the bound coordinate is clamped at runtime
by the observations dict, making the resulting kernel
sub-probabilistic. vars shares the pattern shape with
SampleStep (a bare name or a parenthesized tuple); the compiler
validates arity against the morphism's codomain.
A leaf resolved by the recipe expander names a module binding and
is independent of the enclosing program's morphism formals.
PlateDrawStep
didactic-model
¶
PlateDrawStep(*, name: str, index: ObjectExpr, codomain: ObjectExpr, morphism: str, args: tuple[DrawArg, ...] | None = None, axes: AxisSpec | None = None, line: int = 0, col: int = 0, kind: Literal['plate_draw_step'] = 'plate_draw_step')
Bases: ProgramStep
Internal compiler IR: an A-indexed sample step.
Synthesised from a SampleStep with an index annotation;
realises a Kern-morphism A -> Kern(K) as a tensor of shape
(|A|, *K.shape).
ReturnStep
didactic-model
¶
ReturnStep(*, vars: tuple[str, ...], labels: tuple[str, ...] | None = None, line: int = 0, col: int = 0, kind: Literal['return_step'] = 'return_step')
Bases: ProgramStep
return v or return (a, b) or return (a: x, b: y) step.
Always the terminal step of a program body. labels is
non-None for the labelled-tuple form return (a: x, b: y).
SampleStep
didactic-model
¶
SampleStep(*, vars: tuple[str, ...], morphism: str, operation: Literal['sample', 'program', 'apply'] = 'sample', args: tuple[DrawArg, ...] | None = None, static_args: tuple[DrawArg, ...] = (), index: ObjectExpr | None = None, axes: AxisSpec | None = None, options: tuple[OptionEntry, ...] = (), bindings: tuple[ApplyBinding, ...] = (), morphism_is_module_bound: bool = False, line: int = 0, col: int = 0, kind: Literal['sample_step'] = 'sample_step')
Bases: ProgramStep
A model bind with an explicit draw, template, or recipe operation.
The optional index and axis options constrain the model's plate.
A template may destructure its return and may take static arguments.
A leaf resolved by the recipe expander names a module binding and
is independent of the enclosing program's morphism formals. The
bracket block of an apply step and of a draw from a program
holds ApplyBinding entries, which supply the input labels of the
applied definition or of the program, in place of options.
ScoreStep
didactic-model
¶
ScoreStep(*, name: str, value: LetExprNode, line: int = 0, col: int = 0, kind: Literal['score_step'] = 'score_step')
Bases: ProgramStep
score name = value log-density factor step.
Like LetStep in that name is bound to the evaluated
expression's value for downstream reference, but distinct in
that the value is additionally added to the program's
log_joint. This is the deduction-style analog of
ObserveStep: the chart's goal_weight is a
log-density factor on the corpus, and score log_Z = chart.goal_weight()
expresses that contribution as a first-class step.
VectorisedObserveStep
didactic-model
¶
VectorisedObserveStep(*, index_var: str, index_set: ObjectExpr, morphism: str, args: tuple[DrawArg, ...] | None = None, response_var: str = '', index_map_var: str | None = None, index_map_axes: tuple[str, ...] | None = None, axes: AxisSpec | None = None, weights: str | float | None = None, event: ObservationEvent | None = None, line: int = 0, col: int = 0, kind: Literal['vectorized_observe_step'] = 'vectorized_observe_step')
Bases: ProgramStep
Internal compiler IR: an A-indexed score step.
Synthesised from an ObserveStep with an index
annotation; denotes the sub-probabilistic kernel
Phi -> Kern_{<=1}(Phi) with score
prod_n p_F(r_obs(n); theta(n, phi)).
ApplyBinding
didactic-model
¶
ApplyBinding(*, label: str, value: LetExprNode, line: int = 0, col: int = 0)
Bases: Model
One binding label = value of a step's bracket block.
The label is an input label of what the step runs. For an apply
step it is a free data name that one of the applied definition's
scan cells reads, or the name a scan's init= gives its initial
state; for a draw from a program (let x <- program p(a) [...])
or a call of one (let y <- p(a) [...]) it is a data input of the
program: a free name its steps read, an index map it reads, or a
declared value parameter the arguments leave unsupplied. The value
is resolved in the calling program's scope where the step is
written: a name bound by an earlier step, else a data input of the
calling program, or a numeric literal. The pun [label] binds the
label to the name spelled like it.
| PARAMETER | DESCRIPTION |
|---|---|
label
|
The input label of the applied definition or the program.
TYPE:
|
value
|
The bound value: a
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
DerivingDecl
didactic-model
¶
DerivingDecl(*, classes: tuple[DerivingClass, ...], family: str, shown: str = '', docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['deriving_decl'] = 'deriving_decl')
Bases: Statement
deriving (CLASSES) for FAMILY: derive classes for a named family.
The family may be one a declaration generates, such as a deduction's item family.
| PARAMETER | DESCRIPTION |
|---|---|
classes
|
The classes, in order.
TYPE:
|
family
|
The family's name.
TYPE:
|
shown
|
How diagnostics name the family when it is generated under a name
people do not write, such as a deduction signature's item family
at one sort instantiation (
TYPE:
|
docs
|
The doc comment lines attached to the declaration.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
MetaDecl
didactic-model
¶
MetaDecl(*, declaration: QiecComputationDecl | QiecFamilyDecl | QiecIndexDecl | ImportDecl, line: int = 0, col: int = 0, kind: Literal['meta_decl'] = 'meta_decl')
Bases: Statement
meta DECLARATION: a declaration that exists in the meta phase only.
| PARAMETER | DESCRIPTION |
|---|---|
declaration
|
The computation, family, or index sort declared for the meta phase,
or the import (
TYPE:
|
line
|
The 1-based source line of
TYPE:
|
col
|
The 0-based source column of
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
SpliceDecl
didactic-model
¶
SpliceDecl(*, generator: str, static_arguments: tuple[QiecStaticArgument, ...] = (), arguments: tuple[LetExprNode, ...] = (), line: int = 0, col: int = 0, kind: Literal['splice_decl'] = 'splice_decl')
Bases: Statement
$generator[static](arguments): declarations generated at check time.
| PARAMETER | DESCRIPTION |
|---|---|
generator
|
The meta computation called. It returns one quoted declaration
(
TYPE:
|
static_arguments
|
Its static arguments, in order.
TYPE:
|
arguments
|
Its value arguments, in order; calls of meta computations may occur in them.
TYPE:
|
line
|
The 1-based source line of
TYPE:
|
col
|
The 0-based source column of
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
StaticAssertDecl
didactic-model
¶
StaticAssertDecl(*, condition: LetExprNode, source: str = '', docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['static_assert_decl'] = 'static_assert_decl')
Bases: Statement
static assert VALUE: a Boolean evaluated while the module is checked.
| PARAMETER | DESCRIPTION |
|---|---|
condition
|
The asserted value. Calls of meta computations may occur in it.
TYPE:
|
source
|
The condition's source text, quoted by a failure diagnostic.
TYPE:
|
docs
|
The doc comment lines attached to the assertion.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
NameSpelling
didactic-model
¶
Bases: Model
How the root module writes one name another module declares.
| PARAMETER | DESCRIPTION |
|---|---|
flat
|
The name in the flat program,
TYPE:
|
written
|
The name as the root module writes it: bare when the root imports or opens it unqualified, qualified by the import's alias or path otherwise.
TYPE:
|
NameSpellingsDecl
didactic-model
¶
NameSpellingsDecl(*, entries: tuple[NameSpelling, ...] = (), kind: Literal['name_spellings_decl'] = 'name_spellings_decl')
Bases: Statement
The root module's spelling of the imported names a program prints.
Static interpretation adds it to a flat program whose root imports a
signature, so the generated show of the signature's sorts writes a
constructor as the root module's source writes it.
| PARAMETER | DESCRIPTION |
|---|---|
entries
|
One spelling per imported constructor.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
NotationAntiquote
didactic-model
¶
NotationAntiquote(*, name: str | None = None, value: LetExprNode | None = None, start: int = 0, end: int = 0, line: int = 0, col: int = 0, kind: Literal['notation_antiquote'] = 'notation_antiquote')
Bases: NotationItem
$x or $(e): a value of the host language inside a quotation.
In an expression quotation the antiquoted value is spliced; in a
pattern quotation $x binds x to the matched subterm and $_
matches anything.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The name of
TYPE:
|
value
|
The value of
TYPE:
|
start
|
The byte offset of
TYPE:
|
end
|
The byte offset just past the antiquotation.
TYPE:
|
line
|
The 1-based source line.
TYPE:
|
col
|
The 0-based source column.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
NotationAtom
didactic-model
¶
NotationAtom(*, category: Literal['identifier', 'integer', 'string', 'symbol'], text: str, start: int = 0, end: int = 0, line: int = 0, col: int = 0, kind: Literal['notation_atom'] = 'notation_atom')
Bases: NotationItem
A token of a quotation: a name, an integer, a string, or a symbol run.
| PARAMETER | DESCRIPTION |
|---|---|
category
|
TYPE:
|
text
|
The token as written (a string keeps its quotes).
TYPE:
|
start
|
The token's byte offset in its file, which tells adjacent tokens apart from tokens separated by space.
TYPE:
|
end
|
The byte offset just past the token.
TYPE:
|
line
|
The 1-based source line.
TYPE:
|
col
|
The 0-based source column.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
NotationDecl
didactic-model
¶
NotationDecl(*, name: str, syntax: str, productions: tuple[NotationProduction, ...] = (), relations: tuple[NotationRelation, ...] = (), docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['notation_decl'] = 'notation_decl')
Bases: Statement
notation NAME for SYNTAX: mixfix productions over a signature.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The notation's name.
TYPE:
|
syntax
|
The binding signature its templates are terms of.
TYPE:
|
productions
|
The productions, in declaration order.
TYPE:
|
relations
|
The precedence relations.
TYPE:
|
docs
|
The doc comment lines.
TYPE:
|
line
|
The 1-based source line.
TYPE:
|
col
|
The 0-based source column.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
NotationGroup
didactic-model
¶
NotationGroup(*, opener: Literal['(', '[', '{'], items: tuple[NotationItem, ...] = (), start: int = 0, end: int = 0, line: int = 0, col: int = 0, kind: Literal['notation_group'] = 'notation_group')
Bases: NotationItem
A bracketed group of a quotation's token tree.
| PARAMETER | DESCRIPTION |
|---|---|
opener
|
TYPE:
|
items
|
The items between the brackets.
TYPE:
|
start
|
The byte offset of the opening bracket.
TYPE:
|
end
|
The byte offset just past the closing bracket.
TYPE:
|
line
|
The 1-based source line.
TYPE:
|
col
|
The 0-based source column.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
NotationItem
didactic-model
¶
Bases: TaggedUnion
One item of a quotation's token tree.
NotationPatternItem
didactic-model
¶
NotationPatternItem(*, token: str | None = None, hole: str | None = None, line: int = 0, col: int = 0)
Bases: Model
One item of a production's shape: a quoted token or a hole.
| PARAMETER | DESCRIPTION |
|---|---|
token
|
The token's text as written between the quotes (leading and
trailing spaces are printing space), or
TYPE:
|
hole
|
The hole's name, or
TYPE:
|
line
|
The 1-based source line.
TYPE:
|
col
|
The 0-based source column.
TYPE:
|
NotationProduction
didactic-model
¶
NotationProduction(*, name: str, items: tuple[NotationPatternItem, ...], template: PatternSyntax, options: tuple[OptionEntry, ...] = (), line: int = 0, col: int = 0)
Bases: Model
name : shape [options] => template: one mixfix production.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The production's name, unique in its notation.
TYPE:
|
items
|
The shape: quoted tokens and holes, in order.
TYPE:
|
template
|
The term the production stands for, over the holes.
TYPE:
|
options
|
The option block (
TYPE:
|
line
|
The 1-based source line.
TYPE:
|
col
|
The 0-based source column.
TYPE:
|
NotationRelation
didactic-model
¶
NotationRelation(*, left: str, relation: Literal['>', '='], right: str, line: int = 0, col: int = 0)
Bases: Model
a > b (a binds tighter) or a = b (one precedence level).
| PARAMETER | DESCRIPTION |
|---|---|
left
|
The left production, possibly qualified by its notation.
TYPE:
|
relation
|
TYPE:
|
right
|
The right production.
TYPE:
|
line
|
The 1-based source line.
TYPE:
|
col
|
The 0-based source column.
TYPE:
|
OpenNotationDecl
didactic-model
¶
OpenNotationDecl(*, target: str, notations: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['open_notation_decl'] = 'open_notation_decl')
Bases: Statement
open notation X: activate notations for the rest of the module.
| PARAMETER | DESCRIPTION |
|---|---|
target
|
A notation declaration (bare or qualified by an import) or a module whose exported notations all become active, as written.
TYPE:
|
notations
|
The flat names of the notations it activates, filled in when the module is resolved.
TYPE:
|
line
|
The 1-based source line.
TYPE:
|
col
|
The 0-based source column.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
QiecQuotation
didactic-model
¶
QiecQuotation(*, items: tuple[NotationItem, ...] = (), notations: tuple[str, ...] = (), scoped: bool = False, source: str = '', start: int = 0, line: int = 0, col: int = 0, kind: Literal['qiec_quotation'] = 'qiec_quotation')
Bases: LetExprNode
[| ... |] in a value position: a term written in active notation.
| PARAMETER | DESCRIPTION |
|---|---|
items
|
The token tree.
TYPE:
|
notations
|
The flat names of the notations active where the quotation stands,
in activation order; filled in when the module's
TYPE:
|
scoped
|
Whether
TYPE:
|
source
|
The quotation's source text, for diagnostics and hover.
TYPE:
|
start
|
The byte offset of
TYPE:
|
line
|
The 1-based source line.
TYPE:
|
col
|
The 0-based source column.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
QiecQuotationPattern
didactic-model
¶
QiecQuotationPattern(*, items: tuple[NotationItem, ...] = (), notations: tuple[str, ...] = (), scoped: bool = False, source: str = '', start: int = 0, line: int = 0, col: int = 0, kind: Literal['qiec_quotation_pattern'] = 'qiec_quotation_pattern')
Bases: QiecPattern
[| ... |] in a pattern position.
| PARAMETER | DESCRIPTION |
|---|---|
items
|
The token tree.
TYPE:
|
notations
|
The flat names of the active notations, as for
TYPE:
|
scoped
|
Whether
TYPE:
|
source
|
The quotation's source text.
TYPE:
|
start
|
The byte offset of
TYPE:
|
line
|
The 1-based source line.
TYPE:
|
col
|
The 0-based source column.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
DerivingClass
didactic-model
¶
DerivingClass(*, name: str, static_arguments: tuple[QiecStaticArgument, ...] = (), morphisms: tuple[str, ...] = (), line: int = 0, col: int = 0)
Bases: Model
One class of a deriving (...) clause, as in Quote[Term via q].
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The class, which names the meta computation that handles it.
TYPE:
|
static_arguments
|
The static arguments written in brackets before
TYPE:
|
morphisms
|
The meta computations named after
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
QiecBindComputation
didactic-model
¶
QiecBindComputation(*, binder: QiecLocalBinding, first: QiecComputation, then: QiecComputation, line: int = 0, col: int = 0, kind: Literal['qiec_bind_computation'] = 'qiec_bind_computation')
Bases: QiecComputation
let x <- FIRST followed by a computation reading x.
| PARAMETER | DESCRIPTION |
|---|---|
binder
|
The local the first computation's result is bound to.
TYPE:
|
first
|
The computation run first.
TYPE:
|
then
|
The computation the binding scopes over.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
QiecBinder
didactic-model
¶
Bases: TaggedUnion
One entry in a heterogeneous static telescope.
QiecCaseBranch
didactic-model
¶
QiecCaseBranch(*, pattern: QiecPattern, guard: QiecValue | None = None, body: QiecComputation, line: int = 0, col: int = 0)
Bases: Model
One branch of a case analysis: a pattern, a guard, and a body.
| PARAMETER | DESCRIPTION |
|---|---|
pattern
|
The pattern the scrutinee is matched against.
TYPE:
|
guard
|
A pure Boolean value the branch also requires, or
TYPE:
|
body
|
The branch body.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
QiecCaseComputation
didactic-model
¶
QiecCaseComputation(*, scrutinee: QiecValue, motive: QiecCaseMotive | None = None, branches: tuple[QiecCaseBranch, ...], line: int = 0, col: int = 0, kind: Literal['qiec_case_computation'] = 'qiec_case_computation')
Bases: QiecComputation
Case analysis over an indexed family value.
| PARAMETER | DESCRIPTION |
|---|---|
scrutinee
|
The value analysed.
TYPE:
|
motive
|
The motive the branches are checked against, or
TYPE:
|
branches
|
The branches, in order; the first whose pattern and guard match is taken.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
QiecIfComputation
didactic-model
¶
QiecIfComputation(*, condition: QiecValue, then: QiecComputation, otherwise: QiecComputation, line: int = 0, col: int = 0, kind: Literal['qiec_if_computation'] = 'qiec_if_computation')
Bases: QiecComputation
if COND then ... else ..., branching on a Boolean value.
| PARAMETER | DESCRIPTION |
|---|---|
condition
|
The Boolean value branched on.
TYPE:
|
then
|
The computation run when the condition holds.
TYPE:
|
otherwise
|
The computation run when it does not.
TYPE:
|
line
|
The 1-based source line.
TYPE:
|
col
|
The 0-based source column.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
QiecCaseMotive
didactic-model
¶
QiecCaseMotive(*, indices: tuple[QiecIndexBinder, ...], result_type: QiecTypeExpr, line: int = 0, col: int = 0)
Bases: Model
The motive of a case analysis: the indices it abstracts and the result type they determine.
| PARAMETER | DESCRIPTION |
|---|---|
indices
|
The index binders the motive abstracts over.
TYPE:
|
result_type
|
The result type under those binders.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
QiecComputation
didactic-model
¶
Bases: TaggedUnion
A computation in the QIEC fine-grain call-by-value surface.
QiecComputationDecl
didactic-model
¶
QiecComputationDecl(*, name: str, binders: tuple[QiecBinder, ...] = (), parameters: tuple[QiecValueParameter, ...] = (), result_type: QiecTypeExpr, effects: QiecEffectRow, body: QiecComputation, docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['computation_decl'] = 'computation_decl', locals: tuple[QiecComputationDecl, ...] = (), module_parameters: tuple[QiecModuleBinder, ...] = ())
Bases: Statement
define NAME[binders](params) : TYPE !ROW = BODY, a named computation.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The computation's name.
TYPE:
|
binders
|
The static telescope.
TYPE:
|
parameters
|
The value parameters.
TYPE:
|
result_type
|
The declared result type.
TYPE:
|
effects
|
The declared effect row.
TYPE:
|
body
|
The body.
TYPE:
|
docs
|
The doc comment lines attached to the declaration.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
locals
|
The local definitions of its
TYPE:
|
module_parameters
|
Its module parameters (
TYPE:
|
QiecInterpretationClause
didactic-model
¶
QiecInterpretationClause(*, constructor_kind: Literal['rule', 'axiom'], constructor: str, operation: str, line: int = 0, col: int = 0)
Bases: Model
A computation assigned to one rule or axiom slot.
| PARAMETER | DESCRIPTION |
|---|---|
constructor_kind
|
Whether the constructor is a rule or an input axiom slot.
TYPE:
|
constructor
|
The constructor's name in its deduction.
TYPE:
|
operation
|
The name of the checked computation that interprets it.
TYPE:
|
line
|
The source position.
TYPE:
|
col
|
The source position.
TYPE:
|
QiecInterpretationDecl
didactic-model
¶
QiecInterpretationDecl(*, name: str, deduction: str, carrier: QiecTypeExpr, clauses: tuple[QiecInterpretationClause, ...], options: tuple[OptionEntry, ...] = (), docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['interpretation_decl'] = 'interpretation_decl')
Bases: Statement
A named computation that folds a checked deduction or structural proof.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The computation's name.
TYPE:
|
deduction
|
The deduction or structural signature whose proof family it consumes.
TYPE:
|
carrier
|
The closed result type of the fold.
TYPE:
|
clauses
|
One computation assignment per rule or axiom slot.
TYPE:
|
options
|
Structural permissions or the index map used by the interpretation.
TYPE:
|
docs
|
The attached doc comments.
TYPE:
|
line
|
The source position.
TYPE:
|
col
|
The source position.
TYPE:
|
kind
|
The syntax discriminator.
TYPE:
|
QiecRelationArc
didactic-model
¶
Bases: Model
One primitive authored arc, with None denoting an epsilon label.
QiecRelationComposeDecl
didactic-model
¶
QiecRelationComposeDecl(*, name: str, left: str, right: str, docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['relation_compose_decl'] = 'relation_compose_decl')
Bases: Statement
A binary composition of two named authored sparse relations.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The resulting relation name.
TYPE:
|
left
|
The ordered primitive relation operands.
TYPE:
|
right
|
The ordered primitive relation operands.
TYPE:
|
docs
|
The attached source doc comments.
TYPE:
|
line
|
The source position.
TYPE:
|
col
|
The source position.
TYPE:
|
kind
|
The declaration discriminator.
TYPE:
|
QiecRelationDecl
didactic-model
¶
QiecRelationDecl(*, name: str, algebra: Literal['markov', 'logprob'], n_states: int, tapes: tuple[QiecRelationTape, ...], arcs: tuple[QiecRelationArc, ...] = (), initial: tuple[QiecRelationMark, ...] = (), final: tuple[QiecRelationMark, ...] = (), docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['relation_decl'] = 'relation_decl')
Bases: Statement
A finite sparse topology over typed string tapes.
Tape order includes the input and output boundary. Each record in the arc tuple is a distinct occurrence. Identical weight names denote one original scalar parameter across the module.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The authored relation name.
TYPE:
|
algebra
|
The shipped Markov or LogProb scalar algebra.
TYPE:
|
n_states
|
The number of finite control states.
TYPE:
|
tapes
|
Ordered direction and finite alphabet names.
TYPE:
|
arcs
|
Ordered source, target, label tuple, and weight-name records.
TYPE:
|
initial
|
The state and weight-name boundary records.
TYPE:
|
final
|
The state and weight-name boundary records.
TYPE:
|
docs
|
The attached documentation comments.
TYPE:
|
line
|
The source position.
TYPE:
|
col
|
The source position.
TYPE:
|
kind
|
The declaration discriminator.
TYPE:
|
QiecRelationMark
didactic-model
¶
Bases: Model
One initial or final occurrence of a named weight at a state.
QiecRelationTape
didactic-model
¶
Bases: Model
One typed input or output tape of an authored relation.
QiecRelationTransformDecl
didactic-model
¶
QiecRelationTransformDecl(*, name: str, operation: Literal['invert', 'trim', 'closure', 'project', 'condition', 'auto_intersect', 'union', 'concatenate', 'intersect', 'join'], source: str, other: str | None = None, positions: tuple[int, ...] = (), word: tuple[int, ...] | None = None, keep_shared: bool = False, docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['relation_transform_decl'] = 'relation_transform_decl')
Bases: Statement
An authored unary or binary sparse relation transformation.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The resulting relation's name.
TYPE:
|
operation
|
The sparse transformation applied to the source operands.
TYPE:
|
source
|
Named primitive operands in operation order.
TYPE:
|
other
|
Named primitive operands in operation order.
TYPE:
|
positions
|
Original tape positions for projection, conditioning, equality, or join.
TYPE:
|
word
|
The fixed word of a conditioning operation, including empty.
TYPE:
|
keep_shared
|
Whether a join retains the synchronized tape.
TYPE:
|
docs
|
The attached source documentation comments.
TYPE:
|
line
|
The source position.
TYPE:
|
col
|
The source position.
TYPE:
|
kind
|
The declaration discriminator.
TYPE:
|
QiecRelationScoreDecl
didactic-model
¶
QiecRelationScoreDecl(*, name: str, result_type: QiecTypeExpr, operation: Literal['pair_weight', 'conditional_log_prob', 'path_entropy', 'expected_path_cost'], relation: str | None = None, docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['relation_score_decl'] = 'relation_score_decl')
Bases: Statement
A named score whose fixed relation request is supplied at runtime.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The generated computation name.
TYPE:
|
result_type
|
The closed scalar type of the score.
TYPE:
|
operation
|
The relation objective the runtime attachment must implement.
TYPE:
|
relation
|
The optional authored topology required by the score.
TYPE:
|
docs
|
The attached source doc comments.
TYPE:
|
line
|
The source position.
TYPE:
|
col
|
The source position.
TYPE:
|
kind
|
The declaration discriminator.
TYPE:
|
QiecStringGraphDecl
didactic-model
¶
QiecStringGraphDecl(*, name: str, variables: tuple[QiecStringGraphVariable, ...], factors: tuple[QiecStringGraphFactor, ...], docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['string_graph_decl'] = 'string_graph_decl')
Bases: Statement
An ordered declaration of variables and sparse factor occurrences.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The authored graph name.
TYPE:
|
variables
|
Nominally typed variables and their observed words.
TYPE:
|
factors
|
Ordered relation references and their variable scopes.
TYPE:
|
docs
|
Attached documentation comments.
TYPE:
|
line
|
The source position.
TYPE:
|
col
|
The source position.
TYPE:
|
kind
|
The declaration discriminator.
TYPE:
|
QiecStringGraphFactor
didactic-model
¶
Bases: Model
One ordered occurrence of an existing authored sparse relation.
QiecStringGraphVariable
didactic-model
¶
Bases: Model
One nominal string variable with an optional observed word.
QiecStringGraphScoreDecl
didactic-model
¶
QiecStringGraphScoreDecl(*, name: str, result_type: QiecTypeExpr, operation: Literal['tree_partition', 'tree_log_prob'], graph: str | None = None, docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['string_graph_score_decl'] = 'string_graph_score_decl')
QiecConstructorValue
didactic-model
¶
QiecConstructorValue(*, constructor: str, static_arguments: tuple[QiecStaticArgument, ...] = (), fields: tuple[QiecValue, ...] = (), line: int = 0, col: int = 0, kind: Literal['qiec_constructor_value'] = 'qiec_constructor_value')
Bases: LetExprNode
A constructor applied to explicit static arguments, C[..](..).
A constructor applied without static arguments is an ordinary call,
LetExprCall, resolved to the
constructor during elaboration.
| PARAMETER | DESCRIPTION |
|---|---|
constructor
|
The constructor's name, qualified by its family as in
TYPE:
|
static_arguments
|
The family parameters and constructor-local static arguments.
TYPE:
|
fields
|
The field values, in declaration order.
TYPE:
|
line
|
The 1-based source line.
TYPE:
|
col
|
The 0-based source column.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
QiecAnnotatedValue
didactic-model
¶
QiecAnnotatedValue(*, value: QiecValue, type_expr: QiecTypeExpr, line: int = 0, col: int = 0, kind: Literal['qiec_annotated_value'] = 'qiec_annotated_value')
Bases: LetExprNode
A value checked against a stated type, (e : T).
| PARAMETER | DESCRIPTION |
|---|---|
value
|
The value checked.
TYPE:
|
type_expr
|
The type it is checked against.
TYPE:
|
line
|
The 1-based source line.
TYPE:
|
col
|
The 0-based source column.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
QiecPattern
didactic-model
¶
Bases: TaggedUnion
A pattern in a case branch head or a destructuring let.
QiecWildcardPattern
didactic-model
¶
QiecWildcardPattern(*, line: int = 0, col: int = 0, kind: Literal['qiec_wildcard_pattern'] = 'qiec_wildcard_pattern')
Bases: QiecPattern
_, matching any value and binding nothing.
| PARAMETER | DESCRIPTION |
|---|---|
line
|
The 1-based source line.
TYPE:
|
col
|
The 0-based source column.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
QiecNamePattern
didactic-model
¶
QiecNamePattern(*, name: str, type_expr: QiecTypeExpr | None = None, line: int = 0, col: int = 0, kind: Literal['qiec_name_pattern'] = 'qiec_name_pattern')
Bases: QiecPattern
A bare name, x or x : T.
The name is a nullary constructor when the type the pattern is checked against declares one of that name, and a variable binding the matched value otherwise.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The name written.
TYPE:
|
type_expr
|
The annotated type, or
TYPE:
|
line
|
The 1-based source line.
TYPE:
|
col
|
The 0-based source column.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
QiecConstructorPattern
didactic-model
¶
QiecConstructorPattern(*, constructor: str, static_binders: tuple[QiecTypeName, ...] = (), arguments: tuple[QiecPattern, ...] = (), line: int = 0, col: int = 0, kind: Literal['qiec_constructor_pattern'] = 'qiec_constructor_pattern')
Bases: QiecPattern
A constructor applied to sub-patterns, C[k](p, q).
The name also resolves to a pattern synonym when one of that name is declared.
| PARAMETER | DESCRIPTION |
|---|---|
constructor
|
The constructor or pattern synonym named.
TYPE:
|
static_binders
|
The names the constructor's own static telescope binds.
TYPE:
|
arguments
|
The sub-patterns, one per field, in declaration order.
TYPE:
|
line
|
The 1-based source line.
TYPE:
|
col
|
The 0-based source column.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
QiecBinderPattern
didactic-model
¶
QiecBinderPattern(*, binders: tuple[str, ...], body: QiecPattern, line: int = 0, col: int = 0, kind: Literal['qiec_binder_pattern'] = 'qiec_binder_pattern')
Bases: QiecPattern
x y. p, opening a constructor argument that binds variables.
Legal only as a constructor argument whose declaration binds as many variables as there are names.
| PARAMETER | DESCRIPTION |
|---|---|
binders
|
The names given to the bound variables, in binding order.
TYPE:
|
body
|
The pattern the argument's body is matched against.
TYPE:
|
line
|
The 1-based source line.
TYPE:
|
col
|
The 0-based source column.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
QiecLiteralPattern
didactic-model
¶
QiecLiteralPattern(*, value: LetExprNode, line: int = 0, col: int = 0, kind: Literal['qiec_literal_pattern'] = 'qiec_literal_pattern')
Bases: QiecPattern
A literal, 3, -1, "name", true, or unit.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
The literal as an expression node.
TYPE:
|
line
|
The 1-based source line.
TYPE:
|
col
|
The 0-based source column.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
QiecTuplePattern
didactic-model
¶
QiecTuplePattern(*, items: tuple[QiecPattern, ...], line: int = 0, col: int = 0, kind: Literal['qiec_tuple_pattern'] = 'qiec_tuple_pattern')
Bases: QiecPattern
(p, q, ...), matching a product component by component.
| PARAMETER | DESCRIPTION |
|---|---|
items
|
The component patterns, at least two.
TYPE:
|
line
|
The 1-based source line.
TYPE:
|
col
|
The 0-based source column.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
QiecRecordFieldPattern
didactic-model
¶
QiecRecordFieldPattern(*, label: str, pattern: QiecPattern | None = None, line: int = 0, col: int = 0)
Bases: Model
One labelled component of a record pattern.
| PARAMETER | DESCRIPTION |
|---|---|
label
|
The component's label.
TYPE:
|
pattern
|
The component's pattern, or
TYPE:
|
line
|
The 1-based source line.
TYPE:
|
col
|
The 0-based source column.
TYPE:
|
QiecRecordPattern
didactic-model
¶
QiecRecordPattern(*, fields: tuple[QiecRecordFieldPattern, ...] = (), open: bool = False, line: int = 0, col: int = 0, kind: Literal['qiec_record_pattern'] = 'qiec_record_pattern')
Bases: QiecPattern
{l = p, m, ..}, matching labelled components.
| PARAMETER | DESCRIPTION |
|---|---|
fields
|
The labelled component patterns.
TYPE:
|
open
|
Whether a trailing
TYPE:
|
line
|
The 1-based source line.
TYPE:
|
col
|
The 0-based source column.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
QiecOrPattern
didactic-model
¶
QiecOrPattern(*, alternatives: tuple[QiecPattern, ...], line: int = 0, col: int = 0, kind: Literal['qiec_or_pattern'] = 'qiec_or_pattern')
Bases: QiecPattern
p | q, matching when either alternative does.
| PARAMETER | DESCRIPTION |
|---|---|
alternatives
|
The alternatives, in order, at least two.
TYPE:
|
line
|
The 1-based source line.
TYPE:
|
col
|
The 0-based source column.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
QiecAsPattern
didactic-model
¶
QiecAsPattern(*, pattern: QiecPattern, name: str, line: int = 0, col: int = 0, kind: Literal['qiec_as_pattern'] = 'qiec_as_pattern')
Bases: QiecPattern
p as x, matching p and binding the whole value to x.
| PARAMETER | DESCRIPTION |
|---|---|
pattern
|
The pattern matched.
TYPE:
|
name
|
The name bound to the whole value.
TYPE:
|
line
|
The 1-based source line.
TYPE:
|
col
|
The 0-based source column.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
QiecPatternBinding
didactic-model
¶
QiecPatternBinding(*, pattern: QiecPattern, value: QiecValue, then: QiecComputation, line: int = 0, col: int = 0, kind: Literal['qiec_pattern_binding'] = 'qiec_pattern_binding')
Bases: QiecComputation
let p = VALUE, destructuring a pure expression with a pattern.
The pattern must match every value of the expression's type.
| PARAMETER | DESCRIPTION |
|---|---|
pattern
|
The pattern the value is matched against.
TYPE:
|
value
|
The pure expression.
TYPE:
|
then
|
The computation the pattern's names scope over.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
QiecPatternBind
didactic-model
¶
QiecPatternBind(*, pattern: QiecPattern, first: QiecComputation, then: QiecComputation, line: int = 0, col: int = 0, kind: Literal['qiec_pattern_bind'] = 'qiec_pattern_bind')
Bases: QiecComputation
let p <- FIRST, destructuring a computation's result.
The pattern must match every value of the result type.
| PARAMETER | DESCRIPTION |
|---|---|
pattern
|
The pattern the result is matched against.
TYPE:
|
first
|
The computation run first.
TYPE:
|
then
|
The computation the pattern's names scope over.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
QiecPatternSynonymDecl
didactic-model
¶
QiecPatternSynonymDecl(*, name: str, static_binders: tuple[QiecTypeName, ...] = (), parameters: tuple[str, ...] = (), pattern: QiecPattern, docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['pattern_synonym_decl'] = 'pattern_synonym_decl')
Bases: Statement
pattern P[k](x, y) = p, naming a pattern.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The synonym's name.
TYPE:
|
static_binders
|
The static names the definition's constructor patterns bind, exposed to a use's static binders.
TYPE:
|
parameters
|
The value names the definition binds, exposed to a use's sub-patterns, in order.
TYPE:
|
pattern
|
The definition.
TYPE:
|
docs
|
The doc comment lines attached to the declaration.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
QiecEffectBinder
didactic-model
¶
QiecEffectBinder(*, name: str, line: int = 0, col: int = 0, kind: Literal['qiec_effect_binder'] = 'qiec_effect_binder')
Bases: QiecBinder
A telescope binder over effect interfaces.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The binder's name.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
QiecEffectDecl
didactic-model
¶
QiecEffectDecl(*, name: str, binders: tuple[QiecBinder, ...] = (), operations: tuple[QiecOperationDecl, ...] = (), docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['effect_decl'] = 'effect_decl')
Bases: Statement
effect NAME[binders] declaring an operation interface.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The interface's name.
TYPE:
|
binders
|
The interface's static telescope.
TYPE:
|
operations
|
The operations declared.
TYPE:
|
docs
|
The doc comment lines attached to the declaration.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
QiecEffectInstanceDecl
didactic-model
¶
QiecEffectInstanceDecl(*, name: str, effect: QiecEffectRef, docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['effect_instance_decl'] = 'effect_instance_decl')
Bases: Statement
instance NAME : EFFECT, a module-level lexical effect instance.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The instance's name.
TYPE:
|
effect
|
The applied interface the instance carries.
TYPE:
|
docs
|
The doc comment lines attached to the declaration.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
QiecBernoulliCompletionDecl
didactic-model
¶
QiecBernoulliCompletionDecl(*, name: str, computation: str, sites: tuple[str, ...], probabilities: tuple[float, ...], docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['bernoulli_completion_decl'] = 'bernoulli_completion_decl')
Bases: Statement
Declare normalized inactive coordinates of a checked Bernoulli branch.
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
The module-local name of the completion.
TYPE:
|
computation |
The authored computation that owns the selector and two arms.
TYPE:
|
sites |
The two original arm site labels.
TYPE:
|
probabilities |
The corresponding fixed parsed Real probabilities.
TYPE:
|
docs |
The attached doc comments.
TYPE:
|
line, col |
The 1-based source line and 0-based column.
TYPE:
|
kind |
The statement discriminator.
TYPE:
|
QiecEffectLawDecl
didactic-model
¶
QiecEffectLawDecl(*, name: str, instance: str, operations: tuple[str, ...], left: str, right: str, handlers: tuple[str, ...], docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['effect_law_decl'] = 'effect_law_decl', method: Literal['finite', 'polynomial', 'rational'] = 'finite')
Bases: Statement
One authored nominal equation and its exact handler checks.
The equation refers to existing named computations and a concrete effect instance. Each handler listed requests its own exact check.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The equation's name within the nominal effect.
TYPE:
|
instance
|
The instance that scopes both equation sides.
TYPE:
|
operations
|
The interface operations named by the equation.
TYPE:
|
left
|
The names of the open checked computations on the two sides.
TYPE:
|
right
|
The names of the open checked computations on the two sides.
TYPE:
|
handlers
|
The handlers to check independently against the equation. Empty makes the law a local theory of the instance: every handler installed for the instance is checked against it.
TYPE:
|
docs
|
The declaration's doc comments.
TYPE:
|
line
|
The 1-based source line and 0-based column.
TYPE:
|
col
|
The 1-based source line and 0-based column.
TYPE:
|
kind
|
The discriminator, always
TYPE:
|
method
|
The checking method requested for each listed handler.
TYPE:
|
QiecCheckpointDerivativeDecl
didactic-model
¶
QiecCheckpointDerivativeDecl(*, name: str, primal: str, transition: str, docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['checkpoint_derivative_decl'] = 'checkpoint_derivative_decl')
Bases: Statement
A checkpoint request for a named finite scalar iteration.
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
The module-local name of the request.
TYPE:
|
primal, transition |
The iteration and the single computation called at each step.
TYPE:
|
docs |
The attached doc comments.
TYPE:
|
line, col |
The 1-based source line and 0-based column.
TYPE:
|
kind |
The statement discriminator.
TYPE:
|
QiecImplicitDerivativeDecl
didactic-model
¶
QiecImplicitDerivativeDecl(*, name: str, primal: str, residual: str, docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['implicit_derivative_decl'] = 'implicit_derivative_decl')
Bases: Statement
A named claim that a computation solves a scalar residual.
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
The module-local name of the claim.
TYPE:
|
primal, residual |
The computation that returns a root and the residual computation with the root argument in the first position.
TYPE:
|
docs |
The attached doc comments.
TYPE:
|
line, col |
The 1-based source line and 0-based column.
TYPE:
|
kind |
The statement discriminator.
TYPE:
|
QiecRationalDerivativeDecl
didactic-model
¶
QiecRationalDerivativeDecl(*, name: str, primal: str, jvp: str | None = None, vjp: tuple[str, ...] | None = None, docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['rational_derivative_decl'] = 'rational_derivative_decl')
Bases: Statement
A named claim about a closed scalar computation's derivative.
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
The module-local name of the derivative claim.
TYPE:
|
primal |
The authored scalar computation being differentiated.
TYPE:
|
jvp |
The optional forward action's computation name.
TYPE:
|
vjp |
Optional reverse action names in primal parameter order.
TYPE:
|
docs |
The declaration's doc comments.
TYPE:
|
line, col |
The 1-based source line and 0-based column.
TYPE:
|
kind |
The statement discriminator.
TYPE:
|
QiecSiteEstimatorDecl
didactic-model
¶
Bases: Model
An estimator choice for one literal sample site in an authored computation.
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
The module-local name of the assignment.
TYPE:
|
site |
The literal label of the sample request's site value.
TYPE:
|
estimator |
The named method to check on that request.
TYPE:
|
line, col |
The 1-based source line and 0-based column.
TYPE:
|
QiecSiteEstimatorsDecl
didactic-model
¶
QiecSiteEstimatorsDecl(*, computation: str, estimators: tuple[QiecSiteEstimatorDecl, ...], docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['site_estimators_decl'] = 'site_estimators_decl')
QiecScopedOperationDecl
didactic-model
¶
QiecScopedOperationDecl(*, name: str, instance: str, elaborator: str, body_effects: tuple[str, ...], docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['scoped_operation_decl'] = 'scoped_operation_decl')
Bases: Statement
A named static computation argument and its ordinary elaborator.
With empty body_effects the declaration instead elaborates every
request to instance: the instance's operations are higher-order,
and each request is replaced by the elaborator's clause for it.
QiecHandlerInterchangeDecl
didactic-model
¶
QiecHandlerInterchangeDecl(*, name: str, left: str, right: str, docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['handler_interchange_decl'] = 'handler_interchange_decl')
Bases: Statement
One named finite observation of two checked handler installation orders.
The two sides are names of existing QVR computations. The finite interchange checker checks their exact installations and common call.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The source name of the claim within this module.
TYPE:
|
left
|
The two checked wrapper computation names.
TYPE:
|
right
|
The two checked wrapper computation names.
TYPE:
|
docs
|
The declaration's doc comments.
TYPE:
|
line
|
The 1-based source line and 0-based column.
TYPE:
|
col
|
The 1-based source line and 0-based column.
TYPE:
|
kind
|
The discriminator, always
TYPE:
|
QiecEffectKind
didactic-model
¶
QiecEffectKind(*, line: int = 0, col: int = 0, kind: Literal['qiec_effect_kind'] = 'qiec_effect_kind')
Bases: QiecKindExpr
The kind Effect of effect interfaces.
| PARAMETER | DESCRIPTION |
|---|---|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
QiecEffectRef
didactic-model
¶
QiecEffectRef(*, name: str, arguments: tuple[QiecStaticArgument, ...] = (), line: int = 0, col: int = 0)
Bases: Model
An applied effect interface such as State[Int].
QiecEffectRequest
didactic-model
¶
QiecEffectRequest(*, instance: str, operation: str, static_arguments: tuple[QiecStaticArgument, ...] = (), arguments: tuple[QiecValue, ...] = (), line: int = 0, col: int = 0)
Bases: Model
A request of one operation on a lexical effect instance.
| PARAMETER | DESCRIPTION |
|---|---|
instance
|
The instance's name.
TYPE:
|
operation
|
The operation's name.
TYPE:
|
static_arguments
|
The static arguments the operation's telescope takes.
TYPE:
|
arguments
|
The value arguments, in order.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
QiecEffectRow
didactic-model
¶
QiecEffectRow(*, entries: tuple[QiecRowEntry, ...] = (), tail: str | None = None, lacks: tuple[str, ...] = (), line: int = 0, col: int = 0)
Bases: Model
Explicit row entries plus an optional constrained open tail.
QiecFamilyConstructor
didactic-model
¶
QiecFamilyConstructor(*, name: str, binders: tuple[QiecBinder, ...] = (), arguments: tuple[QiecTypeExpr, ...] = (), result: QiecTypeExpr, line: int = 0, col: int = 0)
Bases: Model
A GADT constructor with a local telescope and refined result.
QiecFamilyDecl
didactic-model
¶
QiecFamilyDecl(*, name: str, parameters: tuple[QiecBinder, ...] = (), indices: tuple[QiecIndexBinder, ...] = (), result_kind: QiecKindExpr, constructors: tuple[QiecFamilyConstructor, ...] = (), docs: tuple[str, ...] = (), line: int = 0, col: int = 0, deriving: tuple[DerivingClass, ...] = (), kind: Literal['indexed_family_decl'] = 'indexed_family_decl')
Bases: Statement
family NAME[params](indices) : KIND with its GADT constructors.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The family's name.
TYPE:
|
parameters
|
The uniform static parameters.
TYPE:
|
indices
|
The refinable index binders.
TYPE:
|
result_kind
|
The kind of the family's applications.
TYPE:
|
constructors
|
The family's constructors.
TYPE:
|
docs
|
The doc comment lines attached to the declaration.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
deriving
|
The classes of the header's
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
QiecFunctionType
didactic-model
¶
QiecFunctionType(*, parameter: QiecTypeExpr, result: QiecTypeExpr, row: QiecEffectRow | None = None, line: int = 0, col: int = 0, kind: Literal['qiec_function_type'] = 'qiec_function_type')
Bases: QiecTypeExpr
A function type between value types.
| PARAMETER | DESCRIPTION |
|---|---|
parameter
|
The parameter type.
TYPE:
|
result
|
The result type.
TYPE:
|
row
|
The effect row an application performs, or None for a pure function.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
QiecHandleComputation
didactic-model
¶
QiecHandleComputation(*, instance: str, handler: QiecHandlerApplication, body: QiecComputation, line: int = 0, col: int = 0, kind: Literal['qiec_handle_computation'] = 'qiec_handle_computation')
Bases: QiecComputation
A computation run under a handler installed for one instance.
| PARAMETER | DESCRIPTION |
|---|---|
instance
|
The instance the handler is installed for.
TYPE:
|
handler
|
The handler applied.
TYPE:
|
body
|
The computation run under it.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
QiecHandlerApplication
didactic-model
¶
QiecHandlerApplication(*, name: str, static_arguments: tuple[QiecStaticArgument, ...] = (), values: tuple[QiecValue, ...] = (), line: int = 0, col: int = 0)
Bases: Model
A handler at its static arguments and its parameters' first values.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The handler's name.
TYPE:
|
static_arguments
|
The static arguments, in order.
TYPE:
|
values
|
The values the handler's parameters start from, in order.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
QiecCallComputation
didactic-model
¶
QiecCallComputation(*, callee: str, static_arguments: tuple[QiecStaticArgument, ...] = (), arguments: tuple[QiecValue, ...] = (), line: int = 0, col: int = 0, kind: Literal['qiec_call_computation'] = 'qiec_call_computation')
Bases: QiecComputation
Application of a named computation.
The callee is resolved against the module's signature table rather than against a local binding, so a call may precede the declaration it names and mutual recursion needs no forward declaration.
QiecHandlerClause
didactic-model
¶
Bases: TaggedUnion
One clause of a handler declaration.
A handler answers a returning computation and each operation it covers, and those are different shapes: the return clause binds a value, an operation clause binds the operation's arguments and may resume.
QiecHandlerReturnClause
didactic-model
¶
QiecHandlerReturnClause(*, binder: QiecLocalBinding, body: QiecComputation, line: int = 0, col: int = 0, kind: Literal['qiec_handler_return_clause'] = 'qiec_handler_return_clause')
QiecHandlerOperationClause
didactic-model
¶
QiecHandlerOperationClause(*, operation: str, grade: QiecResumptionGrade, binders: tuple[QiecBinder, ...] = (), parameters: tuple[QiecLocalBinding, ...] = (), body: QiecComputation | None = None, line: int = 0, col: int = 0, bounds: tuple[int, ...] = (), kind: Literal['qiec_handler_operation_clause'] = 'qiec_handler_operation_clause')
Bases: QiecHandlerClause
One operation a handler covers.
A body of None is a signature rather than an implementation, and is
legal only where the declaration says implementation=foreign.
The interval grade carries its lower and upper endpoints in bounds.
QiecHandlerDecl
didactic-model
¶
QiecHandlerDecl(*, name: str, binders: tuple[QiecBinder, ...] = (), effect: QiecEffectRef, input_type: QiecTypeExpr, output_type: QiecTypeExpr, introduced: QiecEffectRow = QiecEffectRow(), coverage: Literal['total', 'partial'] = 'total', forwards_unknown: bool = False, implementation: QiecHandlerImplementation = 'authored', parameters: tuple[QiecValueParameter, ...] = (), clauses: tuple[QiecHandlerClause, ...] = (), duplicate_options: tuple[str, ...] = (), docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['handler_decl'] = 'handler_decl')
Bases: Statement
handler NAME[binders] for EFFECT : IN -> OUT with (params), with its clauses.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The handler's name.
TYPE:
|
binders
|
The handler's static telescope.
TYPE:
|
effect
|
The applied interface the handler handles.
TYPE:
|
input_type
|
The type of the computation handled.
TYPE:
|
output_type
|
The type the handled computation yields.
TYPE:
|
introduced
|
The effect row the handler's clauses may perform.
TYPE:
|
coverage
|
Whether the clauses cover every operation (
TYPE:
|
forwards_unknown
|
Whether requests of operations without a clause are forwarded outward.
TYPE:
|
implementation
|
Whether the clause bodies are authored here or supplied by a runtime provider.
TYPE:
|
parameters
|
The handler's typed parameters, in order.
TYPE:
|
clauses
|
The return and operation clauses.
TYPE:
|
duplicate_options
|
The option names the source repeated, kept so the checker can report them.
TYPE:
|
docs
|
The doc comment lines attached to the declaration.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
QiecContextSort
didactic-model
¶
QiecContextSort(*, signature: str, line: int = 0, col: int = 0, kind: Literal['qiec_context_sort'] = 'qiec_context_sort')
Bases: QiecIndexSort
The sort of contexts over a structural signature.
| PARAMETER | DESCRIPTION |
|---|---|
signature
|
The signature's name.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
QiecInstanceComputation
didactic-model
¶
QiecInstanceComputation(*, name: str, effect: QiecEffectRef, body: QiecComputation, line: int = 0, col: int = 0, kind: Literal['qiec_instance_computation'] = 'qiec_instance_computation')
Bases: QiecComputation
with instance x : E in, allocating a lexically scoped instance.
The binder is live only in body. Its identity is derived rather
than generated, so the same allocation site yields the same instance
on every run.
QiecIndexApplication
didactic-model
¶
QiecIndexApplication(*, constructor: str, arguments: tuple[QiecIndexExpr, ...] = (), line: int = 0, col: int = 0, kind: Literal['qiec_index_application'] = 'qiec_index_application')
Bases: QiecIndexExpr
A user index-sort constructor applied to index arguments.
| PARAMETER | DESCRIPTION |
|---|---|
constructor
|
The constructor's name.
TYPE:
|
arguments
|
The index arguments, in order.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
QiecIndexBinder
didactic-model
¶
QiecIndexBinder(*, name: str, sort: QiecIndexSort, line: int = 0, col: int = 0, kind: Literal['qiec_index_binder'] = 'qiec_index_binder')
Bases: QiecBinder
A telescope binder over a closed index sort.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The binder's name.
TYPE:
|
sort
|
The sort the binder ranges over.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
QiecModuleBinder
didactic-model
¶
QiecModuleBinder(*, name: str, signature: str, constraints: tuple[QiecModuleSharing, ...] = (), implicit: bool = False, position: int = 0, line: int = 0, col: int = 0, core: str = '')
Bases: Model
A module parameter of a computation.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The parameter's name.
TYPE:
|
signature
|
The signature's name, as name resolution reads it; empty for a deduction parameter.
TYPE:
|
constraints
|
Its
TYPE:
|
core
|
For
TYPE:
|
implicit
|
Whether calls leave the argument to instance resolution.
TYPE:
|
position
|
Its index among all the computation's parameters.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
QiecModuleSharing
didactic-model
¶
QiecModuleSharing(*, name: str, type_expr: QiecTypeExpr, line: int = 0, col: int = 0)
Bases: Model
with family T = U on a module parameter's signature.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The family item of the signature.
TYPE:
|
type_expr
|
The type it equals.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
QiecIndexConstructor
didactic-model
¶
QiecIndexConstructor(*, name: str, arguments: tuple[QiecIndexSort, ...] = (), line: int = 0, col: int = 0)
Bases: Model
One constructor of a closed user-defined index sort.
QiecIndexDecl
didactic-model
¶
QiecIndexDecl(*, name: str, constructors: tuple[QiecIndexConstructor, ...], docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['index_decl'] = 'index_decl')
Bases: Statement
index NAME = C1 | C2(...) | ..., a closed user index sort.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The sort's name.
TYPE:
|
constructors
|
The sort's constructors.
TYPE:
|
docs
|
The doc comment lines attached to the declaration.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
QiecIndexExpr
didactic-model
¶
Bases: TaggedUnion
A source-level term in a closed index sort.
QiecIndexLiteral
didactic-model
¶
QiecIndexLiteral(*, value: int, line: int = 0, col: int = 0, kind: Literal['qiec_index_literal'] = 'qiec_index_literal')
Bases: QiecIndexExpr
A natural-number index literal.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
The literal's value.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
QiecIndexMapClause
didactic-model
¶
QiecIndexMapClause(*, constructor: str, parameters: tuple[str, ...], body: QiecIndexExpr, line: int = 0, col: int = 0)
Bases: Model
One constructor clause of an authored index map.
| PARAMETER | DESCRIPTION |
|---|---|
constructor
|
The constructor of the source sort.
TYPE:
|
parameters
|
Names for the images of the constructor's arguments, in order.
TYPE:
|
body
|
The target index term.
TYPE:
|
line
|
The source position.
TYPE:
|
col
|
The source position.
TYPE:
|
QiecIndexMapDecl
didactic-model
¶
QiecIndexMapDecl(*, name: str, source: QiecUserIndexSort, target: QiecUserIndexSort, clauses: tuple[QiecIndexMapClause, ...], docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['index_map_decl'] = 'index_map_decl')
Bases: Statement
A constructor-by-constructor map between declared index sorts.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The map's name.
TYPE:
|
source
|
The source index sort.
TYPE:
|
target
|
The target index sort.
TYPE:
|
clauses
|
The image of each source constructor.
TYPE:
|
docs
|
The attached doc comments.
TYPE:
|
line
|
The source position.
TYPE:
|
col
|
The source position.
TYPE:
|
kind
|
The syntax discriminator.
TYPE:
|
QiecIndexName
didactic-model
¶
QiecIndexName(*, name: str, line: int = 0, col: int = 0, kind: Literal['qiec_index_name'] = 'qiec_index_name')
Bases: QiecIndexExpr
A reference to an index binder in scope.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The binder's name.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
QiecLocalBinding
didactic-model
¶
QiecLocalBinding(*, name: str, type_expr: QiecTypeExpr | None = None, line: int = 0, col: int = 0)
Bases: Model
A local name bound by a computation, with an optional type annotation.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The local's name.
TYPE:
|
type_expr
|
The annotated type, or
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
QiecOperationDecl
didactic-model
¶
QiecOperationDecl(*, name: str, binders: tuple[QiecBinder, ...] = (), arguments: tuple[QiecTypeExpr, ...] = (), result: QiecTypeExpr, line: int = 0, col: int = 0)
Bases: Model
One operation of an effect interface declaration.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The operation's name.
TYPE:
|
binders
|
The operation's own static telescope.
TYPE:
|
arguments
|
The argument types, in order.
TYPE:
|
result
|
The result type.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
QiecPerformComputation
didactic-model
¶
QiecPerformComputation(*, request: QiecEffectRequest, line: int = 0, col: int = 0, kind: Literal['qiec_perform_computation'] = 'qiec_perform_computation')
Bases: QiecComputation
perform of one effect request.
| PARAMETER | DESCRIPTION |
|---|---|
request
|
The request performed.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
QiecProductType
didactic-model
¶
QiecProductType(*, components: tuple[QiecTypeExpr, ...], line: int = 0, col: int = 0, kind: Literal['qiec_product_type'] = 'qiec_product_type')
Bases: QiecTypeExpr
A finite product of value types.
| PARAMETER | DESCRIPTION |
|---|---|
components
|
The component types, in order.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
QiecPureBinding
didactic-model
¶
QiecPureBinding(*, binder: QiecLocalBinding, value: QiecValue, then: QiecComputation, line: int = 0, col: int = 0, kind: Literal['qiec_pure_binding'] = 'qiec_pure_binding')
Bases: QiecComputation
let x = VALUE, binding a pure expression.
Separate from
QiecBindComputation,
which binds a computation's result. The two have different typing
rules and neither is sugar for the other.
| PARAMETER | DESCRIPTION |
|---|---|
binder
|
The local the value is bound to.
TYPE:
|
value
|
The pure expression.
TYPE:
|
then
|
The computation the binding scopes over.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
QiecResumeComputation
didactic-model
¶
QiecResumeComputation(*, value: QiecValue | None = None, parameters: tuple[QiecValue, ...] = (), line: int = 0, col: int = 0, kind: Literal['qiec_resume_computation'] = 'qiec_resume_computation')
Bases: QiecComputation
Invocation of the enclosing handler clause's continuation.
The resumption is not a named local, so there is exactly one way to
invoke it. A value of None resumes with unit. The parameters are
the values the handler's parameters have while the continuation runs;
an empty tuple keeps the clause's own.
QiecReturnComputation
didactic-model
¶
QiecReturnComputation(*, value: QiecValue, line: int = 0, col: int = 0, kind: Literal['qiec_return_computation'] = 'qiec_return_computation')
Bases: QiecComputation
return VALUE, the computation that performs nothing.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
The value returned.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
QiecRowEntry
didactic-model
¶
Bases: Model
A named lexical effect instance in an effect row.
QiecSequenceComputation
didactic-model
¶
QiecSequenceComputation(*, first: QiecComputation, then: QiecComputation, line: int = 0, col: int = 0, kind: Literal['qiec_sequence_computation'] = 'qiec_sequence_computation')
Bases: QiecComputation
Two computations run in order, the first result discarded.
| PARAMETER | DESCRIPTION |
|---|---|
first
|
The computation run first.
TYPE:
|
then
|
The computation run after it.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
QiecNatSort
didactic-model
¶
Bases: QiecIndexSort
The sort Nat of natural-number indices.
| PARAMETER | DESCRIPTION |
|---|---|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
QiecShapeIndex
didactic-model
¶
QiecShapeIndex(*, dimensions: tuple[QiecIndexExpr, ...] = (), line: int = 0, col: int = 0, kind: Literal['qiec_shape_index'] = 'qiec_shape_index')
Bases: QiecIndexExpr
A shape written as a bracketed list of dimensions.
| PARAMETER | DESCRIPTION |
|---|---|
dimensions
|
The dimension indices, outermost first.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
QiecShapeSort
didactic-model
¶
QiecShapeSort(*, rank: int | None = None, line: int = 0, col: int = 0, kind: Literal['qiec_shape_sort'] = 'qiec_shape_sort')
Bases: QiecIndexSort
The sort of shapes, of a fixed rank or of any rank.
| PARAMETER | DESCRIPTION |
|---|---|
rank
|
The rank a shape must have, or
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
QiecTypeApplication
didactic-model
¶
QiecTypeApplication(*, constructor: str, static_arguments: tuple[QiecStaticArgument, ...] = (), indices: tuple[QiecIndexExpr, ...] = (), line: int = 0, col: int = 0, kind: Literal['qiec_type_application'] = 'qiec_type_application')
Bases: QiecTypeExpr
A type constructor applied to static arguments and indices.
| PARAMETER | DESCRIPTION |
|---|---|
constructor
|
The constructor's name.
TYPE:
|
static_arguments
|
The uniform type arguments, in order.
TYPE:
|
indices
|
The refinable index arguments, in order.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
QiecTypeBinder
didactic-model
¶
QiecTypeBinder(*, name: str, binder_kind: QiecKindExpr, line: int = 0, col: int = 0, kind: Literal['qiec_type_binder'] = 'qiec_type_binder')
Bases: QiecBinder
A telescope binder of kind Type or Effect.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The binder's name.
TYPE:
|
binder_kind
|
The kind the binder ranges over.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
QiecTypeExpr
didactic-model
¶
Bases: TaggedUnion
A value type in the QIEC source stratum.
QiecTypeKind
didactic-model
¶
Bases: QiecKindExpr
The kind Type of value types.
| PARAMETER | DESCRIPTION |
|---|---|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
QiecTypeName
didactic-model
¶
QiecTypeName(*, name: str, line: int = 0, col: int = 0, kind: Literal['qiec_type_name'] = 'qiec_type_name')
Bases: QiecTypeExpr
A reference to a type by name: a primitive, a binder, or a declared family without arguments.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The type's name.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
QiecUserIndexSort
didactic-model
¶
QiecUserIndexSort(*, name: str, line: int = 0, col: int = 0, kind: Literal['qiec_user_index_sort'] = 'qiec_user_index_sort')
Bases: QiecIndexSort
A reference to a user-declared closed index sort.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The sort's name.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
QiecWeightedTotal
didactic-model
¶
QiecWeightedTotal(*, index: str, count: int, weights: tuple[str, ...], weight_index: str, responses: tuple[QiecValue, ...], response_index: str, addition: str, action: str, line: int = 0, col: int = 0, addition_col: int = 0, action_col: int = 0, kind: Literal['qiec_weighted_total'] = 'qiec_weighted_total')
QiecValueParameter
didactic-model
¶
QiecValueParameter(*, name: str, type_expr: QiecTypeExpr, line: int = 0, col: int = 0)
Bases: Model
One typed value parameter of a computation declaration.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The parameter's name.
TYPE:
|
type_expr
|
The parameter's type.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
JudgmentArgumentDecl
didactic-model
¶
JudgmentArgumentDecl(*, name: str, sort: str, argument: str | None = None, mode: Literal['in', 'out'])
Bases: Model
One argument of a judgment: ctx : Context[Type] in.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The argument's name.
TYPE:
|
sort
|
Its sort, or
TYPE:
|
argument
|
The entry sort of a context,
TYPE:
|
mode
|
TYPE:
|
JudgmentDecl
didactic-model
¶
JudgmentDecl(*, name: str, arguments: tuple[JudgmentArgumentDecl, ...] = (), rules: tuple[JudgmentRuleDecl, ...] = (), options: tuple[OptionEntry, ...] = (), docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['judgment_decl'] = 'judgment_decl')
Bases: Statement
judgment NAME(arguments) [options] with its rules.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The judgment's name.
TYPE:
|
arguments
|
Its moded arguments.
TYPE:
|
rules
|
Its rules.
TYPE:
|
options
|
Its options.
TYPE:
|
docs
|
Its doc comment lines.
TYPE:
|
line
|
The source position.
TYPE:
|
col
|
The source position.
TYPE:
|
JudgmentRuleDecl
didactic-model
¶
JudgmentRuleDecl(*, name: str, schematic: tuple[str, ...] = (), premises: tuple[PatternSyntax, ...] = (), conclusion: PatternSyntax, options: tuple[OptionEntry, ...] = (), line: int = 0, col: int = 0)
Bases: Model
A rule rule name[a, b] : P_1, ..., P_n |- C #[...].
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The rule's name.
TYPE:
|
schematic
|
The variables fresh at each use.
TYPE:
|
premises
|
The premises as written.
TYPE:
|
conclusion
|
The conclusion as written.
TYPE:
|
options
|
The trailing pragma's entries, such as
TYPE:
|
line
|
The source position.
TYPE:
|
col
|
The source position.
TYPE:
|
ArgumentDecl
didactic-model
¶
ArgumentDecl(*, sort: str, binds: tuple[BoundVariableDecl, ...] = (), label: str | None = None)
Bases: Model
One argument of a constructor and its binding arity.
Term is an unbound argument, (ty : Type) an unbound argument
labeled ty, and (x : Term).Term an argument of sort Term
that binds x.
BoundVariableDecl
didactic-model
¶
Bases: Model
A variable an argument binds: x : Term or x : Term : ty.
name is a display name; references inside the argument are by
de Bruijn index. annotation names an earlier unbound argument by
its label; the encoder and decoder initialize the variable from it.
EquationDecl
didactic-model
¶
EquationDecl(*, name: str, left: PatternSyntax, right: PatternSyntax, oriented: bool = False, line: int = 0, col: int = 0)
Bases: Model
One equation of a signature: name : lhs = rhs or lhs ~> rhs.
The sides are written second-order terms whose names are resolved against the signature when the theory is checked.
ConstructorDecl
didactic-model
¶
ConstructorDecl(*, name: str, arguments: tuple[ArgumentDecl, ...] = (), codomain: str, line: int = 0, col: int = 0)
Bases: Model
A typed operation name : a_1, ..., a_n -> s in a signature.
Each argument a_i carries its sort and the variables it binds.
domain
property
¶
The sort of each argument.
| RETURNS | DESCRIPTION |
|---|---|
tuple of str
|
The sorts, in order. |
EdgeKindDecl
didactic-model
¶
Bases: Model
An edge kind in a graph-shaped signature.
directed is True for src -> tgt, False for src -- tgt.
EncoderInitRule
didactic-model
¶
EncoderInitRule(*, kind: str, arg: str, body: LetExprNode, line: int = 0, col: int = 0)
Bases: Model
Graph-signature initializer: maps vertex data payloads to
initial vertex embeddings before message passing.
EncoderMessageRule
didactic-model
¶
EncoderMessageRule(*, edge_kind: str, src: str, tgt: str, body: LetExprNode, line: int = 0, col: int = 0)
Bases: Model
Graph-signature message: maps a (src, tgt) pair on an edge
kind to a message vector.
EncoderRule
didactic-model
¶
EncoderRule(*, op: str, args: tuple[str, ...], body: LetExprNode, mode: Literal['plain', 'recurrent', 'attention'] = 'plain', state_var: str | None = None, prefix_var: str | None = None, line: int = 0, col: int = 0)
Bases: Model
A per-operation encoder function.
The body is a let-expression evaluated in an environment where the
constructor arguments (as named in args) are bound to child
vectors, plus framework-supplied helpers (ctx for binder
contexts, state/prefix for recurrent / attention shapes).
mode selects sequence sugar:
"plain"for direct algebra-hom rule (default)."recurrent"for left-fold,statecarries the accumulator."attention"forprefixcarries the running list of prior compressed children.
EncoderUpdateRule
didactic-model
¶
EncoderUpdateRule(*, vertex_kind: str, self_var: str, msgs_var: str, body: LetExprNode, line: int = 0, col: int = 0)
Bases: Model
Graph-signature update: maps (self_embed, aggregated_msgs)
to the next vertex embedding, per vertex kind.
EncoderVarInit
didactic-model
¶
EncoderVarInit(*, var_sort: str, annot_sort: str | None = None, ty: str | None = None, body: LetExprNode, line: int = 0, col: int = 0)
Bases: Model
One var_init <var_sort> [from <annot_sort> [as <name>]] rule.
annot_sort=None is the unannotated-binder case (no type
annotation; the body sees no extra arg). When annot_sort is
set, ty is the body's parameter name bound to the annotation
embedding.
SortDecl
didactic-model
¶
SortDecl(*, name: str, kind: Literal['object', 'index', 'data'], options: tuple[OptionEntry, ...] = (), line: int = 0, col: int = 0)
Bases: Model
One sort within a signature.
kind is one of "object", "index", "data". The
surface form moves dim and vocab into the unified
option block: s : data [dim=16, vocab=["a", "b"]]. The
compiler reads them back out of options at elaboration time.
SortDim
didactic-model
¶
Bases: Model
A (sort, dim) association declared in a encoder/decoder.
SortVocabLiteral
didactic-model
¶
Bases: Model
One entry of a data sort's closed vocabulary.
The literal carries its surface text plus a tag so the compiler
can decode each entry into the canonical Python value the
runtime stores in Sort.vocab (str, int, or
float).
VertexKindDecl
didactic-model
¶
VertexKindDecl(*, name: str, kind: Literal['object', 'index', 'data'], options: tuple[OptionEntry, ...] = (), line: int = 0, col: int = 0)
Bases: Model
A vertex kind in a graph-shaped signature.
Like SortDecl, the surface threads dim and any
other modifier through the unified option block.
ContentPin
didactic-model
¶
Bases: Model
A content hash pinned to a file: @blake3:<hex>.
| PARAMETER | DESCRIPTION |
|---|---|
algorithm
|
The hash algorithm, such as
TYPE:
|
digest
|
The hexadecimal digest, lowercase.
TYPE:
|
render
¶
The pin as it is written in source.
| RETURNS | DESCRIPTION |
|---|---|
str
|
|
ExperimentData
didactic-model
¶
ExperimentData(*, name: str, path: str, pin: ContentPin | None = None, line: int = 0, col: int = 0)
Bases: Model
data NAME <- "PATH" @blake3:...: a parameter read from a file.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The program parameter (or site) the file's value is given to.
TYPE:
|
path
|
The file, relative to the module's directory.
TYPE:
|
pin
|
The pinned content hash, or None when the clause pins none.
TYPE:
|
line
|
The 1-based source line.
TYPE:
|
col
|
The 0-based source column.
TYPE:
|
ExperimentDecl
didactic-model
¶
ExperimentDecl(*, name: str, program: str, program_line: int, infer: ExperimentInfer, seed: int, data: tuple[ExperimentData, ...] = (), fixed: tuple[ExperimentValue, ...] = (), sweeps: tuple[ExperimentSweep, ...] = (), reference: ExperimentReference | None = None, tolerances: tuple[ExperimentValue, ...] = (), links: tuple[ExperimentLink, ...] = (), handlers: tuple[ExperimentHandler, ...] = (), docs: tuple[str, ...] = (), line: int = 0, col: int = 0)
Bases: Model
An experiment declaration.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The experiment's name.
TYPE:
|
program
|
The entry it runs (a
TYPE:
|
program_line
|
The line of the
TYPE:
|
data
|
Its data clauses, in source order.
TYPE:
|
fixed
|
Its
TYPE:
|
infer
|
Its inference configuration.
TYPE:
|
seed
|
Its seed.
TYPE:
|
sweeps
|
Its sweeps, in source order; the experiment is the family of runs indexed by their product.
TYPE:
|
reference
|
The stored reference results
TYPE:
|
tolerances
|
The pinned tolerances of that comparison.
TYPE:
|
links
|
The holes it fills.
TYPE:
|
handlers
|
The handlers it installs around the entry, outermost first.
TYPE:
|
docs
|
Its doc comment lines.
TYPE:
|
line
|
The 1-based source line.
TYPE:
|
col
|
The 0-based source column.
TYPE:
|
ExperimentHandler
didactic-model
¶
ExperimentHandler(*, instance: str, handler: QiecHandlerApplication, line: int = 0, col: int = 0)
Bases: Model
handle I with H: a handler installed around the entry.
| PARAMETER | DESCRIPTION |
|---|---|
instance
|
The effect instance, resolved to its flat-program name.
TYPE:
|
handler
|
The handler application, its name resolved.
TYPE:
|
line
|
The 1-based source line.
TYPE:
|
col
|
The 0-based source column.
TYPE:
|
ExperimentInfer
didactic-model
¶
ExperimentInfer(*, method: str, options: tuple[ExperimentValue, ...] = (), line: int = 0, col: int = 0)
Bases: Model
infer METHOD(k = v, ...): the inference configuration.
| PARAMETER | DESCRIPTION |
|---|---|
method
|
The inference method's name.
TYPE:
|
options
|
Its options, in source order.
TYPE:
|
line
|
The 1-based source line.
TYPE:
|
col
|
The 0-based source column.
TYPE:
|
ExperimentLink
didactic-model
¶
Bases: Model
link P = M: a hole of the program's package filled for this experiment.
| PARAMETER | DESCRIPTION |
|---|---|
hole
|
The hole's module path.
TYPE:
|
module
|
The filling module's path.
TYPE:
|
line
|
The 1-based source line.
TYPE:
|
col
|
The 0-based source column.
TYPE:
|
ExperimentReference
didactic-model
¶
ExperimentReference(*, path: str, pin: ContentPin | None = None, line: int = 0, col: int = 0)
Bases: Model
reference "PATH" @blake3:...: the stored reference results.
| PARAMETER | DESCRIPTION |
|---|---|
path
|
The reference file, relative to the module's directory.
TYPE:
|
pin
|
Its pinned content hash, or None when the clause pins none.
TYPE:
|
line
|
The 1-based source line.
TYPE:
|
col
|
The 0-based source column.
TYPE:
|
ExperimentSweep
didactic-model
¶
Bases: Model
sweep NAME in [v1, ..., vn]: a finite index type of values.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The name each point gives its value to.
TYPE:
|
values
|
The points, each as canonical JSON text, in source order.
TYPE:
|
line
|
The 1-based source line.
TYPE:
|
col
|
The 0-based source column.
TYPE:
|
ExperimentValue
didactic-model
¶
Bases: Model
fix NAME = VALUE or NAME = VALUE in an option list.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The name the value is given to.
TYPE:
|
value
|
The literal value as canonical JSON text.
TYPE:
|
line
|
The 1-based source line.
TYPE:
|
col
|
The 0-based source column.
TYPE:
|
TestBinder
didactic-model
¶
TestBinder(*, name: str, type: QiecTypeExpr, domain: tuple[LetExprNode, ...] = (), line: int = 0, col: int = 0)
Bases: Model
One quantified variable of a property.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The variable.
TYPE:
|
type
|
Its type.
TYPE:
|
domain
|
The values it ranges over when listed with
TYPE:
|
line
|
The 1-based source line.
TYPE:
|
col
|
The 0-based source column.
TYPE:
|
TestDecl
didactic-model
¶
TestDecl(*, kind: TestKind, name: str, steps: tuple[TestStep, ...], binders: tuple[TestBinder, ...] = (), options: tuple[OptionEntry, ...] = (), subject: str = '', docs: tuple[str, ...] = (), line: int = 0, col: int = 0)
Bases: Model
A test, property, or example declaration.
| PARAMETER | DESCRIPTION |
|---|---|
kind
|
Which keyword declared it.
TYPE:
|
name
|
Its title.
TYPE:
|
steps
|
The body.
TYPE:
|
binders
|
A property's quantified variables; empty otherwise.
TYPE:
|
options
|
The declaration's pinned options (
TYPE:
|
subject
|
For an example written in a declaration's doc comment, the name
of that declaration;
TYPE:
|
docs
|
The declaration's own doc comment lines.
TYPE:
|
line
|
The 1-based source line.
TYPE:
|
col
|
The 0-based source column.
TYPE:
|
TestExpect
didactic-model
¶
TestExpect(*, subject: LetExprNode, exact: bool = False, tolerance: LetExprNode | None = None, line: int = 0, col: int = 0, kind: Literal['test_expect'] = 'test_expect')
Bases: TestStep
Assert that a term is true.
A term that is a comparison is checked as a relation between its two sides, which the report states when it fails.
| PARAMETER | DESCRIPTION |
|---|---|
subject
|
The asserted term.
TYPE:
|
exact
|
Whether it was written
TYPE:
|
tolerance
|
For
TYPE:
|
line
|
The 1-based source line.
TYPE:
|
col
|
The 0-based source column.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
TestLet
didactic-model
¶
TestLet(*, name: str, value: LetExprNode, line: int = 0, col: int = 0, kind: Literal['test_let'] = 'test_let')
Bases: TestStep
Bind a name to a term's value for the rest of the body.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The bound name.
TYPE:
|
value
|
The term.
TYPE:
|
line
|
The 1-based source line.
TYPE:
|
col
|
The 0-based source column.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
ContinuousConstructor
didactic-model
¶
ContinuousConstructor(*, constructor: Literal['Real', 'Simplex', 'Sphere', 'Ball', 'CholeskyFactor', 'Covariance', 'Correlation', 'Orthogonal', 'Stiefel', 'LowerTriangular', 'Diagonal'], args: tuple[str, ...] = (), kwargs: dict[str, float | int | str] = field(default_factory=dict), line: int = 0, col: int = 0, kind: Literal['continuous_constructor'] = 'continuous_constructor')
Bases: ObjectExpr
A continuous-space constructor call.
The eleven continuous constructors are: Real, Simplex,
Sphere, Ball, CholeskyFactor, Covariance,
Correlation, Orthogonal, Stiefel, LowerTriangular,
Diagonal. The compiler dispatches on the constructor
field to pick the appropriate
quivers.continuous.spaces.ContinuousSpace subclass.
DiscreteConstructor
didactic-model
¶
ObjectCoproduct
didactic-model
¶
ObjectCoproduct(*, components: tuple[ObjectExpr, ...], line: int = 0, col: int = 0, kind: Literal['object_coproduct'] = 'object_coproduct')
ObjectEffectApply
didactic-model
¶
ObjectEffectApply(*, effect: str, args: tuple[ObjectExpr, ...], line: int = 0, col: int = 0, kind: Literal['object_effect_apply'] = 'object_effect_apply')
Bases: ObjectExpr
Effect-typed type-application: T(X).
The effect field names the effect (a previously-declared
effect or stdlib effect); args are its applied arguments.
Legal only inside a FreeResiduated whose effects list
mentions the named effect.
TypeName
didactic-model
¶
ObjectProduct
didactic-model
¶
ObjectProduct(*, components: tuple[ObjectExpr, ...], line: int = 0, col: int = 0, kind: Literal['object_product'] = 'object_product')
ObjectSequence
didactic-model
¶
ObjectSequence(*, argument: str, length: str, line: int = 0, col: int = 0, kind: Literal['object_sequence'] = 'object_sequence')
Bases: ObjectExpr
A name sequence argument ... length, an argument of an application in a rule schema.
The names argument_1 through argument_length, the sequence
variable's names as in a slash spine (ObjectSpine): an application whose
argument it is stands for one application per name, nested to the
right, e(z ... n, B) being B at n = 0 and
e(z_1, e(z_2, ... e(z_n, B))) otherwise. Instantiating the schema
replaces the application by the nested applications it stands for, so
Lam(z ... n, B) binds n names, which a spine G |App z ... n
over the same name applies G to in order.
ObjectSlash
didactic-model
¶
ObjectSlash(*, result: ObjectExpr, argument: ObjectExpr, direction: Literal['/', '\\'], line: int = 0, col: int = 0, kind: Literal['object_slash'] = 'object_slash')
Bases: ObjectExpr
Residuated slash type: result / argument or result \ argument.
Legal only when both operands inhabit a residuated universe
(typically a FreeResiduated object). The compiler enforces
this at use-site; the grammar accepts the slash on any pair of
type expressions.
ObjectSpine
didactic-model
¶
ObjectSpine(*, head: ObjectExpr, slash: str, argument: str, length: str, line: int = 0, col: int = 0, kind: Literal['object_spine'] = 'object_spine')
Bases: ObjectExpr
A slash spine head |slash argument ... length of a rule schema.
The category head taking length arguments argument_1
through argument_length, each through the slash slash: a
sequence pattern whose length is a schema parameter or a numeral.
Instantiating the schema replaces it by the nested applications it
stands for.
ObjectFeatures
didactic-model
¶
ObjectFeatures(*, atom: str, features: tuple[ObjectExpr, ...], line: int = 0, col: int = 0, kind: Literal['object_features'] = 'object_features')
Bases: ObjectExpr
An atom at feature values, NP[sg] or NP[n], in a refined deduction.
The atom is declared with features (atoms NP[num : Num]); each
feature is a member of the feature's category set or a variable over
it. Expanding the deduction (quivers.dsl.lexical) replaces it by the
atom the refinement declares for those values.
AtomFeature
didactic-model
¶
Bases: Model
num : Num: one feature of an atom and the set its values range over.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The feature's name, or empty when unnamed.
TYPE:
|
set_name
|
The category set of its values.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
AtomImage
didactic-model
¶
Bases: Model
An atom of a refinement and the base atom it forgets to.
| PARAMETER | DESCRIPTION |
|---|---|
atom
|
The refinement's atom, such as
TYPE:
|
image
|
The base atom, such as
TYPE:
|
AtomFeatures
didactic-model
¶
AtomFeatures(*, atom: str, features: tuple[AtomFeature, ...], line: int = 0, col: int = 0)
Bases: Model
NP[num : Num]: an atom declared with features.
| PARAMETER | DESCRIPTION |
|---|---|
atom
|
The atom.
TYPE:
|
features
|
Its features, in order.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
CategoryBinder
didactic-model
¶
Bases: Model
X in Conj: a category variable and the set it ranges over.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The variable.
TYPE:
|
set_name
|
The declared category set.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
CategorySetDecl
didactic-model
¶
CategorySetDecl(*, name: str, members: tuple[ObjectExpr, ...], line: int = 0, col: int = 0)
Bases: Model
categories Conj = S, N, Bwd(Conj, Arg): a regular set of categories.
The set is the least one holding every member, where a member names the set itself or another declared set at the positions it may take any of that set's elements.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The set.
TYPE:
|
members
|
The members, each a category whose atoms may name declared sets.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
FixedBinding
didactic-model
¶
FixedBinding(*, name: str, value: ObjectExpr)
Bases: Model
A variable of a rule bound once, when the rule is written.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The variable of the source rule.
TYPE:
|
value
|
The category or meaning it is bound to.
TYPE:
|
LexicalRuleDecl
didactic-model
¶
LexicalRuleDecl(*, name: str, premise: ObjectExpr, conclusion: ObjectExpr, options: tuple[OptionEntry, ...] = (), line: int = 0, col: int = 0)
Bases: Model
lexical rule r : premise |- conclusion: a rule over lexical items.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The rule.
TYPE:
|
premise
|
The lexical item it applies to.
TYPE:
|
conclusion
|
The lexical item it derives, over the same span.
TYPE:
|
options
|
Its pragma:
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
LexicalTemplate
didactic-model
¶
LexicalTemplate(*, name: str, parameter: str, category: ObjectExpr, lf: LetExprNode, binders: tuple[CategoryBinder, ...] = (), options: tuple[OptionEntry, ...] = (), line: int = 0, col: int = 0)
Bases: Model
template noun(p) : N = Lam(x, App(p, x)): a family of entries.
An entry whose category names the template takes the template's category and its meaning at the entry's own meaning.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The template.
TYPE:
|
parameter
|
The name the template's meaning abstracts over.
TYPE:
|
binders
|
The category variables of a polymorphic template.
TYPE:
|
category
|
The category.
TYPE:
|
lf
|
The meaning, over
TYPE:
|
options
|
The template's pragma, shared by every entry it makes.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
SemanticClause
didactic-model
¶
SemanticClause(*, category: ObjectExpr, type_expr: ObjectExpr, line: int = 0, col: int = 0)
Bases: Model
Fwd(A, B) => Arr(B, A): the semantic type of a category shape.
| PARAMETER | DESCRIPTION |
|---|---|
category
|
The category pattern; names that are not atoms are variables.
TYPE:
|
type_expr
|
The semantic type, a term of the typing judgment's syntax over the pattern's variables, each standing for its category's type.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
SemanticsDecl
didactic-model
¶
SemanticsDecl(*, judgment: str, clauses: tuple[SemanticClause, ...], line: int = 0, col: int = 0)
Bases: Model
semantics Ty: the semantic types of the deduction's categories.
| PARAMETER | DESCRIPTION |
|---|---|
judgment
|
The typing judgment every lexical meaning is checked against,
TYPE:
|
clauses
|
One clause per category shape, tried in order.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
SpecializedWeight
didactic-model
¶
SpecializedWeight(*, rule: str, bindings: tuple[FixedBinding, ...] = (), deduction: str = '', images: tuple[AtomImage, ...] = (), entries: tuple[int, ...] = ())
Bases: Model
The learned weight of another rule a rule reads.
A rule specialized to a lazily instantiated entry reads its source rule's learned weight on the source's own bindings: those the specialized rule matches, and those the specialization fixed. A rule a refinement inherits from its base reads the base rule's learned weight on the forgetful images of its bindings, so the two deductions share the rule's parameters.
| PARAMETER | DESCRIPTION |
|---|---|
rule
|
The source rule.
TYPE:
|
bindings
|
The source rule's variables the specialization fixed.
TYPE:
|
deduction
|
The deduction the source rule belongs to, when it is the base of a refinement; empty for the rule's own deduction.
TYPE:
|
images
|
The forgetful map on atoms, for a base rule: every binding is read through it.
TYPE:
|
entries
|
For a rule specialized to a lazily instantiated entry, the positions in the lexicon of the consumed instances whose weights the rule also reads: every one in a grammar normalized per left-hand side, whose production weights it reads, and otherwise those of an entry that weighs each instance apart, whose weight families it reads; empty otherwise.
TYPE:
|
AgendaPlan
didactic-model
¶
AgendaPlan(*, deduction: DeductionDecl = field(opaque=True, extras=OPAQUE_BY_VALUE), sources: Mapping[str, str] = field(opaque=True, default_factory=dict, extras=OPAQUE_BY_VALUE), instances: Mapping[str, Mapping[int, ObjectExpr]] = field(opaque=True, default_factory=dict, extras=OPAQUE_BY_VALUE), placeholders: Mapping[str, tuple[tuple[ObjectExpr, int], ...]] = field(opaque=True, default_factory=dict, extras=OPAQUE_BY_VALUE), apart: tuple[str, ...] = (), wrapper: str = '', lift: str = '', lexical: tuple[str, ...] = ())
Bases: ValueModel
The deduction the agenda engine runs in place of one, and what it stands for.
| PARAMETER | DESCRIPTION |
|---|---|
deduction
|
The deduction the agenda runs: the written deduction's rules and entries, with the placeholder entries, the specialized rules, the wrapped lexical items, and the lift added.
TYPE:
|
sources
|
Each rule the plan adds, mapped to the written rule it stands for: a specialized rule to its source, a chart lexical rule specialized to a placeholder to the lexical rule. The lift is no entry.
TYPE:
|
instances
|
Each specialized rule's instance category at each premise position that takes a placeholder.
TYPE:
|
placeholders
|
Each placeholder atom, the instance categories it stands for, and
the plan's lexicon position of each instance's entry (an entry that
is no axiom, read under
TYPE:
|
apart
|
The placeholders of entries that weigh each instance apart
(
TYPE:
|
wrapper
|
The atom wrapping lexical items for chart lexical rules, or empty.
TYPE:
|
lift
|
The rule unwrapping a lexical item, or empty.
TYPE:
|
lexical
|
The plan's copies of the chart lexical rules, one per lexical rule and level, each concluding a wrapped item the lift reads as an entry of the deduction.
TYPE:
|
DeductionCore
didactic-model
¶
DeductionCore(*, name: str, symbols: tuple[str, ...] = (), deriving: tuple[DerivingClass, ...] = (), includes: tuple[str, ...] = ())
Bases: Model
A deduction signature a composed deduction extends.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The signature.
TYPE:
|
symbols
|
Every symbol the signature declares or includes, in declaration order: the constructors of its item family.
TYPE:
|
deriving
|
The classes the signature derives for its item family; an extension deriving a class into the same target copairs the signature's algebra with its own.
TYPE:
|
includes
|
The signatures it includes, itself among them: the declarations whose atoms and rules are its language.
TYPE:
|
DeductionExtension
didactic-model
¶
DeductionExtension(*, name: str, constraints: tuple[SchemaConstraint, ...] = (), weights: WeightMode = 'unweighted', line: int = 0, col: int = 0)
Bases: Model
One entry of an extends line: a signature and its restriction.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The deduction signature extended.
TYPE:
|
constraints
|
Constraints that keep only the instances of the signature's schemata whose parameters satisfy them.
TYPE:
|
weights
|
How the deduction weighs the rules and schemata it takes from the
signature:
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
LexiconReference
didactic-model
¶
Bases: Model
One lexicon module a deduction takes its entries from.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The lexicon module.
TYPE:
|
weights
|
How the deduction weighs the module's entries:
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
RuleInstantiation
didactic-model
¶
RuleInstantiation(*, schema: str, constraints: tuple[SchemaConstraint, ...] = (), condition: LetExprNode | None = None, line: int = 0, col: int = 0)
Bases: Model
rules r[n <= 2, e in Dir] where c: instances of one schema.
| PARAMETER | DESCRIPTION |
|---|---|
schema
|
The rule schema instantiated.
TYPE:
|
constraints
|
The bracketed constraints on its parameters.
TYPE:
|
condition
|
The
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
SchemaCondition
didactic-model
¶
SchemaCondition(*, condition: LetExprNode, line: int = 0, col: int = 0, kind: Literal['schema_condition'] = 'schema_condition')
Bases: SchemaConstraint
A condition on the parameters, such as n <= 2.
| PARAMETER | DESCRIPTION |
|---|---|
condition
|
A Boolean expression over the schema's parameters.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
SchemaConstraint
didactic-model
¶
Bases: TaggedUnion
A constraint on the parameters of a rule schema.
SchemaMembership
didactic-model
¶
SchemaMembership(*, parameter: str, domain: str = '', elements: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['schema_membership'] = 'schema_membership')
Bases: SchemaConstraint
p in Dir or p in {Fwd, Bwd}: the values a parameter takes.
| PARAMETER | DESCRIPTION |
|---|---|
parameter
|
The schema parameter.
TYPE:
|
domain
|
The index sort named after
TYPE:
|
elements
|
The listed elements, for
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
SymbolOrigin
didactic-model
¶
Bases: Model
Where a symbol or a rule of a composed deduction was declared.
| PARAMETER | DESCRIPTION |
|---|---|
symbol
|
An atom of the deduction, or the name of one of its rules.
TYPE:
|
origin
|
The deduction signature, lexicon module, or deduction declaring it.
TYPE:
|
DeductionSignatureDecl
didactic-model
¶
DeductionSignatureDecl(*, name: str, extends: tuple[DeductionExtension, ...] = (), atoms: tuple[str, ...] = (), binders: tuple[str, ...] = (), rules: tuple[SequentRule, ...] = (), instantiations: tuple[RuleInstantiation, ...] = (), docs: tuple[str, ...] = (), line: int = 0, col: int = 0, deriving: tuple[DerivingClass, ...] = (), kind: Literal['deduction_signature_decl'] = 'deduction_signature_decl')
Bases: Statement
deduction signature NAME: atoms and rules with no lexicon.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The signature's name.
TYPE:
|
extends
|
The signatures it includes.
TYPE:
|
atoms
|
The atoms it declares.
TYPE:
|
binders
|
The binder constructors it declares.
TYPE:
|
rules
|
Its rules and rule schemata.
TYPE:
|
instantiations
|
Its
TYPE:
|
docs
|
The doc comment.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
deriving
|
The classes derived for its item family.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
LexiconDecl
didactic-model
¶
LexiconDecl(*, name: str, signature: str, atoms: tuple[str, ...] = (), entries: tuple[LexiconEntry, ...] = (), docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['lexicon_decl'] = 'lexicon_decl')
Bases: Statement
lexicon NAME for S: lexical entries typed against a signature.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The lexicon module's name.
TYPE:
|
signature
|
The deduction signature its categories are drawn from.
TYPE:
|
atoms
|
The logical-form constants it declares.
TYPE:
|
entries
|
Its entries.
TYPE:
|
docs
|
The doc comment.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
ModelDecl
didactic-model
¶
ModelDecl(*, name: str, theory: str | None = None, interpretations: tuple[ModelInterpretationDecl, ...] = (), construction: Literal['reduct', 'free'] | None = None, source: str | None = None, view: str | None = None, docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['model_decl'] = 'model_decl')
Bases: Statement
model NAME of T with its interpretations, or a constructed model.
Exactly one form is written: theory with interpretations, or
construction with source and view.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The model's name.
TYPE:
|
theory
|
The theory it interprets, for the interpreted form.
TYPE:
|
interpretations
|
The interpretation of each sort and operation.
TYPE:
|
construction
|
TYPE:
|
source
|
The model the construction starts from.
TYPE:
|
view
|
The view it is taken along.
TYPE:
|
docs
|
Its doc comment lines.
TYPE:
|
line
|
The source position.
TYPE:
|
col
|
The source position.
TYPE:
|
ModelInterpretationDecl
didactic-model
¶
Bases: Model
S = Bool or plus = bool_or in a model.
| PARAMETER | DESCRIPTION |
|---|---|
symbol
|
A sort or operation of the model's theory.
TYPE:
|
value
|
The QIEC type interpreting a sort, or the computation interpreting an operation.
TYPE:
|
line
|
The source position.
TYPE:
|
col
|
The source position.
TYPE:
|
TheoryArgument
didactic-model
¶
TheoryArgument(*, parameter: str, theory: str, view: str | None = None, line: int = 0, col: int = 0)
Bases: Model
One argument P := X via v of a generic theory's instantiation.
| PARAMETER | DESCRIPTION |
|---|---|
parameter
|
The parameter of the generic theory.
TYPE:
|
theory
|
The actual theory.
TYPE:
|
view
|
The fitting view from the parameter's theory to
TYPE:
|
line
|
The source position.
TYPE:
|
col
|
The source position.
TYPE:
|
TheoryBinderDecl
didactic-model
¶
TheoryBinderDecl(*, names: tuple[str, ...], sort: PatternSyntax, line: int = 0, col: int = 0)
Bases: Model
a b : Ob: names that range over one sort.
| PARAMETER | DESCRIPTION |
|---|---|
names
|
The names bound.
TYPE:
|
sort
|
Their sort: a sort's name, or a dependent sort applied to earlier
names,
TYPE:
|
line
|
The source position.
TYPE:
|
col
|
The source position.
TYPE:
|
TheoryDecl
didactic-model
¶
TheoryDecl(*, name: str, parameters: tuple[TheoryParameterDecl, ...] = (), value: TheoryExpr | None = None, includes: tuple[TheoryIncludeDecl, ...] = (), sorts: tuple[TheorySortDecl, ...] = (), operations: tuple[TheoryOperationDecl, ...] = (), equations: tuple[EquationDecl, ...] = (), equation_options: tuple[OptionEntry, ...] = (), assume_terminating: bool = False, docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['theory_decl'] = 'theory_decl')
Bases: Statement
theory NAME[params] = e with its body.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The theory's name.
TYPE:
|
parameters
|
Its parameters, for a generic theory.
TYPE:
|
value
|
The theory expression it extends, if written.
TYPE:
|
includes
|
The theories it includes.
TYPE:
|
sorts
|
Its own sorts.
TYPE:
|
operations
|
Its own operations.
TYPE:
|
equations
|
Its own equations (
TYPE:
|
equation_options
|
The options of its
TYPE:
|
assume_terminating
|
Whether termination of its rules is a recorded assumption.
TYPE:
|
docs
|
Its doc comment lines.
TYPE:
|
line
|
The source position.
TYPE:
|
col
|
The source position.
TYPE:
|
TheoryExpr
didactic-model
¶
Bases: TaggedUnion
Sum of the theory expressions of the module algebra.
TheoryHiding
didactic-model
¶
TheoryHiding(*, theory: TheoryExpr, names: tuple[str, ...] = (), line: int = 0, col: int = 0, form: Literal['theory_hiding'] = 'theory_hiding')
Bases: TheoryExpr
e hiding (a, ...): a theory with symbols removed from its exports.
| PARAMETER | DESCRIPTION |
|---|---|
theory
|
The theory.
TYPE:
|
names
|
The hidden sorts and operations.
TYPE:
|
line
|
The source position.
TYPE:
|
col
|
The source position.
TYPE:
|
TheoryIncludeDecl
didactic-model
¶
TheoryIncludeDecl(*, theory: TheoryExpr, options: tuple[OptionEntry, ...] = (), line: int = 0, col: int = 0)
Bases: Model
include e [conservative] in a theory body.
| PARAMETER | DESCRIPTION |
|---|---|
theory
|
The included theory.
TYPE:
|
options
|
The declared classification of the extension.
TYPE:
|
line
|
The source position.
TYPE:
|
col
|
The source position.
TYPE:
|
TheoryInputDecl
didactic-model
¶
TheoryInputDecl(*, names: tuple[str, ...] = (), sort: PatternSyntax, implicit: bool = False, line: int = 0, col: int = 0)
Bases: Model
An input of an operation: a sort, (f : Hom(a, b)), or {a b : Ob}.
| PARAMETER | DESCRIPTION |
|---|---|
names
|
The names of the inputs it declares, empty for one unnamed input.
TYPE:
|
sort
|
Their sort.
TYPE:
|
implicit
|
Whether the inputs are implicit, inferred where the operation is applied rather than written as arguments.
TYPE:
|
line
|
The source position.
TYPE:
|
col
|
The source position.
TYPE:
|
TheoryInstantiation
didactic-model
¶
TheoryInstantiation(*, theory: str, arguments: tuple[TheoryArgument, ...] = (), line: int = 0, col: int = 0, form: Literal['theory_instantiation'] = 'theory_instantiation')
Bases: TheoryExpr
G[P := X via v, ...]: a generic theory instantiated by pushout.
| PARAMETER | DESCRIPTION |
|---|---|
theory
|
The generic theory.
TYPE:
|
arguments
|
One argument per parameter.
TYPE:
|
line
|
The source position.
TYPE:
|
col
|
The source position.
TYPE:
|
TheoryOperationDecl
didactic-model
¶
TheoryOperationDecl(*, name: str, inputs: tuple[TheoryInputDecl, ...] = (), output: PatternSyntax, line: int = 0, col: int = 0)
Bases: Model
An operation name : A, B -> C a theory declares.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The operation's name.
TYPE:
|
inputs
|
Its inputs, in order.
TYPE:
|
output
|
The sort of its result.
TYPE:
|
line
|
The source position.
TYPE:
|
col
|
The source position.
TYPE:
|
TheoryParameterDecl
didactic-model
¶
Bases: Model
A parameter P : S of a generic theory.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The parameter's name.
TYPE:
|
theory
|
The theory the parameter ranges over.
TYPE:
|
line
|
The source position.
TYPE:
|
col
|
The source position.
TYPE:
|
TheoryRef
didactic-model
¶
Bases: TheoryExpr
A theory named by its declaration.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The theory's name.
TYPE:
|
line
|
The source position.
TYPE:
|
col
|
The source position.
TYPE:
|
TheoryRename
didactic-model
¶
Bases: Model
One source => target pair of a renaming.
| PARAMETER | DESCRIPTION |
|---|---|
source
|
The sort or operation renamed.
TYPE:
|
target
|
Its new name.
TYPE:
|
line
|
The source position.
TYPE:
|
col
|
The source position.
TYPE:
|
TheoryRenaming
didactic-model
¶
TheoryRenaming(*, theory: TheoryExpr, renames: tuple[TheoryRename, ...] = (), line: int = 0, col: int = 0, form: Literal['theory_renaming'] = 'theory_renaming')
Bases: TheoryExpr
e renaming (a => b, ...): a copy of a theory with new names.
| PARAMETER | DESCRIPTION |
|---|---|
theory
|
The renamed theory.
TYPE:
|
renames
|
The renamed symbols.
TYPE:
|
line
|
The source position.
TYPE:
|
col
|
The source position.
TYPE:
|
TheorySortDecl
didactic-model
¶
TheorySortDecl(*, name: str, parameters: tuple[TheoryBinderDecl, ...] = (), line: int = 0, col: int = 0)
Bases: Model
A sort a theory declares, Ob or Hom(a b : Ob).
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The sort's name.
TYPE:
|
parameters
|
Its parameters, for a dependent sort.
TYPE:
|
line
|
The source position.
TYPE:
|
col
|
The source position.
TYPE:
|
TheorySum
didactic-model
¶
TheorySum(*, summands: tuple[TheoryExpr, ...] = (), shared: tuple[str, ...] = (), line: int = 0, col: int = 0, form: Literal['theory_sum'] = 'theory_sum')
Bases: TheoryExpr
A + B over C: the colimit of theories over declared shared theories.
| PARAMETER | DESCRIPTION |
|---|---|
summands
|
The theories composed.
TYPE:
|
shared
|
The theories they are declared to share.
TYPE:
|
line
|
The source position.
TYPE:
|
col
|
The source position.
TYPE:
|
ViewAssumptionDecl
didactic-model
¶
Bases: Model
An equation whose obligation a view records as assumed.
| PARAMETER | DESCRIPTION |
|---|---|
equation
|
The equation's name in the view's domain.
TYPE:
|
line
|
The source position.
TYPE:
|
col
|
The source position.
TYPE:
|
ViewDecl
didactic-model
¶
ViewDecl(*, name: str, domain: str, codomain: str, mappings: tuple[ViewMappingDecl, ...] = (), assumptions: tuple[ViewAssumptionDecl, ...] = (), docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['view_decl'] = 'view_decl')
Bases: Statement
view NAME : S -> T with its mappings.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The view's name.
TYPE:
|
domain
|
The theory mapped.
TYPE:
|
codomain
|
The theory mapped into.
TYPE:
|
mappings
|
The image of each sort and operation.
TYPE:
|
assumptions
|
The obligations recorded as assumed.
TYPE:
|
docs
|
Its doc comment lines.
TYPE:
|
line
|
The source position.
TYPE:
|
col
|
The source position.
TYPE:
|
ViewMappingDecl
didactic-model
¶
ViewMappingDecl(*, source: PatternSyntax, target: PatternSyntax, line: int = 0, col: int = 0)
Bases: Model
M => S or mul(x, y) => plus(x, y) in a view.
| PARAMETER | DESCRIPTION |
|---|---|
source
|
A sort or operation name, or an operation applied to distinct variables naming its arguments.
TYPE:
|
target
|
The image: a name, or a term over the source's variables.
TYPE:
|
line
|
The source position.
TYPE:
|
col
|
The source position.
TYPE:
|
DeductionSemiring
didactic-model
¶
DeductionSemiring(*, name: str, instance: str | None = None, theory: str | None = None, line: int = 0, col: int = 0)
Bases: Model
The semiring parameter of a deduction header.
Exactly one of instance and theory is given.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The parameter's name, a label of the deduction.
TYPE:
|
instance
|
The instance the deduction runs in, for
TYPE:
|
theory
|
The theory whose instances the deduction ranges over, for
TYPE:
|
line
|
The source position of the bracket.
TYPE:
|
col
|
The source position of the bracket.
TYPE:
|
SemiringDecl
didactic-model
¶
SemiringDecl(*, name: str, theory: str, algebra: str, carrier: str, assumptions: tuple[ViewAssumptionDecl, ...] = (), docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['semiring_decl'] = 'semiring_decl')
Bases: Statement
semiring I : T = algebra A on C with its assumed laws.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The instance's name.
TYPE:
|
theory
|
The semiring theory it is an instance of.
TYPE:
|
algebra
|
The shipped algebra realizing it, by the name of its law claims
(
TYPE:
|
carrier
|
The kernel type holding its elements (
TYPE:
|
assumptions
|
The laws of
TYPE:
|
docs
|
Its doc comment lines.
TYPE:
|
line
|
The source position.
TYPE:
|
col
|
The source position.
TYPE:
|
LetExprHole
didactic-model
¶
LetExprHole(*, name: str, type_expr: QiecTypeExpr | None = None, line: int = 0, col: int = 0, kind: Literal['let_hole'] = 'let_hole')
Bases: LetExprNode
A value hole ?name or ?name : T.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The hole's name, without the
TYPE:
|
type_expr
|
The goal type written after the hole, or None when the position the hole stands in supplies it.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
QiecTypeHole
didactic-model
¶
QiecTypeHole(*, name: str, line: int = 0, col: int = 0, kind: Literal['qiec_type_hole'] = 'qiec_type_hole')
Bases: QiecTypeExpr
A type hole ?A: an unknown type, distinct from every other type.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The hole's name, without the
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
LetAxisBinder
didactic-model
¶
LetAxisBinder(*, name: str, axis: QiecTypeExpr, line: int = 0, col: int = 0)
Bases: Model
One name : T binder of a tabulation or a reduction.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The name the body reads an element through.
TYPE:
|
axis
|
The finite type it ranges over.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
LetExprReduction
didactic-model
¶
LetExprReduction(*, operator: str, binders: tuple[LetAxisBinder, ...], body: LetExprNode, line: int = 0, col: int = 0, kind: Literal['let_expr_reduction'] = 'let_expr_reduction')
Bases: LetExprNode
The reduction logsumexp over w : World. e.
| PARAMETER | DESCRIPTION |
|---|---|
operator
|
The reduction:
TYPE:
|
binders
|
The binders it reduces over, at least one.
TYPE:
|
body
|
The term reduced.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
LetExprTabulation
didactic-model
¶
LetExprTabulation(*, binders: tuple[LetAxisBinder, ...], body: LetExprNode, line: int = 0, col: int = 0, kind: Literal['let_expr_tabulation'] = 'let_expr_tabulation')
Bases: LetExprNode
The tensor for w : World, s : Subject. e.
Its entry at each element of the binders' types is the body there, so its type is the body's indexed by those types, in canonical axis order.
| PARAMETER | DESCRIPTION |
|---|---|
binders
|
The binders, at least one.
TYPE:
|
body
|
The entry.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
QiecFinType
didactic-model
¶
QiecFinType(*, extent: QiecIndexExpr, line: int = 0, col: int = 0, kind: Literal['qiec_fin_type'] = 'qiec_fin_type')
Bases: QiecTypeExpr
The positional index set Fin n.
| PARAMETER | DESCRIPTION |
|---|---|
extent
|
The number of positions, a natural-number index.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
QiecTensorType
didactic-model
¶
QiecTensorType(*, element: QiecTypeExpr, axes: tuple[QiecTypeExpr, ...], line: int = 0, col: int = 0, kind: Literal['qiec_tensor_type'] = 'qiec_tensor_type')
Bases: QiecTypeExpr
A tensor of a parenthesized element type, (E)[T1, ..., Tk].
A tensor of a named element type is the application Real[World];
this node is the same type when the element is compound.
| PARAMETER | DESCRIPTION |
|---|---|
element
|
The element type.
TYPE:
|
axes
|
The finite types indexing its axes, as written.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
LetExprCaseBranch
didactic-model
¶
LetExprCaseBranch(*, label: str, binder: str | None = None, body: LetExprNode, line: int = 0, col: int = 0)
Bases: Model
One branch l(x) => body of a case function.
| PARAMETER | DESCRIPTION |
|---|---|
label
|
The alternative the branch handles.
TYPE:
|
binder
|
The name its payload is bound to, or None when the branch ignores it.
TYPE:
|
body
|
The branch's result.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
LetExprCaseValue
didactic-model
¶
LetExprCaseValue(*, branches: tuple[LetExprCaseBranch, ...], line: int = 0, col: int = 0, kind: Literal['let_expr_case_value'] = 'let_expr_case_value')
Bases: LetExprNode
A first-class case case { l(x) => e, ... }: a function on a variant.
| PARAMETER | DESCRIPTION |
|---|---|
branches
|
One branch per alternative, in source order.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
LetExprInjection
didactic-model
¶
LetExprInjection(*, label: str, payload: LetExprNode | None = None, line: int = 0, col: int = 0, kind: Literal['let_expr_injection'] = 'let_expr_injection')
Bases: LetExprNode
An injection <l = v> into one alternative of a variant.
| PARAMETER | DESCRIPTION |
|---|---|
label
|
The alternative.
TYPE:
|
payload
|
The value it carries, or None for
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
LetExprProjection
didactic-model
¶
LetExprProjection(*, record: LetExprNode, label: str, line: int = 0, col: int = 0, kind: Literal['let_expr_projection'] = 'let_expr_projection')
Bases: LetExprNode
The field label of a record expression.
A field of a local is written x.label and parses as one dotted
name; this node is the same projection on an arbitrary expression,
which substituting an expression for x produces.
| PARAMETER | DESCRIPTION |
|---|---|
record
|
The record expression.
TYPE:
|
label
|
The field read.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
LetExprRecord
didactic-model
¶
LetExprRecord(*, fields: tuple[LetExprRecordField, ...] = (), base: LetExprNode | None = None, line: int = 0, col: int = 0, kind: Literal['let_expr_record'] = 'let_expr_record')
Bases: LetExprNode
A record {l = v, ...}, or an extension {x with l = v, ...}.
| PARAMETER | DESCRIPTION |
|---|---|
fields
|
The fields written, in source order.
TYPE:
|
base
|
The extended record, or None for a record built from its fields alone.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
LetExprRecordField
didactic-model
¶
LetExprRecordField(*, label: str, value: LetExprNode, line: int = 0, col: int = 0)
Bases: Model
One field label = value of a record expression.
| PARAMETER | DESCRIPTION |
|---|---|
label
|
The field's label.
TYPE:
|
value
|
Its value.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
QiecRecordDecl
didactic-model
¶
QiecRecordDecl(*, name: str, binders: tuple[QiecBinder, ...] = (), type: QiecRecordType, docs: tuple[str, ...] = (), line: int = 0, col: int = 0, kind: Literal['record_decl'] = 'record_decl')
Bases: Statement
record NAME[binders] {row}, a name for a record type.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The record type's name.
TYPE:
|
binders
|
The static telescope the type is over.
TYPE:
|
type
|
The record type it names.
TYPE:
|
docs
|
The doc comment lines attached to the declaration.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
QiecRecordType
didactic-model
¶
QiecRecordType(*, fields: tuple[QiecRowField, ...] = (), tail: str | None = None, line: int = 0, col: int = 0, kind: Literal['qiec_record_type'] = 'qiec_record_type')
Bases: QiecTypeExpr
A record type {l : T, ... | r}.
| PARAMETER | DESCRIPTION |
|---|---|
fields
|
The explicit entries, in source order.
TYPE:
|
tail
|
The row variable standing for further entries, or None.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
QiecRowField
didactic-model
¶
QiecRowField(*, label: str, type: QiecTypeExpr | None = None, line: int = 0, col: int = 0)
Bases: Model
One entry label : T of a row; a bare label carries Unit.
| PARAMETER | DESCRIPTION |
|---|---|
label
|
The entry's label.
TYPE:
|
type
|
Its type, or None for a bare label.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
QiecRowKind
didactic-model
¶
Bases: QiecKindExpr
The kind Row of a row binder.
| PARAMETER | DESCRIPTION |
|---|---|
kind
|
The discriminator; always
TYPE:
|
QiecRowPredicate
didactic-model
¶
QiecRowPredicate(*, left: QiecRecordType, right: QiecRecordType | None = None, result: QiecRecordType | None = None, larger: QiecRecordType | None = None, line: int = 0, col: int = 0, kind: Literal['qiec_row_predicate'] = 'qiec_row_predicate')
Bases: QiecBinder
A row predicate in a static telescope.
| PARAMETER | DESCRIPTION |
|---|---|
left
|
The first operand; a bare row variable
TYPE:
|
right
|
The second part of a combination
TYPE:
|
result
|
The combined row of a combination, or None for a containment.
TYPE:
|
larger
|
The containing row of a containment
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
QiecVariantType
didactic-model
¶
QiecVariantType(*, fields: tuple[QiecRowField, ...] = (), tail: str | None = None, line: int = 0, col: int = 0, kind: Literal['qiec_variant_type'] = 'qiec_variant_type')
Bases: QiecTypeExpr
A variant type <l : T, m, ... | r>.
| PARAMETER | DESCRIPTION |
|---|---|
fields
|
The explicit alternatives, in source order.
TYPE:
|
tail
|
The row variable standing for further alternatives, or None.
TYPE:
|
line
|
The 1-based source line, or 0 when unknown.
TYPE:
|
col
|
The 0-based source column, or 0 when unknown.
TYPE:
|
kind
|
The discriminator; always
TYPE:
|
atom_to_draw_arg
¶
Lift a plain Python value into the DrawArg it denotes.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
A name, a number, or an argument that is already a
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
DrawArg
|
A |
| RAISES | DESCRIPTION |
|---|---|
TypeError
|
If |
Source code in src/quivers/dsl/ast_nodes/program_steps.py
fin_tensor
¶
fin_tensor(element: QiecTypeExpr, extents: tuple[QiecIndexExpr, ...]) -> QiecTypeExpr
The positional tensor type element[Fin e1, ..., Fin ek].
| PARAMETER | DESCRIPTION |
|---|---|
element
|
The element type.
TYPE:
|
extents
|
One extent per axis, outermost first.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
QiecTypeExpr
|
The application |