Query execution and completeness
The Query execution and completeness contract — QEC — determines the realization of reducers and paths already admitted by the language. It keeps the QueryAnswer status, the identities and qualifications of results, the query’s multiplicity and its completion criteria.
Its jurisdiction covers COUNT, SUM, MIN, MAX, execution of path, the affected result carriers and the acceptance interface of those capabilities. The contract is subordinate to the foundations, the Query capability, the current concrete surface and the conformance and formal obligations contracts. The specialization does not redefine Reasoning aggregates, the storage model or the general type system.
Binding and definition of values
The binding environment is a partial map of Query variables to Query values. An absent variable produces Q-UNBOUND. An expression or reducer without a defined result produces Q-UNDEFINED, accompanied by the pertinent reason. These are different situations from value, epistemic unknownness or semantic null.
In partial projection, Q-VALUE(v) binds the destination to v. Q-UNBOUND keeps the solution without binding the destination. Q-UNDEFINED(r) also keeps the solution and leaves the destination absent, keeping the reason when it participates in the consumer’s observation profile.
The lexical and semantic classes of integer, decimal, quantity, string and boolean remain distinguishable through elaboration. The executor cannot reconstruct them by trying to interpret strings after losing that distinction.
The formation of a reducer establishes ReducerDomainAdmissible(expression, operator, basis) and obtains an exact reference to a domain contract or a typed refusal. Admission precedes execution. The Rust type, a declaration’s name, the provider’s payload and the parser’s success do not replace that judgment.
Identity of the operators
The four reducers use exact identities of the language’s operator basis. The spelling of a host function or the presence of a homonymous reducer in Reasoning does not select the Query contract.
Counting
The contract distinguishes COUNT_SOLUTIONS, COUNT_BOUND(expr) and COUNT_DISTINCT_BOUND(expr). The form COUNT(expr) realizes COUNT_BOUND(expr), unless another exact surface contract expressly designates the counting of solutions.
Each solution whose argument produces Q-VALUE contributes one. Unbound or undefined arguments contribute zero. An unsupported expression translation is refused; it is not replaced by counting of solutions.
Sum
SUM requires a domain contract D with additive identity and an addition operation closed in D. The required laws include left and right identity, associativity and commutativity sufficient to preserve the result regardless of the representation and the physical order of iteration.
The denotation is exact. Physical overflow, saturation, circular return, floating-point approximation and provider coercion do not become the semantics of the sum. The chosen mechanism must realize the admitted contract or present the corresponding failure condition.
Minimum and maximum
MIN and MAX require a determining total order over the admitted domain or its equivalence classes, with comparison consistency, transitivity and antisymmetry modulo value equivalence. The language does not establish a universal total order between different domains.
Input policy and groups
In the synthesized H1 Query contract, the input policy of the reducers SUM, MIN and MAX is REJECT_NONVALUE, when there is no other admitted explicit policy. Domain values participate; unbound, undefined or out-of-domain argument makes the reducer’s result Q-UNDEFINED. The runtime does not silently choose to ignore the item or substitute a default value.
A defined reducer binds its alias. An undefined reducer keeps the group solution, leaves the alias absent and preserves the material definition observation. Undefinedness does not remove the group nor create zero, empty string, sentinel reference or null.
Without key expressions, the aggregation stage has exactly one global group, including over an empty input family. For an existing empty group, COUNT produces zero; SUM, the domain’s additive identity; MIN and MAX, Q-UNDEFINED(EMPTY_REDUCTION). Explicit keys do not authorize fabricating groups without an admitted key observation.
Keys without value use Query’s local absence and definition classes. Where both are material, GroupKey::Unbound and GroupKey::Undefined stay distinct. Those structural categories are not semantic values of the domain.
Coherence of the aggregation stage
An aggregation locus corresponds to a stage coherent in source solution family, key expressions, reducer specifications and the having condition. All reducers of the stage consume the same family prior to aggregation. The order of an implementation loop does not create accidental nested aggregations.
Every authored key has an executable correspondence or generates a typed refusal. Silently omitting a key changes the group’s meaning.
The aggregate’s completion depends on the completion of the input family required by the criterion. This profile does not introduce a partial aggregation policy: an incomplete input does not sustain a complete aggregate.
Structure of paths
The realization of a path keeps its variable, ends, composed expression, relations and incidence steps, repetition bounds, empty-path policy, alternative multiplicity, reuse, selector, local predicates, summaries, material fields and revision basis. Each coordinate stays directly accessible, referenced with exactness or realized through a verified representation bridge.
An atomic step traverses an admitted relation occurrence through the exact roles from_role and to_role. The current position must correspond to the origin role’s incidence; the next position is the same occurrence’s destination role’s incidence. Finding the same value at any other role does not satisfy that step.
Each selected step produces a TraversalOccurrence local to Query. Its structure allows recovering the relation’s instance and contract, origin and destination roles and values, participation evidence when available and material qualifications. It is not a physical edge nor a participation semantic identity fabricated by the executor.
QueryPathValue preserves the ordered traversals, the ends, the lineage and the path’s equivalence basis. QueryPathGroupValue preserves the repetition segments in order and the material nested structure. Flattening segments that are distinguishable by each, summaries, equality or another consumer changes the contract.
An empty path contains zero traversals and one known end that is simultaneously origin and destination. Its introduction requires an already bound end or a contract explicitly complete for the domain of ends. Failure or absence of path does not create an empty path; the executor also does not invent a referent to represent it.
Alternatives, equivalence and reuse
Multiset alternatives keep the multiplicity derived from the branches. Set alternatives collapse paths only when the contracted comparison establishes equivalence. The comparison admits EQUIVALENT, DISTINCT and UNRESOLVED; an unresolved relation is not converted into equivalence or difference when that decision affects the conclusion.
Equivalence depends only on the contract’s material coordinates and stays representation-invariant. Repetition segment bounds participate in the comparison when observable. Collapsing equivalent content does not authorize losing lineage required by the query.
References of reuse, selector and alternative using traverse acyclic contractual chains up to a Query capability root authorized by the language revision. The custom declaration’s identity is kept. Spelling, label, self-declaration, runtime enum or fixture convention do not demonstrate the capability. Cycle or absence of admitted root implies refusal.
The profile distinguishes four policies: REPEATABLE, NO_REPEAT_RELATION_INSTANCE, NO_REPEAT_SEMANTIC_REFERENT and NO_REPEAT_PARTICIPATION_OCCURRENCE. The evaluation produces REUSE_ALLOWED, REUSE_REJECTED or REUSE_UNRESOLVED.
When the relation or role contract does not determine the comparison of participation occurrences, that boundary keeps the unresolved state. Relation identity, role name, array position, serialization key and physical record are not authorized substitutes for participation identity.
Selectors and completion criteria
The standard selectors operate over the exact family of admissible paths of a correlated invocation.
| Selector | Completion criterion |
|---|---|
ALL | The relevant family of admissible paths is determined and closed. |
ANY | One admitted path can satisfy the selection; a pathless answer requires closure evidence. |
ONE_SHORTEST | There is an admitted path of length L and evidence that no shorter path remains possible. |
ALL_SHORTEST | Besides determining the minimum length L, all admissible paths of that length are determined. |
Unresolved candidates affect completeness whenever they could change the selector’s result. The default length counts semantic atomic steps, not storage edges, bytes, cost or provider hops.
Shortest-path selection by end, group or partition requires its own contract. The implementation does not create that partitioning based on debug values, visible bindings or coincidence of ends.
Before checking the selector, candidate coverage is verified in both directions: every generated candidate corresponds to a normative path; every normative candidate is generated or is explicitly accounted as unresolved or incomplete. A correct selector over a subset chosen by the executor itself does not suffice.
Repetition and correlated evaluation
Unbounded repetition requires the finiteness, completeness or flow condition admitted by the exact contract and the restriction, reuse, selection or domain contracts. Queue limits, gas, timeout and the representation’s occurrence count do not replace that semantic condition.
The evaluation receives the current binding environment. Ends and already visible bindings restrict generation by ordinary compatibility. Traversing the whole space without correlation and overwriting bindings afterwards is only admissible with demonstrated equivalence under the complete observation profile.
The semantic sequence is: candidates; local predicates; admissibility by reuse and restriction; admissible family; selector; selected family; external post-filter. An operational reordering must preserve that interpretation sequence.
each traverses the repetition group’s ordered segments, not raw occurrence tokens defined by executor convention. Summaries remain Query and reuse the same reducer contracts. Length and default count measure the path’s semantic structure.
Public results and machine representation
The public carrier distinguishes semantic values, relational occurrence values, traversals, paths, path groups and other Query-local structures admitted by the Query contract. A Query-local structure is not promoted to a domain entity reference because both can be serialized.
When the alias is absent by undefinedness, the output keeps the observation or reason required by the consumer profile. The machine representation revision 0 stays frozen. Structured Query values use revision 1 or a compatible successor route, with explicit discrimination; they are not encoded as generic references.
An evaluation uses a compatible chain of revisions of the Query contract, reducer domains, paths contract, reuse and selection policies, relations and roles, Query basis and public provenance. Mixing revisions requires explicitly verified correspondence or transition.
Gas exhaustion, absence of complete correspondence, empty result, partiality, unresolved reuse and value undefinedness remain different situations. A semantically admitted source can be refused by a realization not yet having the needed capability; that refusal is not a complete conclusion.
Budget of laws and scope
Requirements of this contract’s core are the Query jurisdiction, the answer status, the partial-binding distinction, semantic identity, native incidence paths, multiplicity and lineage, completeness relative to the basis and the exact value and operator contracts. Acceptance requires evidence independence from the examined defect.
Reducer domain algebras, custom policies, partitioned shortest paths and partial or streaming aggregation policies belong to explicit specializations. Host equality, host ordering, physical keys and execution termination do not provide those laws implicitly.
The QEC scope does not close a universal numeric algebra, unit conversions, weighted-least-cost analysis, arbitrary stateful traversal programs, path distribution or federation, a cost optimizer or a new mechanization of obligations FO-L3-02 and FO-L3-03.
Acceptance interface
The QEC contractual index of the 43 obligations keeps the exact spelling of each identity, its proposition reference and its determination class. The index is an editorial traceability map, not a new normative record nor an execution attestation.
The sufficiency root gathers all 43 active obligations: QA-V01 to QA-V04, QA-A01 to QA-A12, QP-C01 to QP-C06, QP-R01 to QP-R04, QP-M01 to QP-M03, QP-S01 to QP-S06, QP-L01 to QP-L03 and QX-01 to QX-05. Removing an obligation, changing its class or weakening its proposition requires the corresponding decision of the higher authority.
Each normative case fixes program, contract, basis, revisions, expressions, official satisfaction relations, input family, witnesses, lineage and material policies. The executable case must come from the real route of source, resolution, elaboration, bridge and execution. A synthetic executor can serve as independent oracle, but does not represent the production route that must be demonstrated.
The representation bridge is bidirectional and indexed by the obligation. For each material normative coordinate there must be executable representation; each material executable coordinate must correspond to a normative coordinate. The bridge preserves the observable role and does not introduce authority or status absent from the origin case. Materiality is determined by data and control flow and by relevant perturbations, not by a self-declared field.
The closed universe QECMaterialCoordinate covers literal classes and type evidence; expression and operator identities; argument, key, alias, input policy, domain and origin of the aggregation stage; presence, definition and lineage; path bindings and ends; steps and roles per position; repetition and segments; multiplicity, reuse, selector, predicates, summaries, qualifications and correlation evidence; equivalence and completion; contract and basis revisions; public value category, public definition observation and machine schema revision.
The official comparison boundary of occurrences admits exactly SAME_OCCURRENCE, DISTINCT_OCCURRENCE and OCCURRENCE_RELATION_UNRESOLVED. The last must propagate to REUSE_UNRESOLVED when material. A comparison by relation identity or physical record could only be used through a specific verified bridge; it is not standard equivalence.
Formation, execution and discrimination
AH1 separates the duties of formation and execution: QA-A02 verifies the sum domain’s preconditions; QA-A11, the executed sum and its invariance by physical order. QA-A03 verifies the order required by minimum and maximum; QA-A12, the extremes actually produced.
QP-R02 requires discriminating witnesses for each of the six unordered pairs of the four standard reuse policies. QP-R03 requires inhabited cases for the three comparison outcomes, including the unresolved one. QX-02 requires candidate coverage in both directions before attributing correctness to the selector.
The evidence classes are: static correspondence audit; hostile property or test executed on the production route; independent differential oracle; public end-to-end witness; machine schema revision witness; and authority routing audit in the repository.
The minimal cases include literal classes, host-arithmetic versus admitted-domain discord, physical permutation of the sum, unbound versus undefined, empty global group, two reducers over the same source, expression counting, unsupported key, same value at different roles, occurrences sharing referents, unresolved correlation, six reuse discriminations, set versus multiset, segments with same flattening, unvisited smaller candidate, several equal shortest paths, previously bound end, cycles with different policies, unbounded repetition without basis, misleading policy name, using cycle, incompatible revisions and revision-1 structure refused by revision 0.
Integrity of the acceptance contract
The canonical propositions of OBLIGATIONS.toml have frozen material fields: identification, state, authority, class, formal determination, proposition, quantifiers, context, official carriers, bridge, antecedent, consequent, assumptions, forbidden laws, artifact class, non-vacuity, forbidden substitutes, identity and acceptance form, evidence classes and failure condition.
The canonical digest of those fields is verified independently of the file manifest. Regenerating checksums does not authorize weakening a proposition. The validator’s identity also belongs to the trust basis identified by the package.
The mutation battery must refuse: swapping a proposition for a trivial one; downgrading the class; substituting opaque occurrence by relational proxy; omitting an obligation; making the bridge unidirectional; reducing the six discriminations to one; omitting the unresolved case; changing a ratified decision; reclassifying a current obligation as non-mechanizable; satisfying routing by contradictory marker; withdrawing an exact authority block; or altering a frozen block.
Closure condition
Executable closure gathers evidence of the 43 obligations, contract validator, adversarial mutations, pertinent Rust verifications, Query-specific properties, independent reducer and path oracles, complete public witnesses, per-revision schemas and a new hostile review of the affected surface.
FO-L3-02, of lineage and multiplicity, and FO-L3-03, of completion and selectors, can be revalidated by that evidence and remain DEFERRED-NON-BLOCKING until there is a campaign of their own demonstrating the mechanization. A documentary report does not change their class.
The implementation authorization of the original package requires ratified decisions, preserved AH1 interface, adversarial review, mutations, validator, freeze and real authority routing. In documentary succession, those requirements are transferred together with their propositions and verification assets; the production of this page does not declare a new execution of those gates.