File size: 7,980 Bytes
d1c6c9a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#!/usr/bin/env python3
"""Create and execute the higher-deficit, rigidity, and budget demonstration."""
from __future__ import annotations
import json
import time
from pathlib import Path
import nbformat as nbf
from nbclient import NotebookClient

ROOT = Path(__file__).resolve().parents[1]


def main() -> None:
    nb = nbf.v4.new_notebook()
    nb.metadata.kernelspec = {'display_name':'Python 3', 'language':'python', 'name':'python3'}
    md, code = nbf.v4.new_markdown_cell, nbf.v4.new_code_cell
    nb.cells = [
        md('# AELYRION–NOÛLITH III: higher-deficit geometry and rigidity\n\nExecuted exact examples accompanying the written all-size proofs. The classified object is the **reduced** scalar resonance germ. No scheme-radicality, physical performance, external review, or worldwide-priority claim is inferred from these computations.'),
        code('''from pathlib import Path
import sys
from math import comb, ceil
import sympy as sp
root = Path.cwd()
if not (root / 'src').exists():
    root = root.parent
assert (root / 'src' / 'noulith').exists(), 'Run from the package or notebooks directory.'
sys.path.insert(0, str(root / 'src'))
from noulith.algebra import TwistedAlgebra
from noulith.third import (
    all_components, component_equations, component_membership, intersection_dimension,
    example_point, certify_scalar, direct_block_rank, predicted_rank,
    optimal_calibration_subfamily, calibration_classes, pairs, q_from_exponents,
)
sp.init_printing()
print('Exact reference library loaded from', root / 'src')'''),
        md('## 1. The 41-component six-channel arrangement\n\nSix stars have dimension five. Twenty triangles and fifteen twin-core components have dimension three. Only the reduced geometry is classified.'),
        code('''m = 6
components = all_components(m)
counts = {kind: sum(c[0] == kind for c in components)
          for kind in ('star', 'triangle', 'twin')}
assert counts == {'star': 6, 'triangle': 20, 'twin': 15}
assert len(components) == m + comb(m+1, 3) == 41
dimensions = {kind: comb(m,2) - component_equations(m, next(c for c in components if c[0] == kind)).rank()
              for kind in counts}
{'counts': counts, 'component_dimensions': dimensions, 'ambient_dimension': comb(m,2)}'''),
        md('## 2. Full-state ranks by an independent calculation\n\nThe rank computation below enumerates all complementary subsets and block possibilities, independently of membership in the geometric components. Scalar resonance is not the whole rank-failure locus.'),
        code('''kinds = ['origin','star','triangle','twin','uniform_star','star_twin','edge','double_star','generic']
ranks = {}
for kind in kinds:
    q = example_point(m, kind)
    direct = direct_block_rank(m, q, m-3)
    assert direct == predicted_rank(m, q)
    ranks[kind] = {'rank': direct, 'nullity': 2**m-direct}
assert ranks['twin']['rank'] == 60 and ranks['origin']['rank'] == 42
ranks'''),
        md('## 3. A returned witness is an actual nonzero algebra word\n\nThe certificate contains a nontrivial motif and singleton completion. Raw multiplication keeps the nonzero crossing factor rather than silently dropping it.'),
        code('''q = example_point(6, 'generic')
certificate = certify_scalar(6, q)
assert certificate.visible
model = TwistedAlgebra(6, q)
partition = certificate.full_partition(6)
raw = model.isolated_response(partition)
unit = model.isolated_unit(partition)
assert len(partition) == 3
assert raw == unit * certificate.normalized_response != 0
{'motif': certificate.motif, 'full_partition_bitmasks': partition,
 'raw_equals_unit_times_normalized': True, 'raw_response_nonzero': raw != 0}'''),
        md('## 4. Component incidence and the old elliptic locus\n\nTwo twins sharing an outlier meet in a uniform-star line. Disjoint outlier pairs meet only at the origin. The union of the uniform-star lines is the known elliptic m-fold point, not a new singularity claim.'),
        code('''checks = {
    'two_stars': ([('star',(0,)), ('star',(1,))], 1),
    'star_and_its_twin': ([('star',(0,)), ('twin',(0,1))], 2),
    'twins_sharing_an_outlier': ([('twin',(0,1)), ('twin',(0,2))], 1),
    'disjoint_twins': ([('twin',(0,1)), ('twin',(2,3))], 0),
}
results = {}
for name, (labels, expected) in checks.items():
    value = intersection_dimension(6, labels)
    assert value == expected
    results[name] = value
results'''),
        md('## 5. Sharp selected-component synchronization\n\nThis is a count of constraints requiring preservation of entire twin subspaces, **not** the number of scalar detector measurements. The construction uses four components for six channels. A star of five selected components nevertheless fails.'),
        code('''selected = optimal_calibration_subfamily(6)
assert len(selected) == ceil(2*(6-1)/3) == 4
assert len(calibration_classes(6, selected)) == 1
selected_star = tuple((0,j) for j in range(1,6))
assert len(calibration_classes(6, selected_star)) == 2
{
 'optimal_selected_pairs_zero_based': selected,
 'optimal_remaining_scale_classes': len(calibration_classes(6, selected)),
 'five_star_constraints_remaining_classes': len(calibration_classes(6, selected_star)),
 'budgets_m6_to_m12': {n: len(optimal_calibration_subfamily(n)) for n in range(6,13)},
}'''),
        md('## 6. Identical-interaction core capacity at different block budgets\n\nThe equality is generic within the core family, not asserted at every parameter value. The formula requires at least one block.'),
        code('''m, c = 6, 4
exponents = [[0]*m for _ in range(m)]
for i,j in pairs(m):
    if not (i < c and j < c):
        exponents[i][j], exponents[j][i] = 1, -1
q = q_from_exponents(exponents)
capacity = {}
for r in range(1,5):
    expected = 2**(m-c) * sum(comb(c,j) for j in range(min(c,r)+1))
    actual = direct_block_rank(m, q, r)
    assert actual == expected
    capacity[r] = actual
capacity'''),
        md('## 7. Why the classification starts at six channels\n\nA dense five-channel rational point can have every shuffle of degree at least three vanish. It is outside the listed star/triangle/twin support types but is invisible with two blocks.'),
        code('''m = 5
h = [sp.Rational(i,1000) for i in range(m)]
q = {(i,j): -1 + (h[j]-h[i])/(1-h[i]+h[i]*h[j]) for i,j in pairs(m)}
P = TwistedAlgebra(m,q).shuffle_table()
assert all(q[e] != -1 for e in pairs(m))
assert all(P[S] == 0 for S in range(1,1<<m) if S.bit_count() >= 3)
{'supported_edges': len(q), 'all_degree_at_least_three_shuffles_zero': True,
 'two_block_full_state_rank': direct_block_rank(m,q,2)}'''),
        md('## Interpretation\n\nThe all-size classification and rigidity rely on the written proofs. These finite exact examples test independent mechanisms and boundary cases. The minimal synchronization count concerns a specified geometric constraint model; it is not a claim that a physical instrument can learn its entire calibration from four samples. See the manuscript and `docs/NOVELTY_AUDIT.md` for antecedents and open priority questions.'),
    ]
    start = time.perf_counter()
    NotebookClient(nb, timeout=120, kernel_name='python3',
                   resources={'metadata': {'path': str(ROOT)}}).execute()
    path = ROOT / 'notebooks' / '02_third_deficit_and_rigidity.ipynb'
    nbf.write(nb, path)
    code_cells = [cell for cell in nb.cells if cell.cell_type == 'code']
    errors = [out for cell in code_cells for out in cell.get('outputs', [])
              if out.get('output_type') == 'error']
    report = {'notebook': str(path.relative_to(ROOT)), 'executed_code_cells': len(code_cells),
              'errors': len(errors), 'elapsed_seconds': round(time.perf_counter()-start,3)}
    (ROOT / 'validation' / 'notebook_v3_report.json').write_text(json.dumps(report,indent=2)+'\n')
    if errors:
        raise SystemExit('Notebook execution reported errors.')
    print(f'Executed {len(code_cells)} higher-deficit notebook code cells without errors.')

if __name__ == '__main__':
    main()