Skip to content

Commit 1ed1089

Browse files
authored
Merge pull request #2840 from fermga/copilot/update-documentation-references
Consolidate Grammar to grammar.py and Remove Deprecated Code
2 parents 5578652 + 234d842 commit 1ed1089

31 files changed

+2118
-8658
lines changed

AGENTS.md

Lines changed: 703 additions & 109 deletions
Large diffs are not rendered by default.

ARCHITECTURE.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,67 @@ flowchart TB
111111
DTEL --> MMOD
112112
```
113113

114+
## Grammar System Architecture
115+
116+
### Single Source of Truth
117+
118+
The TNFR grammar system follows a strict information hierarchy:
119+
120+
1. **UNIFIED_GRAMMAR_RULES.md**: Complete physics derivations (ultimate source)
121+
2. **grammar.py**: Canonical implementation
122+
3. **grammar.py**: Backward compatibility layer (deprecated)
123+
4. **canonical_grammar.py**: Legacy alias (deprecated)
124+
125+
### Design Principles
126+
127+
- **No Duplication**: All grammar logic in one place
128+
- **100% Physics-Based**: Every rule from nodal equation/invariants
129+
- **Traceability**: Clear derivation chain from physics to code
130+
- **Testability**: All constraints independently testable
131+
132+
### Invariants
133+
134+
**Grammar Invariant #1:** grammar.py is the only module that implements validation logic.
135+
136+
**Grammar Invariant #2:** All operator sets (GENERATORS, CLOSURES, etc.) defined once in grammar.py.
137+
138+
**Grammar Invariant #3:** Every constraint has explicit physics derivation in UNIFIED_GRAMMAR_RULES.md.
139+
140+
### Unified Canonical Constraints (U1-U4)
141+
142+
All grammar rules emerge inevitably from the nodal equation **∂EPI/∂t = νf · ΔNFR(t)** and TNFR invariants:
143+
144+
#### U1: STRUCTURAL INITIATION & CLOSURE
145+
- **U1a**: Start with generators {AL, NAV, REMESH} when EPI=0
146+
- **U1b**: End with closures {SHA, NAV, REMESH, OZ}
147+
- **Basis**: ∂EPI/∂t undefined at EPI=0, sequences need coherent endpoints
148+
149+
#### U2: CONVERGENCE & BOUNDEDNESS
150+
- If destabilizers {OZ, ZHIR, VAL}, then include stabilizers {IL, THOL}
151+
- **Basis**: ∫νf·ΔNFR dt must converge (integral convergence theorem)
152+
153+
#### U3: RESONANT COUPLING
154+
- If coupling/resonance {UM, RA}, then verify phase |φᵢ - φⱼ| ≤ Δφ_max
155+
- **Basis**: AGENTS.md Invariant #5 + resonance physics
156+
157+
#### U4: BIFURCATION DYNAMICS
158+
- **U4a**: If triggers {OZ, ZHIR}, then include handlers {THOL, IL}
159+
- **U4b**: If transformers {ZHIR, THOL}, then recent destabilizer (~3 ops)
160+
- **Basis**: Contract OZ + bifurcation theory
161+
162+
**Complete Reference**: See [UNIFIED_GRAMMAR_RULES.md](UNIFIED_GRAMMAR_RULES.md) for detailed physics derivations.
163+
164+
### Migration from Old Systems
165+
166+
The unified grammar consolidates two previously separate systems:
167+
168+
- **C1-C3 System** (in `grammar.py`) - Deprecated
169+
- **RC1-RC4 System** (in `canonical_grammar.py`) - Deprecated
170+
171+
**New Unified System** (U1-U4 in `grammar.py`) - Active
172+
173+
See [GRAMMAR_MIGRATION_GUIDE.md](GRAMMAR_MIGRATION_GUIDE.md) for migration instructions.
174+
114175
## Layered responsibilities
115176

116177
| Layer | Key modules | Primary responsibilities | TNFR invariants guarded |

CANONICAL_BOUNDARY_PATTERN.md

Lines changed: 0 additions & 171 deletions
This file was deleted.

0 commit comments

Comments
 (0)