Datasets:
Formats:
csv
Languages:
English
Size:
1K - 10K
Tags:
mathematics
inverse-problems
observability
noncommutative-algebra
symbolic-computation
calibration-rigidity
Download scripts/make_notebook.py from PureOne/AELYRION-NOULITH-III: direct link, hf CLI and curl.
- Browser
- Download file 5.74 kB
-
https://huggingface.co/datasets/PureOne/AELYRION-NOULITH-III/resolve/main/scripts/make_notebook.py
- Command line
-
hf download hf://datasets/PureOne/AELYRION-NOULITH-III/scripts/make_notebook.py
-
curl -L -o make_notebook.py https://huggingface.co/datasets/PureOne/AELYRION-NOULITH-III/resolve/main/scripts/make_notebook.py
5.74 kB
| #!/usr/bin/env python3 | |
| """Create and actually execute a small self-contained demonstration notebook.""" | |
| 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=nbf.v4.new_markdown_cell; code=nbf.v4.new_code_cell | |
| nb.cells=[ | |
| md('# AELYRION–NOÛLITH III: retained foundations walkthrough\n\nThis notebook executes finite examples from the manuscript. It does not certify all-size theorems or worldwide originality. All algebraic outputs below are exact.'), | |
| code('''from pathlib import Path | |
| import sys | |
| 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')) | |
| import sympy as sp | |
| from noulith import TwistedAlgebra | |
| from noulith.ideals import universal_algebra,equal_polynomial_ideals | |
| from noulith.protocols import ideal_generators,root_profile,normalized_measurement_matrix | |
| from noulith.geometry import resonance_group,flat_edge,line_arrangement_generators,branch_carriers,perfect_slice_matrix | |
| sp.init_printing() | |
| a,b=sp.symbols('a b')'''), | |
| md('## 1. Two analytically inequivalent three-channel observations\n\nThe penultimate block ideal realizes $(a^2,b^2)$ or $(a^2,ab,b^2)$. Their arc orders agree, but only the second synthesizes the target $ab$ analytically.'), | |
| code('''J=universal_algebra([a**2,b**2],m=3) | |
| K=universal_algebra([a**2,b**2,a*b],m=3) | |
| PJ,PK=J.shuffle_table(),K.shuffle_table() | |
| GJ=ideal_generators(PJ,7,2) | |
| GK=ideal_generators(PK,7,2) | |
| assert equal_polynomial_ideals(GJ,[a*a,b*b],(a,b)) | |
| assert equal_polynomial_ideals(GK,[a*a,a*b,b*b],(a,b)) | |
| remainder_J=sp.groebner(GJ,a,b).reduce(a*b)[1] | |
| remainder_K=sp.groebner(GK,a,b).reduce(a*b)[1] | |
| assert remainder_J==a*b and remainder_K==0 | |
| {'target_remainder_for_J':remainder_J,'target_remainder_for_K':remainder_K}'''), | |
| md('## 2. Triangle cancellation forces a known formal-group law\n\nThe new candidate is its role in the observation ideal, not the formal-group operation itself.'), | |
| code('''x,y,z=sp.symbols('x y z') | |
| F=resonance_group | |
| assert sp.cancel(F(F(x,y),z)-F(x,F(y,z)))==0 | |
| A,B,C=sp.symbols('A B C') | |
| triple=TwistedAlgebra(3,{(0,1):-1+A,(0,2):-1+B,(1,2):-1+C}).shuffle_table()[7] | |
| assert sp.cancel(triple.subs(B,F(A,C)))==0 | |
| {'triple_shuffle':sp.factor(triple),'law':F(x,y),'flat_edge':flat_edge(x,y)}'''), | |
| md('## 3. A known elliptic singularity and its gluing carriers\n\nAfter the logarithmic coordinate change the scalar critical curve is three axes and one diagonal, not the full-state rank-failure set. This is the known elliptic four-fold point, credited to Smyth and Stevens in the manuscript; its discovery is not claimed.'), | |
| code('''variables=(x,y,z) | |
| relations=line_arrangement_generators(variables) | |
| assert equal_polynomial_ideals(relations,[x*y-x*z,x*y-y*z],variables) | |
| carriers=branch_carriers(variables) | |
| t=sp.symbols('t') | |
| branches=[(t,0,0),(0,t,0),(0,0,t),(t,t,t)] | |
| R=sp.Matrix([[sp.expand(f.subs(dict(zip(variables,branch)),simultaneous=True)) for f in carriers] for branch in branches]) | |
| assert R==t*t*sp.eye(4) | |
| {'relations':relations,'branch_carriers':carriers,'restriction_matrix':R,'slice_pairing':perfect_slice_matrix(3)}'''), | |
| md('## 4. Full four-channel rank strata from actual matrices'), | |
| code('''from itertools import combinations | |
| pairs=list(combinations(range(4),2)) | |
| def actual_rank(f): | |
| model=TwistedAlgebra(4,{p:-1+f.get(p,0) for p in pairs}) | |
| return normalized_measurement_matrix(model.shuffle_table(),2).rank() | |
| zero={p:sp.S.Zero for p in pairs} | |
| star=zero | {(0,1):sp.Rational(1,20),(0,2):sp.Rational(2,20),(0,3):sp.Rational(3,20)} | |
| outlier=zero | {p:sp.Rational(1,20) for p in pairs if 0 in p} | |
| two=zero | {(0,1):sp.Rational(1,20)} | |
| generic={p:sp.Rational(i+1,100) for i,p in enumerate(pairs)} | |
| ranks=[actual_rank(f) for f in (generic,star,outlier,two,zero)] | |
| assert ranks==[16,15,14,14,11] | |
| dict(zip(['generic','single_star','outlier','two_stars','origin'],ranks))'''), | |
| md('## 5. Root-of-unity block budgets\n\nThese exact exponents concern the specified transverse detuning, not arbitrary multivariate perturbations.'), | |
| code('''profiles={r:[root_profile(d,r,3) for d in range(13)] for r in range(1,5)} | |
| assert profiles[1][6]==2 and profiles[2][6]==1 and profiles[3][6]==0 | |
| profiles'''), | |
| md('## Scope\n\nThe formal group, quantum complete intersections, local ideals, Fitting invariants, and Smith theory have established antecedents. The package proposes their exact restricted-observation integration and proves the stated results within its hypotheses. No hardware, empirical performance, or independent priority certification is supplied.') | |
| ] | |
| start=time.perf_counter() | |
| NotebookClient(nb,timeout=120,kernel_name='python3',resources={'metadata':{'path':str(ROOT)}}).execute() | |
| path=ROOT/'notebooks'/'01_exact_walkthrough.ipynb' | |
| nbf.write(nb,path) | |
| code_cells=[c for c in nb.cells if c.cell_type=='code'] | |
| errors=[o for c in code_cells for o in c.get('outputs',[]) if o.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_report.json').write_text(json.dumps(report,indent=2)+'\n') | |
| if errors: raise SystemExit('Notebook execution reported errors.') | |
| print(f'Executed {len(code_cells)} notebook code cells without errors.') | |
| if __name__=='__main__': main() | |