RFC-0049 · Reference catalog
Versioned draft snapshot
RFCs, reference catalogs, and evidence reflect Spec 3b2e3e7a114fb826b1445d39a48756b8fff629cd. Counts and pending/status notes belong to that snapshot. Read the dated project update for later progress.
Source repositories are private during staging. Links marked “repository access required” need access to the linked repository.
Generated reference catalog. This page renders structured Lean data for RFC-0049: defined terms, diagnostics, dependencies, and invariants. It does not establish proof coverage or runtime conformance. The authored narrative lives in
RFC-0049.This page is generated from the
lean/Gnomon/Spec/module for RFC-0049. Edit that source and regenerate this catalog.
Title: Projection Algebra
Status: draft
Owners: Compiler, Graph Platform, Module Platform
Diagnostic range: M49000-M49099
Depends on: RFC-0001, RFC-0006, RFC-0007, RFC-0008, RFC-0010, RFC-0024, RFC-0033, RFC-0036, RFC-0037, RFC-0038, RFC-0039, RFC-0040, RFC-0042, RFC-0048
Proof citations in source: 17 / 17. Standalone proof verification is pending.
Definitions
| Term | Meaning |
|---|---|
| Aggregation | A function Subgraph → Scalar | Tuple; the single boundary at which the algebra exits the closed carrier and produces a non-gnomon value. |
| Carrier | The set of all gnomons in the runtime; the graph (graph.resource ∪ graph.statement) at a given system time and valid time is the carrier instance. |
| Closure projection | A projection that walks edges to expand a subgraph (traversal, transitive closure). |
| Composition projection | A projection that combines two or more input subgraphs (∪, ∩, \, ⋈). |
| Materialization | The boundary operation that converts a subgraph to a wire-form value; preserves structure but flattens to a serializable form. |
| Projection | A typed function Subgraph → Subgraph satisfying closure: every output is a valid input to another projection. |
| Provenance projection | The named projection provenance(a) that returns the template-instantiation lineage subgraph rooted at any gnomon. |
| Query | A typed, named declaration that exposes a parameterized projection as a callable read operation. |
| Refinement projection | A projection that filters or restricts an input subgraph (σ, π, ρ). |
| Source projection | A projection that takes the empty subgraph plus parameters and produces a subgraph derived from the carrier. |
| Subgraph | A set of gnomons: zero or more object-gnomons and zero or more edge-gnomons. Every projection’s input and output is a subgraph. |
Diagnostics
| Code | Severity | Description |
|---|---|---|
M49010 | Error | Subgraph violates edge-endpoint closure: an edge references a vertex not in the subgraph |
M49020 | Error | Source projection attempted across tenant boundaries |
M49021 | Info | Source projection excluded gnomons due to predicate-policy authorization (emitted with —verbose-projection) |
M49030 | Error | Composition ∩ or \ mixes subgraphs with mismatched bitemporal qualifiers |
M49031 | Error | traverse mixes subgraphs with mismatched bitemporal qualifiers |
M49040 | Info | Aggregation on empty subgraph returned null for avg/min/max; consider explicit default in caller |
M49050 | Error | Materialization cannot satisfy declared returns type (subgraph shape mismatch) |
M49060 | Warning | Projection cannot be compiled as view or reactive due to non-pure structure; falling back to live |
M49070 | Defect | service/system-auth projection result was returned across a principal boundary without re-filtering — potential data leak |
M49080 | Error | Query declaration body contains side effects or non-projection operators |
M49090 | Error | Mutation attempts direct write to graph.resource or graph.statement; mutations MUST use templates |
M49100 | Error | Projection body is imperative (sequenced statements); projections MUST be pure expressions |
M49110 | Warning | service-auth projection crosses tenant boundary; audit emission (RFC-0047) is mandatory |
M49120 | Warning | Operator precedence ambiguous; recommend explicit parentheses |
M49130 | Error | Bitemporal qualifier references a future time without explicit permitFuture: true annotation |
M49140 | Error | groupBy partition count exceeds the configured cardinality limit (default 10000) |
Dependency neighborhood
graph LR
nRFC_0049["RFC-0049"]
nRFC_0001["RFC-0001"]
nRFC_0049 --> nRFC_0001
nRFC_0006["RFC-0006"]
nRFC_0049 --> nRFC_0006
nRFC_0007["RFC-0007"]
nRFC_0049 --> nRFC_0007
nRFC_0008["RFC-0008"]
nRFC_0049 --> nRFC_0008
nRFC_0010["RFC-0010"]
nRFC_0049 --> nRFC_0010
nRFC_0024["RFC-0024"]
nRFC_0049 --> nRFC_0024
nRFC_0033["RFC-0033"]
nRFC_0049 --> nRFC_0033
nRFC_0036["RFC-0036"]
nRFC_0049 --> nRFC_0036
nRFC_0037["RFC-0037"]
nRFC_0049 --> nRFC_0037
nRFC_0038["RFC-0038"]
nRFC_0049 --> nRFC_0038
nRFC_0039["RFC-0039"]
nRFC_0049 --> nRFC_0039
nRFC_0040["RFC-0040"]
nRFC_0049 --> nRFC_0040
nRFC_0042["RFC-0042"]
nRFC_0049 --> nRFC_0042
nRFC_0048["RFC-0048"]
nRFC_0049 --> nRFC_0048
Invariants
- Aggregations are scalar/tuple producers and cannot feed back into the projection algebra; closure ends at aggregation. (enforced by: compile-time)
- Composition operators reject or normalize subgraphs whose bitemporal qualifiers differ; traverse rejects mismatches outright. (enforced by: compile-time + runtime)
- Every edge-gnomon in a subgraph references vertices that are also in that subgraph; subgraphs are self-contained. (enforced by: compile-time + runtime)
- Every projection operator handles the empty subgraph gracefully, returning empty or zero rather than throwing. (enforced by: runtime)
- Every projection’s output is a valid input to another projection; aggregation and materialization are the only exit points. (enforced by: compile-time)
- Every source projection is filtered by the active session’s tenant context; cross-tenant gnomons are unreachable. (enforced by: runtime + RLS)
- Mutation invocations require an idempotency key so that replays remain safe. (enforced by: runtime)
- Mutations MUST be expressed as one or more template invocations and MUST NOT directly write graph.resource or graph.statement. (enforced by: compile-time + runtime)
- Mutations MUST emit template-instance-of, template-with, and module-installed-by provenance for every gnomon they create. (enforced by: runtime)
- Projection bodies are pure expression trees with no imperative or mutating steps. (enforced by: compile-time)
- Projections cannot cross tenant boundaries except through explicitly elevated service-scoped projections with mandatory audit emission. (enforced by: compile-time + runtime)
- Query declarations MUST NOT have side effects; their bodies must be purely projective and idempotent. (enforced by: compile-time)
- Source projections exclude gnomons the principal cannot read under predicate-policy authorization. (enforced by: runtime)
- When no bitemporal qualifier is given, projections default to asOf(now()).validAt(now()) and propagate qualifiers consistently. (enforced by: compile-time + runtime)
Normative Statements
Statements are structured source data. Proof citations, where present, have not passed a standalone Gnomon proof gate.
Aggregation
- MUST_NOT — Aggregation outputs are not subgraphs and cannot feed back into the projection algebra.
- MUST — Aggregations honor authorization by excluding unreadable gnomons, producing principal-relative aggregates. (proof citation:
rfc0049_aggregation_honors_auth; verification pending)
Bitemporal Qualifiers
- MUST — Authors wanting explicit mixed-time analysis must use named projections that materialize into a comparison form rather than algebraic mixing. (proof citation:
rfc0049_mixed_time_via_named_projection; verification pending) - MUST — Composition operators on subgraphs with different bitemporal qualifiers must normalize per defined rules. (proof citation:
rfc0049_qualifier_normalization_total; verification pending) - MUST — Inputs to traverse must have matching bitemporal qualifiers; mismatch is an error. (proof citation:
rfc0049_traverse_requires_match; verification pending)
Composition Rules and Invariants
- SHOULD — Compilers should optimize using the algebraic identities for union, intersection, and difference with the empty subgraph. (proof citation:
rfc0049_subgraph_identities; verification pending) - MUST — Projection bodies must be pure expression trees, not sequences of mutating statements. (proof citation:
rfc0049_projections_are_pure; verification pending) - MUST_NOT — Projections must not cross tenant boundaries; cross-tenant analysis requires explicit service-scoped elevation and audit.
Materialization
- MUST — Materialize evaluates predicate-policy permissions at every gnomon boundary; unauthorized gnomons are dropped. (proof citation:
rfc0049_materialize_honors_policy; verification pending) - MUST_NOT — Null is never emitted on the wire; optional absent fields are omitted. (proof citation:
rfc0049_no_null_on_wire; verification pending)
Mutation Declarations
- MUST — A mutation must be expressed as one or more template invocations; direct writes to graph.resource or graph.statement are forbidden. (proof citation:
rfc0049_mutation_via_template; verification pending) - MUST — A mutation must produce provenance for every gnomon created. (proof citation:
rfc0049_mutation_produces_provenance; verification pending) - MUST — A mutation must require an idempotency key so replays are safe.
Query Declarations
- MUST — A query must be idempotent — same inputs return the same value modulo carrier motion.
- MUST_NOT — A query must not have side effects; compilers must reject non-purely-projective query bodies. (proof citation:
rfc0049_query_no_side_effects; verification pending) - MUST — A query must respect authorization — the principal’s view of the carrier scopes the projection. (proof citation:
rfc0049_query_scoped_by_principal_view; verification pending)
Refinement Projections
- MUST_NOT — Refinement projections never add gnomons to a subgraph. (proof citation:
rfc0049_refinement_never_adds; verification pending)
Source Projections
- MUST — Every source projection is filtered by the active session’s tenant context; cross-tenant gnomons are unreachable. (proof citation:
rfc0049_source_projection_tenant_scoped; verification pending) - MUST — Source projections honor bitemporal qualifiers, defaulting to asOf(now()).validAt(now()) when none given. (proof citation:
rfc0049_source_projection_bitemporal_default; verification pending) - MUST — Source projections honor predicate-policy authorization, excluding gnomons the principal cannot read. (proof citation:
rfc0049_source_projection_predicate_policy; verification pending)
The Closure Property
- MUST — Every projection’s input and output is a subgraph (subgraph-in / subgraph-out closure).
- MUST — For every edge in a subgraph, both endpoints must be in the subgraph’s vertex set.
The projection Declaration Kind
- MUST — Service- or system-scoped projections returning principal-restricted gnomons must be wrapped by a query that re-applies user-level filtering. (proof citation:
rfc0049_service_scoped_requires_user_wrapping; verification pending)
Linked References
| Direction | Target |
|---|---|
| Depends on | RFC-0001 |
| Depends on | RFC-0006 |
| Depends on | RFC-0007 |
| Depends on | RFC-0008 |
| Depends on | RFC-0010 |
| Depends on | RFC-0024 |
| Depends on | RFC-0033 |
| Depends on | RFC-0036 |
| Depends on | RFC-0037 |
| Depends on | RFC-0038 |
| Depends on | RFC-0039 |
| Depends on | RFC-0040 |
| Depends on | RFC-0042 |
| Depends on | RFC-0048 |