FormaSL - R2 Aggregate Correlation Bounded Amendment
Status: STABLE / MATERIALIZED - CURRENT (aggregate group-component locus)
Materialized: 2026-09-20 from campaign package formasl-r2-aggregate-semantic-closure-v0.2 file 02-R2-AGGREGATE-CORRELATION-AMENDMENT.md
Parent owners: current Reasoning and Concrete Language Surface authorities
Owner decision: OD-RC-R2-AGG-03
Scope: R2 rule aggregate group formation, member correlation, group binder identity and aggregate-value reference origin only
1. Jurisdiction
This amendment closes one demonstrated under-specification:
GROUP EXISTENCE
!= GROUP KEY VALUE
!= SOURCE MEMBER KEY
!= MEMBER-TO-GROUP CORRELATION
It does not reopen aggregate operator identity, exact static source identity, DISTINCT_REASONING_CONTENT_SET multiplicity, lower-stratum completion, aggregate floors or general Reasoning architecture.
Historical post-P9 artifacts remain frozen evidence and are not edited to retroactively contain this decision.
2. Semantic identities
R2 aggregate grouping distinguishes:
RuleBinderIdentity
SourceRoleIdentity
with:
RuleBinderIdentity != SourceRoleIdentity
Equal display spelling and equal declared type do not establish correspondence.
3. Complete grouping modes
3.1 MemberDerived
MemberDerived {
member_key: SourceMemberProjection,
output_binder: optional OuterBinder
}
A source member establishes every MemberDerived group coordinate. No surviving source member means no complete group containing a MemberDerived coordinate.
The optional output binder exists only when explicitly authored with as ?binder; it is not inferred from the source-role name.
3.2 SeededCorrelated
SeededCorrelated {
seed_key: OuterBinder,
member_key: SourceMemberProjection
}
The outer binder establishes the seeded group coordinate. A source member contributes iff it belongs to the exact aggregate source and its resolved member projection equals the seed value.
OuterSeed without a member projection is not an admitted final grouping mode.
4. Rule-aggregate authored surface
Replace the correlation-bearing by component locus with:
aggregate_group_component =
source_member_projection [ "as" witness_variable ]
| witness_variable ;
The by list remains in structural tuple order.
Examples:
by T.region
by T.region as ?region
by T.region as ?r, T.account as ?a
by ?r
This amendment changes only rule-level aggregate grouping. Query aggregate syntax is unchanged.
5. Independent positive binding
For classifying by Source.role as ?v, an independent positive binding is a binding that establishes ?v in the outer substitution independently of that aggregate group component.
The current R2 v1 minimum is a positive when atom binding ?v.
An already-authoritative explicit finite-domain binder also counts only when the live R2 contract and executable formation already establish it before aggregate evaluation.
The following are not independent bindings:
head occurrence
naf-only occurrence
where-only occurrence
aggregate result
another aggregate result
MemberDerived output binder
rule parameter declaration by itself
name/type coincidence
6. Surface mapping
by T.region
MemberDerived(member=T.region, output_binder=none)
No binder named ?region is synthesized.
by T.region as ?r
If IndependentPositiveBinding(?r):
SeededCorrelated(seed=?r, member=T.region)
Otherwise:
MemberDerived(member=T.region, output_binder=?r)
The output binder is introduced after group selection and is available to post-aggregate rule where evaluation and head instantiation. It is not independent seed authority for another aggregate.
by ?r
Compatibility shorthand only.
Collect the set of DISTINCT exact-source role identities explicitly bound to ?r by positive when atoms in the whole semantic rule.
1 role -> canonicalize to SeededCorrelated(?r, role)
0 roles -> AGGREGATE_GROUP_CORRELATION_REQUIRED
>1 -> AMBIGUOUS_AGGREGATE_GROUP_CORRELATION
Repeated occurrences of the same exact role do not create ambiguity.
7. Binder-collision rules
If as ?v is MemberDerived output binding:
- one binder may be introduced by at most one MemberDerived component in one rule;
- it must not equal that aggregate’s result binder;
- duplicate/new-output collision rejects as
AGGREGATE_GROUP_BINDER_COLLISION.
If ?v is independently positive, the same seed binder may appear in multiple SeededCorrelated components; each member role must equal that same seed value.
No hidden equality relation is introduced between two MemberDerived coordinates.
8. Tuple grouping
Resolve each component independently.
All-seeded tuple:
valid outer tuple -> existing group even with zero contributors
Mixed tuple:
seeded dimensions filter source members
MemberDerived dimensions come only from surviving members
no survivor -> no complete mixed group
No default coordinate is manufactured.
9. Aggregate value references
Aggregate value expressions preserve origin:
OuterVariable(RuleBinderIdentity)
SourceMemberRole(SourceRoleIdentity)
Thus:
OuterVariable(?amount) != SourceMemberRole(T.amount)
even with equal display spelling.
Evaluation uses separate logical outer/member environments. Source-member values never overwrite unrelated outer bindings because names collide.
10. Invariance laws
Capture-avoiding rule-binder alpha-renaming preserves aggregate denotation modulo renamed binder identities while SourceRoleIdentity remains fixed.
Textual clause order, positive body atom order, source declaration order and role declaration order have no authority to choose correlation when the same semantic dependency graph remains.
11. Forbidden interpretations
Zero semantic authority:
correlation by name/spelling
first matching role
first matching body atom
source text order
role declaration order
type compatibility as role selection
implicit group binder from Source.role spelling
aggregate-to-aggregate seed by runtime sequence
MemberRole prebinding through same-name outer substitution
untagged outer/member namespace
runtime guessing of unresolved correlation
12. Existing authority disposition
OD-RC-R2-AGG-01 remains unchanged.
OD-RC-R2-AGG-02 remains authoritative for exact source, operator/value/group-key purpose, polarity, multiplicity, lower completion, group existence and floors except for any interpretation that leaves member correlation or binder identity to name/order/runtime inference.
Historical correlation by name in REMEDIATION-02R.md remains historical implementation evidence, not current general authority. As general semantic authority it is superseded by this amendment and OD-RC-R2-AGG-03.
D-0010 remains valid for the unique exact-source authored-binding subclass through compatibility shorthand.
13. Implementation locality
The amendment does not authorize a global binder/role identity subsystem, global binding framework, whole expression-system rewrite, new planner/runtime or storage architecture.
Concrete minimal execution constraints are in the campaign carrier 17-IMPLEMENTATION-NONDECISION-CONTRACT.md; repository semantics remain governed by this amendment and the existing parent owners.
AGG-02 implementation therefore must remain aggregate-local: no global BinderId/RoleId registry, no global binding framework, no shared untagged outer/member value namespace, no aggregate-to-aggregate seed-by-order authority, and no third grouping mode.
14. Reopen trigger
Reopen only on a material counterexample showing that the two-mode model cannot express already-authoritative R2 aggregate behavior without a new semantic mechanism.