Repository navigation
Concrete Examples
Jeremy H. Carroll edited this page Oct 30, 2026
·
8 revisions
AuthorityEffect: None (certified_implies_authorized: false)
⬅ Back to Wiki Home
All examples and contract validators live in the standalone normal_forms/ Python package and contracts/ directory:
# 1. Validate all 112 YAML normal form contracts against standard.yaml
python -m normal_forms.catalog
# 2. Run Demo 01: BQNF Incremental Revenue Repair on CDC Events
python -m normal_forms.paid_revenue_example
# 3. Run Demo 02: Unverified Certificate Refusal Gate
python -m normal_forms.unverified_certificate_example
# 4. Run Demo 03: Observer-Relative Freshness SLA Poset Evaluation
python -m normal_forms.observer_freshness_example
# 5. Run Cross-Domain Reconciliation & Loss Ledger Example
python -m normal_forms.reconciliation_example
# 6. Run Demo 05: 4-Hop Composition (3NF/BCNF -> Extrema & Quantile Cochains -> CODA_MUR -> Observer Poset)
python -m normal_forms.multi_hop_compositionfrom normal_forms import NormalFormsEvaluator
with NormalFormsEvaluator() as ev:
# 1. Flatten repeating CSV groups (0NF -> 1NF)
rows_1nf = ev.normalize_0nf_to_1nf([
(1, "Alice", "Math,Physics"),
(2, "Bob", "Chemistry"),
])
print("1NF rows:", rows_1nf)
# 2. Check 5NF Project-Join witness (Shell2 EXCEPT Fill2)
witness = ev.evaluate_5nf_project_join_integrity([
("Alice", "Acme", "Widget"),
("Alice", "Globex", "Gadget"),
("Bob", "Acme", "Gadget"),
("Alice", "Acme", "Gadget"), # closes the 3-way cycle
])
print("5NF witness:", witness)Consider the classic Address(street, city, zip) schema (Date & Darwen's street_journal_title isomorphism) with functional dependencies
- Candidate keys:
${(\text{street}, \text{city}),; (\text{street}, \text{zip})}$ . - Every attribute (
street,city,zip) is prime (belongs to at least one candidate key). - Therefore,
Addresspasses3NF($\text{zip} \to \text{city}$ has a prime dependentcity), but failsBCNFbecause determinantzipis not a superkey! - Decomposing into
$R_1(\text{zip}, \text{city})$ and$R_2(\text{street}, \text{zip})$ achievesBCNFlosslessly by Heath's Theorem, while illustrating whyBCNFdoes not always preserve all original functional dependencies within single tables.
from normal_forms.domain import (
street_journal_title,
street_journal_title_passes_third_and_fails_boyce_codd,
)
print("Passes 3NF and fails BCNF:", street_journal_title_passes_third_and_fails_boyce_codd())4. Example C: BQNF Change Data Capture Incremental Repair (nf.change.bqnf)
Given base relation Orders(order_id, customer_id, status, amount, updated_at) and boundary view:
SELECT customer_id, SUM(amount) AS paid_revenue
FROM Orders
WHERE status = 'paid'
GROUP BY customer_id;| Case | CDC Event | Defect Class in |
Terminal Route | Output Repair / Reason |
|---|---|---|---|---|
| 1. Pending |
old: {status: 'pending', amount: 100} new: {status: 'paid', amount: 120}
|
[0] (Exact Coboundary) |
Repair |
{customer_id: 7, delta_revenue: +120.0} |
| 2. Paid Amount Update |
old: {status: 'paid', amount: 100} new: {status: 'paid', amount: 120}
|
[0] (Exact Coboundary) |
Repair |
{customer_id: 7, delta_revenue: +20.0} |
| 3. Paid |
old: {status: 'paid', amount: 100} new: {status: 'pending', amount: 100}
|
[0] (Exact Coboundary) |
Repair |
{customer_id: 7, delta_revenue: -100.0} |
| 4. Timestamp Only |
updated_at changed; status, amount, customer_id unchanged |
[0] (Zero Defect) |
Preserve |
No boundary columns modified |
| 5. Missing Evidence |
old / new missing status and amount
|
[NonZero - MissingEvidence] |
Invalidate |
Fails closed when CDC before/after image is incomplete |
| 6. Unsupported Extremum |
MAX(amount) boundary without auxiliary extremum cochain |
[NonZero - LimitOfSubstrate] |
Unsupported |
Requires priority-queue cochain or partition recomputation |
5. Example D: 4-Hop Composition (3NF/BCNF $\to$ Extrema & $\epsilon$ -Quantile Cochains $\to$ CODA_MUR $\to$ Observer Poset)
normal_forms/multi_hop_composition.py chains four normal-form domains end to end:
-
Hop 1 (
3NF/BCNFRelational Synthesis): DecomposesSales(sale_id, customer_id, customer_zip, region, amount, audit_nonce)via Bernstein3NFsynthesis and Tsou-FischerBCNFtree decomposition, verifying lossless join reconstruction. -
Hop 2b (Non-Invertible
MIN/MAXPriority-Queue Cochains + Dynamic$\epsilon$ -BQNFQuantile Sketches over Composite Keys): StreamsINSERT/UPDATE/DELETECDC operations throughNormalFormsEvaluator(normal_forms/bqnf_extrema.py,normal_forms/bqnf_repair.py,normal_forms/sales_cochain.py), supporting canonical multi-column composite grouping keys (encode_composite_group_key, e.g.,("region", "channel")or("region", "channel", "tier")). Repairs destructiveMIN/MAXdeletions in$O(\log K)$ viaregion_extremum_cochain(or routes to bounded partitionRecomputewhen disabled) and repairs regional medians within tolerance$\epsilon$ viaregion_quantile_cochain. Whendynamic_buckets=True,rebalance_quantile_cochainrecursively bisects overloaded buckets (count > split_threshold) down tomin_bucket_widthin dense power-law heads and coalesces under-populated dyadic sibling/cousin sub-buckets (combined count <= merge_threshold) bottom-up during stream drains, whileverify_quantile_cochain_invariantschecks mass conservation, disjoint ordering, and exact point-to-bucket membership. -
Hop 3 (
CODA_MURRepresentation Transportnf.coda.mur.transport): Projects across multi-hop target schemas with cryptographically sealedLossLedgerbookings (coda_mur.unmapped_field_drop), authenticated target verifiers, and commutation square checks$D_{\text{target}}(F(r)) = \bar{F}(D_{\text{source}}(r))$ . -
Hop 4 (Observer-Relative Freshness Poset
nf.epistemic.freshness): Evaluates the transported packet across a stringency-ordered observer poset chain$O_1 \le O_2 \le \dots \le O_m$ , checking upward admissibility monotonicity ($O_i \text{ fresh} \implies O_{i+1} \text{ fresh}$ ) and fail-closed scope/SLA enforcement.
-
What it supports:
- Demonstrates in this toy setting that the Python evaluators reproduce the declared terminal routes for
0NF–5NF,BQNFadditive and cochain-backed extrema/quantile repair,CODA_MURrepresentation transport, and observer-relative freshness posets.
- Demonstrates in this toy setting that the Python evaluators reproduce the declared terminal routes for
-
What it does not support:
- Does not substitute for production database concurrency control or physical distributed consensus.
-
The narrowest defensible claim:
- Each worked example and multi-hop property test executes deterministically against the fixtures and randomized schemas in
tests/withAuthorityEffect: None.
- Each worked example and multi-hop property test executes deterministically against the fixtures and randomized schemas in
-
The next test needed:
- Concurrent multi-writer transaction interleaving over persistent disk-backed SQLite WAL journals.
Simplex Normal Forms • 112 Canonical Contracts & SVG Diagrams • CODA_MUR Transport • certified_implies_authorized: false • AuthorityEffect: None
- Home (Master Index)
- Project Status & Evidence
- Theory & Cochain Substrate
- Observer-Relative Ontology
- Concrete Worked Examples
- Geometrodynamics & Physics
shape (17)
- 0NF (
nf.classical.0nf) - 1NF (
nf.classical.1nf) - 2NF (
nf.classical.2nf) - 3NF (
nf.classical.3nf) - 4NF (
nf.classical.4nf) - 5NF (
nf.classical.5nf) - 6NF (
nf.classical.6nf) - BCNF (
nf.classical.bcnf) - DKNF (
nf.classical.dknf) - EKNF (
nf.classical.eknf) - ETNF (
nf.classical.etnf) - NF2 (
nf.classical.nf2) - RFNF (
nf.classical.rfnf) - SKNF (
nf.classical.sknf) - DHNF (
nf.cochain.dhnf) - HCNF (
nf.ddc.hodge_canonical) - MSSNF (
nf.mssn)
change (6)
representation (5)
compilation (1)
epistemic (15)
- EQNF (
nf.coda.eqnf) - ANF (
nf.epistemic.authority) - CNF (
nf.epistemic.cnf) - EFNF (
nf.epistemic.efnf) - ENF (
nf.epistemic.enf) - FNF (
nf.epistemic.freshness) - LNF (
nf.epistemic.location) - NAR-NF (
nf.epistemic.nar_nf) - ObsNF (
nf.epistemic.observer) - ODNF (
nf.epistemic.odnf) - ONF (
nf.epistemic.onf) - PvNF (
nf.epistemic.pvnf) - RNF (
nf.epistemic.replica) - SnNF (
nf.epistemic.snnf) - StNF (
nf.epistemic.state)
authority (1)
evidence (8)
derivation (12)
- AONF (
nf.derivation.aonf) - APNF (
nf.derivation.apnf) - IGNF (
nf.derivation.ignf) - IRNF (
nf.derivation.irnf) - LSNF (
nf.derivation.lsnf) - OBNF (
nf.derivation.obnf) - PDNF (
nf.derivation.pdnf) - RPNF (
nf.derivation.rpnf) - SCNF (
nf.derivation.scnf) - SERNF (
nf.derivation.sernf) - AINF (
nf.ontology.ainf) - WDNF (
nf.wdp.wdnf)
topology (2)
physics (20)
- RBNF (
nf.physics.bianchi_regge) - BQNF-REGGE (
nf.physics.bqnf_regge) - CDT-FSIGN-NF (
nf.physics.cdt_fermion_sign) - CDT-KD-DOUBLING-NF (
nf.physics.cdt_kd_doubling) - CDT-MATTER-NF (
nf.physics.cdt_matter_coupling) - CDT-OVERLAP-NF (
nf.physics.cdt_overlap_fermions) - CDT-SPEC-NF (
nf.physics.cdt_spectral_dimension) - CDT-SUSY-WITTEN-NF (
nf.physics.cdt_susy_witten) - CDT-TOPO-CHARGE-NF (
nf.physics.cdt_topological_charge) - CDT-WMC-NF (
nf.physics.cdt_wick_mc) - CDT-ZOLOTAREV-NF (
nf.physics.cdt_zolotarev_overlap) - DFNF (
nf.physics.dfnf) - L1CCNF (
nf.physics.l1_constraint_closure) - LCNF (
nf.physics.lorentzian_cdt) - L1PSNF (
nf.physics.pachner_lp_scaling) - PWNF (
nf.physics.pwnf) - RCNF (
nf.physics.rcnf) - RPCNF (
nf.physics.rpcnf) - SIDNF (
nf.physics.schlafli_nf) - WDWNF (
nf.physics.wdwnf)