Spaces:
Sleeping
Sleeping
| # API Documentation | |
| ## aimo_3_gateway.py | |
| Gateway notebook for https://www.kaggle.com/competitions/ai-mathematical-olympiad-progress-prize-3 | |
| ### `class AIMO3Gateway` | |
| Gateway class for the AI Mathematical Olympiad Progress Prize 3. | |
| Provides the interface between the competition platform and the TGI solver. | |
| #### `def AIMO3Gateway.__init__(self, data_paths)` | |
| Initializes the AIMO gateway with data paths and sets a generous timeout. | |
| Args: | |
| data_paths (tuple[str] | None): Tuple containing the test CSV path. | |
| #### `def AIMO3Gateway.unpack_data_paths(self)` | |
| Unpacks the provided data paths or uses default competition paths. | |
| #### `def AIMO3Gateway.generate_data_batches(self)` | |
| Generates batches of test data for evaluation. | |
| Returns: | |
| Generator[tuple[pl.DataFrame, pl.DataFrame], None, None]: Batches of (row, row_id). | |
| #### `def AIMO3Gateway.competition_specific_validation(self, prediction_batch, row_ids, data_batch)` | |
| Performs competition-specific validation on predictions. | |
| ## algebraic.py | |
| No description. | |
| ### `class AlgebraicClassifier` | |
| Classifies symmetric combinatorial problems in O(1) using cohomology. | |
| Guided by Law I (Dimensional Parity Harmony) and Law V (Joint-Sum Constraint). | |
| Determines existence of Hamiltonian paths in Z_m^k. | |
| #### `def AlgebraicClassifier.__init__(self, m, k)` | |
| Initializes the classifier with grid modulus m and dimensionality k. | |
| Args: | |
| m (int): The grid modulus (number of levels per dimension). | |
| k (int): The dimensionality of the manifold. | |
| #### `def AlgebraicClassifier.analyze(self)` | |
| Performs a deep audit of the topological domain and returns a formal proof. | |
| Returns: | |
| Dict[str, Any]: Proof metadata including existence, theorem ID, and proof steps. | |
| ### `class GroupExtension` | |
| Formalizes the Short Exact Sequence 0 -> H -> G -> Q -> 0. | |
| Enables decomposition of G into fiber H and quotient Q. | |
| #### `def GroupExtension.__init__(self, G_order, Q_order)` | |
| Initializes the extension with global order G and quotient order Q. | |
| #### `def GroupExtension.lift(self, q_state, h_state)` | |
| Lifts a point from the quotient and fiber to the total space. | |
| #### `def GroupExtension.project(self, g_state)` | |
| Projects a point from the total space to the quotient and fiber. | |
| ### `class Tower` | |
| A hierarchy of Group Extensions (Tower of Fibrations). | |
| Enables deep cognitive mapping across multiple manifold layers. | |
| #### `def Tower.__init__(self, orders)` | |
| Initializes the tower with a list of orders [base, ..., total]. | |
| #### `def Tower.lift_sequence(self, states)` | |
| Lifts a state through the entire tower from base to total space. | |
| #### `def Tower.project_sequence(self, g_state)` | |
| Decomposes a global state into its constituent fiber components across the tower. | |
| ### `class NonAbelianSubgroup` | |
| Helper for subgroups with non-abelian central extensions. | |
| #### `def NonAbelianSubgroup.__init__(self, G_order, H_order, is_central)` | |
| Initializes the subgroup with global, fiber, and central metadata. | |
| #### `def NonAbelianSubgroup.parity_law(self, k)` | |
| Checks the finalized parity law for non-abelian extensions. | |
| ### `def analyze_advanced_domain(domain)` | |
| Advanced classification for icosahedral, crystal, and Hamming geometries. | |
| ### `def get_algebraic_proof(m, k)` | |
| Convenience wrapper for AlgebraicClassifier.analyze. | |
| ### `def get_heisenberg_proof(m, k)` | |
| Analysis of Hamiltonian decomposition for Heisenberg groups H3(Z_m). | |
| ## analysis.py | |
| analysis.py β Automated mathematical analysis of Claude's Cycles solutions. | |
| Given a sigma function or SigmaTable, this module: | |
| 1. STRUCTURAL ANALYSIS | |
| - Detects column-uniformity (does sigma depend only on s,j or all of i,j,k?) | |
| - Computes the Q_c composed permutations | |
| - Identifies the twisted translation form Q_c(i,j) = (i+b_c(j), j+r_c) | |
| 2. THEOREM VERIFICATION | |
| - Theorem 1: Twisted Translation Structure (auto-detected) | |
| - Theorem 2: Single-Cycle Conditions (gcd checks) | |
| - Theorem 3: Existence for odd m (constructive verification) | |
| - Theorem 4: Impossibility for even m (parity argument) | |
| 3. PATTERN REPORTING | |
| - Full solution tables | |
| - Arc sequences for each Hamiltonian cycle | |
| - Comparison across m values | |
| ### `def detect_dependencies(sigma, m)` | |
| Determine which coordinates sigma actually depends on. | |
| Returns {'i': bool, 'j': bool, 'k': bool, 's': bool} | |
| where s = (i+j+k) mod m. | |
| ### `def extract_sigma_table(sigma, m)` | |
| If sigma is column-uniform (depends only on s,j), extract SigmaTable. | |
| Returns None if sigma is not column-uniform. | |
| ### `class SolutionAnalysis` | |
| Comprehensive analysis of a Claude's Cycles solution. | |
| Usage: | |
| analysis = SolutionAnalysis(sigma_fn, m=5) | |
| analysis.run() | |
| print(analysis.report()) | |
| #### `def SolutionAnalysis.__init__(self, sigma, m)` | |
| No description. | |
| #### `def SolutionAnalysis.run(self)` | |
| No description. | |
| #### `def SolutionAnalysis.report(self, verbose)` | |
| No description. | |
| #### `def SolutionAnalysis.__repr__(self)` | |
| No description. | |
| ### `def compare_across_m(results)` | |
| Generate a comparison table across multiple m values. | |
| results: {m: SolutionAnalysis} | |
| ## benchmark.py | |
| benchmark.py β v2.0 vs Alternatives | |
| ===================================== | |
| Measures six solvers across six problems. | |
| Reports: correctness, time, proof capability, speedup. | |
| Run: | |
| python benchmark.py # default (m=3..6, all solvers) | |
| python benchmark.py --quick # m=3..5 only | |
| python benchmark.py --w4 # W4 correction speedup only | |
| python benchmark.py --scaling # scaling analysis | |
| ### `class BResult` | |
| No description. | |
| #### `def BResult.row(self)` | |
| No description. | |
| ### `def _build_score(m)` | |
| No description. | |
| ### `def solver_v2(m, k)` | |
| No description. | |
| ### `def solver_A0_random(m, budget)` | |
| No description. | |
| ### `def solver_A1_SA(m, max_iter)` | |
| No description. | |
| ### `def solver_A2_backtrack(m)` | |
| No description. | |
| ### `def solver_A3_v1(m, k)` | |
| v1.0 pipeline with O(m^m) W4. | |
| ### `def _build_score(m)` | |
| Helper: build integer-array score function. | |
| ### `def solver_A4_level_enum(m)` | |
| Deterministic level enumeration. No randomness. | |
| Occasionally faster than v2 on easy feasible problems (lucky early branch). | |
| Cannot prove impossibility β times out on impossible problems. | |
| ### `def solver_A5_scipy(m)` | |
| scipy Nelder-Mead on the discrete score function treated as continuous. | |
| Included to document that gradient-free continuous optimization fails | |
| completely on discrete problems. Always returns 0/N correct. | |
| ### `def run_benchmark(problems, verbose)` | |
| No description. | |
| ### `def print_summary(all_results, problems)` | |
| No description. | |
| ### `def w4_benchmark()` | |
| No description. | |
| ### `def main()` | |
| No description. | |
| ## cli.py | |
| cli.py β Command-line interface for the Claude's Cycles system. | |
| Usage: | |
| python -m claudecycles # demo all modes | |
| python -m claudecycles verify 3 # verify known m=3 solution | |
| python -m claudecycles verify 5 # verify known m=5 solution | |
| python -m claudecycles solve 7 # find+verify m=7 | |
| python -m claudecycles solve 9 # find+verify m=9 | |
| python -m claudecycles analyze 3 # deep analysis of m=3 | |
| python -m claudecycles theorem # verify all four theorems | |
| python -m claudecycles compare 3 5 7 # compare solutions across m | |
| All results are auto-verified before printing. | |
| ### `def cmd_verify(m)` | |
| Verify a known hardcoded solution. | |
| ### `def cmd_solve(m, strategy, seed, max_iter)` | |
| Find and verify a solution for given m. | |
| ### `def cmd_analyze(m)` | |
| Deep mathematical analysis of a solution. | |
| ### `def cmd_theorem()` | |
| Demonstrate and verify all four theorems. | |
| ### `def cmd_compare(m_values)` | |
| Compare solutions across multiple m values. | |
| ### `def cmd_demo()` | |
| Full demo: verify known solutions, analyze, run theorems. | |
| ### `def main(args)` | |
| No description. | |
| ## core.py | |
| core.py β Mathematical Foundations (Production Stable) | |
| ==================================== | |
| Weights Β· Verifier Β· Solutions Β· Level Machinery Β· SA Engine | |
| ### `class Weights` | |
| No description. | |
| #### `def Weights.strategy(self)` | |
| No description. | |
| #### `def Weights.summary(self)` | |
| No description. | |
| ### `def _check_fso_solvability(m, r)` | |
| The Non-Canonical Obstruction check: Joint sum constraint. | |
| ### `def extract_weights(m, k)` | |
| No description. | |
| ### `def verify_sigma(sigma, m)` | |
| No description. | |
| ### `def table_to_sigma(table, m)` | |
| No description. | |
| ### `def _sa_score(sigma, arc_s, pa, n, k)` | |
| No description. | |
| ### `def _build_sa(m, k)` | |
| No description. | |
| ### `def run_hybrid_sa(m, k, seed, max_iter)` | |
| No description. | |
| ### `def construct_spike_sigma(m, k)` | |
| Sovereign Spike Construction (O(m)). Proven Golden Path for all odd m. | |
| ### `def solve(m, k, seed, max_iter)` | |
| The Sovereign FSO Master Solver. | |
| ### `def repair_manifold(m, k, sigma_in, max_iter)` | |
| No description. | |
| ### `def verify_basin_escape_success(m, k, sigma_in, max_iter)` | |
| No description. | |
| ### `def build_functional_graphs(sigma, m)` | |
| No description. | |
| ### `def verify_functional_graph(fg, m)` | |
| No description. | |
| ### `def vertices(m, k)` | |
| No description. | |
| ### `def trace_cycle(fg, m)` | |
| No description. | |
| ### `def arc_sequence(path, m)` | |
| No description. | |
| ## debug_m4.py | |
| No description. | |
| ## domains.py | |
| domains.py β Domain Definitions and Extensions | |
| ================================================ | |
| All registered domains, including the new P5/P6 results. | |
| Domains: | |
| Cycles G_m k=3 m=3..9 (odd: solved, even: partial) | |
| Cycles k=4 m=4,8 (arithmetic feasible) | |
| Latin squares (cyclic construction) | |
| Hamming codes (perfect covering) | |
| Difference sets (design theory) | |
| P5: S_3 (non-abelian) NEW: parity law extends | |
| P6: Z_mΓZ_n NEW: fiber quotient = Z_gcd(m,n) | |
| ### `def proved(s)` | |
| No description. | |
| ### `def open_(s)` | |
| No description. | |
| ### `def note(s)` | |
| No description. | |
| ### `def analyse_magic_squares(verbose)` | |
| Magic squares via Siamese method β same fiber/twisted-translation structure. | |
| ### `def analyse_pythagorean(verbose)` | |
| Pythagorean triples β fiber quotient Z_4, obstruction pβ‘3(mod4). | |
| ### `def _load_magic_pythagorean(engine)` | |
| No description. | |
| ### `class DecompositionCategory` | |
| Category of symmetric decomposition problems. | |
| Objects = problems (G,k,Ο). Morphisms = structure-preserving maps. | |
| Eilenberg: a functor from {symmetric systems} β {cohomology theories}. | |
| #### `def DecompositionCategory.__init__(self)` | |
| No description. | |
| #### `def DecompositionCategory.add_object(self, name, G, k, m, status, H1)` | |
| No description. | |
| #### `def DecompositionCategory.add_morphism(self, src, tgt, kind, desc)` | |
| No description. | |
| #### `def DecompositionCategory.print_category(self)` | |
| No description. | |
| ### `def build_decomposition_category()` | |
| No description. | |
| ### `def _load_heisenberg(engine)` | |
| No description. | |
| ### `def load_all_domains(engine)` | |
| No description. | |
| ### `def _load_cycles(engine)` | |
| No description. | |
| ### `def _load_classical(engine)` | |
| No description. | |
| ### `def analyse_P5_nonabelian(verbose)` | |
| S_3 Cayley graph analysis. | |
| RESULT (proved): | |
| β’ SES: 0 β A_3 β S_3 β Z_2 β 0 is valid (A_3 normal, index 2) | |
| β’ k=2 arc types: r-pair (1,1) sums to |Z_2|=2 β β FEASIBLE | |
| β’ k=3 arc types: no r-triple sums to 2 from {1} β OBSTRUCTED | |
| β’ Same parity law as abelian case | |
| DIFFERENCE from abelian: | |
| β’ Twisted translation = conjugation Q_c(h) = g_cβ»ΒΉΒ·hΒ·g_c | |
| β’ HΒΉ gauge group = HΒΉ(G/H, Z(H)) β involves centre of H | |
| β’ A_3 is abelian, so Z(A_3)=A_3 and the gauge structure is the same | |
| ### `def _load_P5_nonabelian(engine)` | |
| No description. | |
| ### `def analyse_P6_product_groups(verbose)` | |
| Z_m Γ Z_n analysis. | |
| RESULT (proved): | |
| β’ Fiber map: Ο(i,j) = (i+j) mod gcd(m,n) | |
| β’ SES: 0 β ker(Ο) β Z_mΓZ_n β Z_gcd(m,n) β 0 | |
| β’ Governing condition uses gcd(m,n) as modulus | |
| β’ Same parity obstruction formula with m replaced by gcd(m,n) | |
| Examples: | |
| β’ Z_4ΓZ_6: gcd=2 β k=3 OBSTRUCTED (same as G_2^n) | |
| β’ Z_6ΓZ_9: gcd=3 β k=3 feasible (same as G_3^n) | |
| β’ Z_3ΓZ_5: gcd=1 β trivial fiber (always feasible) | |
| ### `def _load_P6_product(engine)` | |
| No description. | |
| ## engine.py | |
| No description. | |
| ### `class Domain` | |
| No description. | |
| #### `def Domain.__init__(self, name, n, k, m, fiber_map, tags, precomputed, group, notes)` | |
| No description. | |
| ### `class Engine` | |
| The Global Structure Engine provides a unified interface for classifying | |
| and solving combinatorial problems using the Short Exact Sequence framework. | |
| #### `def Engine.register(self, domain)` | |
| No description. | |
| #### `def Engine.print_results(self)` | |
| No description. | |
| #### `def Engine.__init__(self)` | |
| No description. | |
| #### `def Engine.run(self, m, k, strategy)` | |
| Runs the classification and optional search for a problem (m, k). | |
| Args: | |
| m: The group order (Z_m). | |
| k: The dimension (number of cycles). | |
| strategy: Search strategy ('standard', 'hybrid', 'equivariant'). | |
| Returns: | |
| A dictionary containing the status, proof steps, and solution if found. | |
| #### `def Engine.analyse_text(self, desc, strategy)` | |
| Automatically parses a text description and classifies the domain. | |
| Args: | |
| desc: Text description of the problem. | |
| strategy: Search strategy to use. | |
| #### `def Engine.simplify_problem(self, m, k)` | |
| Uses categorical morphisms (Quotient, Product) to reduce a complex problem | |
| to smaller solvable components. | |
| #### `def Engine.get_lean_export(self, m, k)` | |
| Generates Lean 4 source for the parity obstruction proof. | |
| ### `def get_suggested_morphisms(m, k)` | |
| Suggests ways to simplify or solve (m, k) using known components. | |
| ### `def check_remote_search_status()` | |
| Checks the status of Kaggle search kernels if CLI is configured. | |
| ## fiber.py | |
| fiber.py β Fiber decomposition of the Claude's Cycles problem. | |
| KEY INSIGHT: The map f(i,j,k) = (i+j+k) mod m stratifies the digraph | |
| into m "fiber" layers F_0, β¦, F_{m-1}, each of size mΒ². | |
| Every arc goes from F_s to F_{s+1 mod m}. | |
| In fiber coordinates (i,j) with k = (s-i-j) mod m, the 3 arc types become: | |
| arc 0: (i,j) in F_s β (i+1, j) in F_{s+1} [shift (1,0)] | |
| arc 1: (i,j) in F_s β (i, j+1) in F_{s+1} [shift (0,1)] | |
| arc 2: (i,j) in F_s β (i, j) in F_{s+1} [shift (0,0) β identity] | |
| A "column-uniform" sigma depends only on (s, j) β not on i. | |
| At each level s, column j gets a fixed permutation: perm[j] = [arcβcycle]. | |
| The COMPOSED permutation after all m levels: | |
| Q_c(i,j) = (i + b_c(j), j + r_c) mod m | |
| where r_c = total j-increment for cycle c, b_c(j) = total i-increment. | |
| Single mΒ²-cycle condition: gcd(r_c, m) = 1 AND gcd(Ξ£ b_c(j), m) = 1 | |
| ### `def is_bijective_level(level, m)` | |
| Check that at level s, each cycle c induces a bijection on Z_mΒ². | |
| For cycle c: the set of targets {(i+di, j+dj) : j in Z_m, i in Z_m} | |
| must be exactly Z_mΒ² (all mΒ² positions hit). | |
| ### `def all_valid_levels(m)` | |
| Enumerate all column-uniform level assignments that are bijective. | |
| ### `def compose_levels(sigma_table, m)` | |
| Compose all m fiber-level functions to get Q_0, Q_1, Q_2. | |
| Returns 3 permutations on Z_mΒ² (as dicts). | |
| ### `def is_single_q_cycle(Q, m)` | |
| Check that permutation Q on Z_mΒ² is a single mΒ²-cycle. | |
| ### `def table_to_sigma_fn(sigma_table, m)` | |
| Convert a SigmaTable (indexed by [s][j]) into a 3D sigma function | |
| sigma(i, j, k) that can be used with core.verify_sigma. | |
| The key: depends only on s=(i+j+k)%m and j. | |
| ### `def analyze_Q_structure(Qs, m)` | |
| Analyze whether Q_c has the twisted translation form: | |
| Q_c(i,j) = (i + b_c(j), j + r_c) mod m | |
| Returns a dict with r_c, b_c, is_twisted, single_cycle per cycle. | |
| ### `def verify_single_cycle_conditions(r_c, b_c, m)` | |
| Verify the two necessary and sufficient conditions for Q_c to be a | |
| single mΒ²-Hamiltonian cycle. | |
| ### `def even_m_impossibility_check(m)` | |
| Verify the impossibility theorem for even m: | |
| No (r_0,r_1,r_2) with gcd(r_c,m)=1 can sum to m when m is even. | |
| ## find_m3.py | |
| No description. | |
| ## frontiers.py | |
| frontiers.py β Open Problem Solvers | |
| ===================================== | |
| P1 k=4, m=4 fiber-structured SA (construction open) | |
| P2 m=6, k=3 full-3D SA (first attempts) | |
| P3 m=8, k=3 full-3D SA (harder) | |
| TRIAGE FINDINGS (from recent measurements): | |
| β’ P1 k=4 m=4: Score 337β230 in 300K iters of fiber-structured SA. | |
| Estimated budget: 4β8M iterations. | |
| β’ P2 m=6 k=3: Basin-escape reaches score=4 in 8M iters (prev record 9). | |
| This is a deep local minimum (depth β₯ 3). Needs ~10M iters at T=2.0. | |
| β’ P3 m=8 k=3: 512 vertices. Score function overhead scales linearly. | |
| Run: | |
| python frontiers.py --p1 # k=4, m=4 | |
| python frontiers.py --p2 # m=6, k=3 | |
| python frontiers.py --p3 # m=8, k=3 | |
| python frontiers.py --all # all three | |
| python frontiers.py --status # print current knowledge state | |
| ### `def found(s)` | |
| No description. | |
| ### `def open_(s)` | |
| No description. | |
| ### `def note(s)` | |
| No description. | |
| ### `def hr(n)` | |
| No description. | |
| ### `def solve_P1(max_iter, seeds, verbose)` | |
| Find Ο: Z_4^4 β S_4 such that each colour class is a Hamiltonian cycle. | |
| Strategy: fiber-structured SA where Ο(v) = f(fiber(v), j(v), k(v)). | |
| The unique valid r-quadruple is (1,1,1,1) β all four colors share r_c=1. | |
| MEASUREMENT: Score 337β230 in first 300K iterations. | |
| K=4 converges ~4x slower than K=3. Estimated budget: 4β8M iterations. | |
| ### `def solve_P2(max_iter, seeds, verbose)` | |
| G_6 has 216 vertices. Score function checks 3 components of 216 vertices. | |
| Column-uniform impossible (parity). Full-3D search required. | |
| ### `def solve_P2_warm_start(max_iter, seed, verbose)` | |
| m=6, k=3 warm-start approach using Z_3-lifted solution. | |
| FINDING: The Z_3 lift (sigma_6(i,j,k) = sigma_3(i%3,j%3,k%3)) | |
| reaches score=9 reliably. This is a TRUE local minimum of depth >=3. | |
| Escape requires ~10M iterations at T=2.0. | |
| STRUCTURAL INSIGHT: Z_6 = Z_2 Γ Z_3 creates a product-structure | |
| local minimum. Breaking it requires coordinated multi-vertex changes | |
| that span the Z_3 periodic structure. | |
| ### `def solve_P3(max_iter, seeds, verbose)` | |
| G_8: 512 vertices. Harder than m=6. Tests scaling. | |
| Score function needs 512 components checked per iteration. | |
| ### `def print_status()` | |
| No description. | |
| ### `def main()` | |
| No description. | |
| ### `def prove_fiber_uniform_k4_impossible(verbose)` | |
| THEOREM: No fiber-uniform Ο yields a valid k=4 decomposition of G_4^4. | |
| Proof method: exhaustive search over all 24^4 = 331,776 fiber-uniform sigmas. | |
| Fiber-uniform means Ο(v) depends only on fiber(v) = (i+j+k+l) mod 4. | |
| With 4 fibers and 4 colors, there are 24^4 = 331,776 combinations. | |
| This is small enough to check completely in ~40 seconds. | |
| Result: 0 valid sigmas found β proved impossible. | |
| ## generate_api_docs.py | |
| No description. | |
| ### `def get_docstring(node)` | |
| No description. | |
| ### `def format_args(args)` | |
| No description. | |
| ### `def parse_file(filename)` | |
| No description. | |
| ## kaggle_search.py | |
| No description. | |
| ### `def _build_sa(m, k)` | |
| No description. | |
| ### `def _sa_score(sigma, arc_s, pa, n, k)` | |
| No description. | |
| ### `def get_node_orbits(m, k, subgroup_generators)` | |
| No description. | |
| ### `def run_hybrid_sa(m, k, seed, max_iter, verbose)` | |
| No description. | |
| ### `def run_fiber_structured_sa(m, k, seed, max_iter, verbose)` | |
| No description. | |
| ### `def main()` | |
| No description. | |
| ## search.py | |
| search.py β Three complementary search strategies for Claude's Cycles. | |
| 1. RANDOM SEARCH: Fast for odd m. Sample random valid-level combinations, | |
| check if Q compositions are single mΒ²-cycles. Works well for m=3,5,7. | |
| 2. BACKTRACKING: Vertex-by-vertex with in-degree pruning. Explores the full | |
| sigma space (not restricted to column-uniform). Slower but more general. | |
| 3. SIMULATED ANNEALING: Continuous improvement via stochastic hill-climbing. | |
| Score = total "extra components" across 3 cycles (want 0). | |
| Effective at navigating large m. | |
| All strategies return a SigmaTable (for fiber-based) or SigmaFn (for full 3D). | |
| ### `class RandomSearch` | |
| Sample random combinations of valid level tables. | |
| Extremely fast for odd m. Progressively slows for large m. | |
| Usage: | |
| rs = RandomSearch(m=5) | |
| result = rs.run(max_attempts=50_000) | |
| #### `def RandomSearch.__init__(self, m, seed)` | |
| No description. | |
| #### `def RandomSearch.attempts(self)` | |
| No description. | |
| #### `def RandomSearch.elapsed(self)` | |
| No description. | |
| #### `def RandomSearch.run(self, max_attempts)` | |
| Return a valid SigmaTable or None if not found. | |
| #### `def RandomSearch.run_verbose(self, max_attempts, report_every)` | |
| Like run() but prints progress. | |
| ### `class BacktrackSearch` | |
| Vertex-by-vertex assignment of sigma with pruning: | |
| - Each cycle gets exactly one arc from each vertex (permutation = guaranteed). | |
| - Each vertex has in-degree exactly 1 per cycle (checked incrementally). | |
| - Optionally shuffles perm order (via seed) for different search trees. | |
| Usage: | |
| bt = BacktrackSearch(m=3, seed=42) | |
| sigma_fn = bt.run() | |
| #### `def BacktrackSearch.__init__(self, m, seed)` | |
| No description. | |
| #### `def BacktrackSearch.nodes_visited(self)` | |
| No description. | |
| #### `def BacktrackSearch.run(self)` | |
| Return SigmaFn or None. | |
| ### `class SimulatedAnnealing` | |
| Score = total number of extra cycle components (want 0). | |
| Perturb: change sigma at one random vertex. | |
| Temperature schedule: geometric cooling. | |
| Usage: | |
| sa = SimulatedAnnealing(m=4, seed=0) | |
| sigma_fn = sa.run(max_iter=500_000) | |
| #### `def SimulatedAnnealing.__init__(self, m, seed, T_init, T_min)` | |
| No description. | |
| #### `def SimulatedAnnealing.best_score(self)` | |
| No description. | |
| #### `def SimulatedAnnealing._score(self, funcs, m)` | |
| Sum of extra components (0 = perfect). | |
| #### `def SimulatedAnnealing.run(self, max_iter, verbose, report_every)` | |
| No description. | |
| #### `def SimulatedAnnealing.run_verbose(self, max_iter)` | |
| No description. | |
| ### `def find_sigma(m, strategy, seed, max_iter, verbose)` | |
| Find a valid sigma for the given m using the best available strategy. | |
| strategy="auto": | |
| - odd m β RandomSearch (fast, fiber-based) | |
| - even m β SimulatedAnnealing (full 3D) | |
| strategy="random" β RandomSearch only | |
| strategy="backtrack" β BacktrackSearch only | |
| strategy="sa" β SimulatedAnnealing only | |
| Returns SigmaFn or None. | |
| ## solutions.py | |
| solutions.py β Hardcoded verified solutions for Claude's Cycles. | |
| All solutions have been computationally verified (3 Hamiltonian cycles). | |
| Use get_solution(m) to retrieve; use construct_for_odd_m(m) for | |
| a general algorithm that works on any odd m > 2. | |
| ### `def get_solution(m)` | |
| Return a precomputed SigmaFn for known m values (currently m=3,5). | |
| Returns None for unknown m (use search module instead). | |
| ### `def get_solution_table(m)` | |
| Return the raw SigmaTable for known m values. | |
| ### `def known_m_values()` | |
| Return sorted list of m values with hardcoded solutions. | |
| ### `def construct_for_odd_m(m, seed, max_attempts)` | |
| Find a valid sigma for any odd m > 2 using RandomSearch. | |
| The fiber decomposition approach always succeeds for odd m (Theorem 3). | |
| Returns SigmaFn or None (None is unexpected for m β€ ~15). | |
| ## test_basin.py | |
| No description. | |
| ## test_sa.py | |
| No description. | |
| ## theorems.py | |
| theorems.py β Formal Verification of the SES Framework | |
| ======================================================== | |
| Verified theorems 3.2 through 17.1 (FSO Codex Laws I-XII). | |
| Includes group actions, parity obstructions, and multi-modal fibrations. | |
| ### `def proved(s)` | |
| No description. | |
| ### `def hr()` | |
| No description. | |
| ### `def check_spike_conditions(m)` | |
| Analytically verify Theorem 11.1 conditions for odd m. | |
| ### `def phi(n)` | |
| No description. | |
| ### `def verify_moduli_space_laws()` | |
| Verify Codex Laws II and III for m=3. | |
| ### `def verify_basin_escape_law()` | |
| Verify Law VII (Basin Escape Axiom) for m=3. | |
| ### `def verify_cross_domain_consistency()` | |
| Verify Law VIII (Multi-Modal Fibration Invariant). | |
| ### `def verify_subgroup_decomposition_law()` | |
| Verify Law X (Recursive Subgroup Decomposition) for m=12. | |
| ### `def verify_symbolic_duality_law()` | |
| Verify Law XI (Symbolic-Topological Duality). | |
| ### `def verify_hardware_hamiltonian_health()` | |
| Verify Law IX (Hardware-Topological Equivalence). | |
| ### `def verify_all_theorems(verbose)` | |
| No description. | |
| ### `def print_cross_domain_table()` | |
| No description. | |
| ## research/action_mapper.py | |
| No description. | |
| ### `class ActionMapper` | |
| TGI Action-Coordinate Mapping. | |
| Translates topological paths and coordinates into system-level 'Agentic' actions. | |
| Ensures the TGI can 'do' things as a result of manifold reasoning. | |
| Guided by Law VIII (Multi-Modal Consistency). | |
| #### `def ActionMapper.__init__(self, m)` | |
| No description. | |
| #### `def ActionMapper.map_coord_to_action(self, coord)` | |
| Maps a specific coordinate in Z_m^k to an action and its parameters. | |
| #### `def ActionMapper.path_to_action_sequence(self, path)` | |
| Converts a Hamiltonian path into a sequence of agentic actions. | |
| #### `def ActionMapper.resolve_intent(self, intent_text)` | |
| Lifts a textual intent into a coordinate for action execution. | |
| Uses grounded TLM semantic mapping and Law VIII (Multi-Modal Consistency). | |
| ## research/admin_vision_process.py | |
| No description. | |
| ### `def admin_process(image_path)` | |
| No description. | |
| ## research/advanced_solvers.py | |
| No description. | |
| ### `class GeneralCayleyEngine` | |
| No description. | |
| #### `def GeneralCayleyEngine.__init__(self, elements, op, gens, seed)` | |
| No description. | |
| #### `def GeneralCayleyEngine.score(self, sigma)` | |
| No description. | |
| #### `def GeneralCayleyEngine.solve(self, max_iter, verbose)` | |
| No description. | |
| ### `class HeisenbergSolver` | |
| No description. | |
| #### `def HeisenbergSolver.__init__(self, m, seed)` | |
| No description. | |
| ### `class TSPSolver` | |
| No description. | |
| #### `def TSPSolver.__init__(self, name, coords, seed)` | |
| No description. | |
| #### `def TSPSolver.score(self, tour)` | |
| No description. | |
| #### `def TSPSolver.nearest_neighbor(self)` | |
| No description. | |
| #### `def TSPSolver.solve(self, max_iter, init_method, verbose)` | |
| No description. | |
| ### `def load_tsplib_instances(csv_path)` | |
| No description. | |
| ## research/agentic_action_engine.py | |
| No description. | |
| ### `class ActionExecutor` | |
| TGI Action Executor (Phase 8 Completion). | |
| Handles real execution of agentic plans and establishes the feedback loop. | |
| Guided by Law VII (Basin Escape) and Law IX (Hardware Grounding). | |
| #### `def ActionExecutor.__init__(self)` | |
| No description. | |
| #### `def ActionExecutor.execute_step(self, step)` | |
| Executes a single step of an agentic plan. | |
| #### `def ActionExecutor.execute_plan(self, plan)` | |
| Executes a full multi-step plan and returns the audit trail. | |
| ### `class TopologicalActionEngine` | |
| TGI Agentic Action Engine. | |
| Executes and resolves multi-step topological paths into coherent agentic plans. | |
| #### `def TopologicalActionEngine.__init__(self)` | |
| No description. | |
| #### `def TopologicalActionEngine.resolve_path_to_plan(self, path, base_intent)` | |
| Resolves a sequence of coordinates into a multi-step execution plan. | |
| ## research/agentic_bridge.py | |
| No description. | |
| ### `class AgenticBridge` | |
| The TGI Agentic Bridge (Upgraded v4). | |
| Links the topological action space to actual MCP tool signatures and LIBRARY metadata. | |
| Guided by the FSO Codex Law VIII (Multi-Modal Consistency). | |
| #### `def AgenticBridge.__init__(self)` | |
| No description. | |
| #### `def AgenticBridge.resolve_intent(self, intent)` | |
| Maps a natural language intent to a topological manifold and action set. | |
| #### `def AgenticBridge.resolve_resource_for_action(self, action_data, domain_hint)` | |
| Finds the most appropriate tool or library for a topological action. | |
| #### `def AgenticBridge.generate_agentic_plan(self, intent)` | |
| Creates a fully resolved agentic plan from a natural language intent. | |
| ## research/agentic_expansion_demo.py | |
| No description. | |
| ### `def run_demo()` | |
| No description. | |
| ## research/agentic_tgi_demo.py | |
| No description. | |
| ### `def run_demo()` | |
| No description. | |
| ## research/aimo_p7_solver.py | |
| No description. | |
| ### `def count_f2024_values()` | |
| f(m) + f(n) = f(m + n + mn) | |
| f(n) = \sum a_p * v_p(n+1) | |
| a_p = f(p-1) >= 1 | |
| Constraint: f(n) <= 1000 for n <= 1000. | |
| Find number of values for f(2024) = h(2025) = 4*a_3 + 2*a_5. | |
| ## research/aimo_reasoning_engine.py | |
| No description. | |
| ### `class AIMOReasoningEngine` | |
| No description. | |
| #### `def AIMOReasoningEngine.__init__(self)` | |
| No description. | |
| #### `def AIMOReasoningEngine.solve(self, problem_latex, problem_id)` | |
| No description. | |
| ## research/aimo_recurring_parquet.py | |
| No description. | |
| ## research/aimo_solver.py | |
| No description. | |
| ### `def solve_alice_bob()` | |
| No description. | |
| ### `def solve_functional_equation()` | |
| No description. | |
| ### `def count_f2024_values()` | |
| No description. | |
| ### `def solve_double_sum_floor()` | |
| No description. | |
| ## research/aimo_submission_script.py | |
| No description. | |
| ### `def get_answer(problem_id)` | |
| No description. | |
| ## research/aimo_submit.py | |
| No description. | |
| ## research/analysis.py | |
| analysis.py β Automated mathematical analysis of Claude's Cycles solutions. | |
| Given a sigma function or SigmaTable, this module: | |
| 1. STRUCTURAL ANALYSIS | |
| - Detects column-uniformity (does sigma depend only on s,j or all of i,j,k?) | |
| - Computes the Q_c composed permutations | |
| - Identifies the twisted translation form Q_c(i,j) = (i+b_c(j), j+r_c) | |
| 2. THEOREM VERIFICATION | |
| - Theorem 1: Twisted Translation Structure (auto-detected) | |
| - Theorem 2: Single-Cycle Conditions (gcd checks) | |
| - Theorem 3: Existence for odd m (constructive verification) | |
| - Theorem 4: Impossibility for even m (parity argument) | |
| 3. PATTERN REPORTING | |
| - Full solution tables | |
| - Arc sequences for each Hamiltonian cycle | |
| - Comparison across m values | |
| ### `def detect_dependencies(sigma, m)` | |
| Determine which coordinates sigma actually depends on. | |
| Returns {'i': bool, 'j': bool, 'k': bool, 's': bool} | |
| where s = (i+j+k) mod m. | |
| ### `def extract_sigma_table(sigma, m)` | |
| If sigma is column-uniform (depends only on s,j), extract SigmaTable. | |
| Returns None if sigma is not column-uniform. | |
| ### `class SolutionAnalysis` | |
| Comprehensive analysis of a Claude's Cycles solution. | |
| Usage: | |
| analysis = SolutionAnalysis(sigma_fn, m=5) | |
| analysis.run() | |
| print(analysis.report()) | |
| #### `def SolutionAnalysis.__init__(self, sigma, m)` | |
| No description. | |
| #### `def SolutionAnalysis.run(self)` | |
| No description. | |
| #### `def SolutionAnalysis.report(self, verbose)` | |
| No description. | |
| #### `def SolutionAnalysis.__repr__(self)` | |
| No description. | |
| ### `def compare_across_m(results)` | |
| Generate a comparison table across multiple m values. | |
| results: {m: SolutionAnalysis} | |
| ## research/autonomous_engine_demo.py | |
| No description. | |
| ### `def run_demo()` | |
| No description. | |
| ## research/classify_new_domains.py | |
| No description. | |
| ## research/collect_all_results.py | |
| No description. | |
| ### `def get_stats(kernel_id)` | |
| No description. | |
| ### `def main()` | |
| No description. | |
| ## research/cycles_even_m.py | |
| cycles_even_m.py β 6-Phase Discovery: Even m in Claude's Cycles | |
| ================================================================ | |
| The digraph G_m: vertices (i,j,k) β Z_mΒ³ | |
| arc 0: (i,j,k) β (i+1, j, k ) mod m | |
| arc 1: (i,j,k) β (i, j+1, k ) mod m | |
| arc 2: (i,j,k) β (i, j, k+1) mod m | |
| sigma assigns each arc to one of 3 cycles. | |
| Goal: every cycle is a single directed Hamiltonian cycle of length mΒ³. | |
| Odd m β column-uniform sigma works (proven, m=3,5,7 solved). | |
| Even m β column-uniform is PROVABLY impossible. | |
| This script discovers WHY and then FINDS a solution via SA. | |
| Phases: | |
| 01 GROUND TRUTH β define verification; confirm odd m works | |
| 02 DIRECT ATTACK β attempt column-uniform on m=4; record exact failure | |
| 03 STRUCTURE HUNT β prove the parity obstruction; characterise what even m needs | |
| 04 PATTERN LOCK β SA search for m=4; analyse the solution structure | |
| 05 GENERALIZE β test the discovered structure on m=6 | |
| 06 PROVE LIMITS β complete theorem: odd proven, even found, open frontier stated | |
| Run: | |
| python cycles_even_m.py # full 6-phase run | |
| python cycles_even_m.py --fast # skip m=6 search (saves ~2 min) | |
| ### `def hr(c, n)` | |
| No description. | |
| ### `def sec(num, name, tag)` | |
| No description. | |
| ### `def kv(k, v, ind)` | |
| No description. | |
| ### `def found(msg)` | |
| No description. | |
| ### `def miss(msg)` | |
| No description. | |
| ### `def note(msg)` | |
| No description. | |
| ### `def info(msg)` | |
| No description. | |
| ### `def vertices(m)` | |
| No description. | |
| ### `def build_funcs(sigma, m)` | |
| No description. | |
| ### `def count_components(fg)` | |
| No description. | |
| ### `def score(sigma, m)` | |
| Excess components across 3 cycles (0 = valid). | |
| ### `def verify(sigma, m)` | |
| Full verification: each cycle is exactly 1 Hamiltonian cycle. | |
| ### `def build_funcs_list(sigma, m)` | |
| Build 3 mutable dicts. | |
| ### `def fiber_valid_levels(m)` | |
| All column-uniform level assignments where each cycle is bijective on Z_mΒ². | |
| ### `def _cartesian(lst, k)` | |
| No description. | |
| ### `def _level_bijective(level, m)` | |
| No description. | |
| ### `def compose_q(table, m)` | |
| Compose all m fiber levels β 3 permutations Q_c on Z_mΒ². | |
| ### `def q_is_single_cycle(Q, m)` | |
| No description. | |
| ### `def table_to_sigma(table, m)` | |
| No description. | |
| ### `def find_odd_m(m, seed, max_att)` | |
| No description. | |
| ### `def prove_column_uniform_impossible(m)` | |
| Column-uniform needs rβ+rβ+rβ = m, each gcd(rα΅’,m)=1. | |
| For even m: coprime-to-m βΉ odd. Sum of 3 odds is odd β m (even). QED. | |
| Returns dict with all proof data. | |
| ### `def exhaustive_column_uniform(m, max_combos)` | |
| Try ALL column-uniform sigmas for small m. Record outcome. | |
| ### `def _build_perm_table(m)` | |
| Precompute for each (vertex_idx, perm_idx) β [successor_0, s_1, s_2]. | |
| Returns succs[v][p][arc] = successor vertex index. | |
| ### `def _build_funcs_fast(sigma_int, arc_succ, perm_arc, n)` | |
| Build 3 successor arrays from integer sigma. | |
| ### `def _count_comps_fast(f, n)` | |
| Count cycle components in successor array. | |
| ### `def _score_fast(f0, f1, f2, n)` | |
| No description. | |
| ### `def sa_search_fast(m, max_iter, T_init, T_min, seed, verbose, report_n)` | |
| Fast SA with score=1 repair mode + plateau-escape reheat. | |
| Returns (sigma_int_list or None, stats). | |
| ### `def _sigma_int_to_map(sigma_int, m)` | |
| Convert integer sigma to SigmaMap. | |
| ### `def sa_multistart(m, restarts, iter_each, T_init, verbose)` | |
| Multi-start SA. Return first success. | |
| ### `def analyse_sigma_dependencies(sigma, m)` | |
| Find which coordinates sigma actually depends on. | |
| ### `def analyse_sigma_pattern(sigma, m)` | |
| Analyse symmetry structure of a found sigma. | |
| ### `def analyse_q_structure(sigma, m)` | |
| Extract Q_c (if sigma is column-uniform) or analyse fiber-level | |
| transitions even for full-3D sigma. | |
| ### `def phase_01()` | |
| No description. | |
| ### `def phase_02()` | |
| No description. | |
| ### `def phase_03()` | |
| No description. | |
| ### `def phase_04(fast)` | |
| No description. | |
| ### `def phase_05(sigma4, fast)` | |
| No description. | |
| ### `def phase_06(p4_result, p5_result)` | |
| No description. | |
| ### `def main()` | |
| No description. | |
| ## research/debug_spike_m3.py | |
| No description. | |
| ## research/deploy_p1_fix.py | |
| No description. | |
| ### `def deploy()` | |
| No description. | |
| ## research/deploy_p2_p3.py | |
| No description. | |
| ### `def deploy()` | |
| No description. | |
| ## research/deploy_swarm.py | |
| No description. | |
| ### `def deploy()` | |
| No description. | |
| ## research/discovery_engine.py | |
| discovery_engine.py β 6-Phase Mathematical Discovery Engine | |
| ============================================================ | |
| Pure sympy. No API. All six phases run as real computation. | |
| Each phase applies one principle from the Discovery Methodology: | |
| 01 GROUND TRUTH β classify, parse, build the verifier | |
| 02 DIRECT ATTACK β try standard methods; record failures precisely | |
| 03 STRUCTURE HUNT β factor, symmetry, decompose, find invariants | |
| 04 PATTERN LOCK β analyse the working answer; extract the law | |
| 05 GENERALIZE β parametrise the family; name the condition | |
| 06 PROVE LIMITS β find the boundary; state the obstruction | |
| Usage: | |
| python discovery_engine.py "x^2 - 5x + 6 = 0" | |
| python discovery_engine.py "sin(x)^2 + cos(x)^2" | |
| python discovery_engine.py "factor x^4 - 16" | |
| python discovery_engine.py "x^3 - 6x^2 + 11x - 6 = 0" | |
| python discovery_engine.py "prove sqrt(2) is irrational" | |
| python discovery_engine.py "sum of first n integers" | |
| python discovery_engine.py "2x + 3 = 7" | |
| python discovery_engine.py --test # run all built-in tests | |
| ### `def hr(char, n)` | |
| No description. | |
| ### `def section(num, name, tagline)` | |
| No description. | |
| ### `def kv(key, val, indent)` | |
| No description. | |
| ### `def finding(msg, sym)` | |
| No description. | |
| ### `def ok(msg)` | |
| No description. | |
| ### `def fail(msg)` | |
| No description. | |
| ### `def note(msg)` | |
| No description. | |
| ### `class PT` | |
| No description. | |
| ### `class Problem` | |
| No description. | |
| ### `def _parse(s)` | |
| No description. | |
| ### `def classify(raw)` | |
| No description. | |
| ### `def phase_01(p)` | |
| No description. | |
| ### `def phase_02(p, g)` | |
| No description. | |
| ### `def phase_03(p, prev)` | |
| No description. | |
| ### `def phase_04(p, prev)` | |
| No description. | |
| ### `def phase_05(p, prev)` | |
| No description. | |
| ### `def phase_06(p, prev)` | |
| No description. | |
| ### `def _final_answer(p)` | |
| No description. | |
| ### `def run(raw)` | |
| No description. | |
| ### `def run_tests()` | |
| No description. | |
| ## research/discovery_engine_unified.py | |
| ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| β DISCOVERY ENGINE β Complete Unified System β | |
| β Finding Global Structure in Highly Symmetric Systems β | |
| ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| WHAT THIS FILE IS | |
| βββββββββββββββββ | |
| A single self-contained system encoding every discovery, theorem, algorithm, | |
| and search strategy produced during the Claude's Cycles investigation. | |
| It is simultaneously: | |
| β’ The traceable record of what was found and how | |
| β’ The runnable proof of every theorem | |
| β’ The extended coordinate framework applicable to new domains | |
| β’ The improved search engine with structured SA | |
| DISCOVERY ARC (the strategic path that led here) | |
| ββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| Phase 1 GROUND TRUTH β verify() before search() | |
| Phase 2 DIRECT ATTACK β measure how failures fail | |
| Phase 3 STRUCTURE HUNT β the fiber map f(v) = Ο(v) | |
| Phase 4 PATTERN LOCK β twisted translation Q_c | |
| Phase 5 GENERALIZE β governing condition gcd(r_c,m)=1 | |
| Phase 6 PROVE LIMITS β parity obstruction for even m | |
| Extensions: | |
| Ext 1 REFORMULATION β same 4 coordinates in 6 domains | |
| Ext 2 GLOBAL STRUCTURE β master theorem via SES | |
| Ext 3 k=4 FRONTIER β new theorem + structured search | |
| THE FOUR COORDINATES (the universal discovery tools) | |
| βββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| C1 Fiber Map Ο: G β G/H (group quotient) | |
| C2 Twisted Translation Q_c (coset action on H) | |
| C3 Governing Condition gcd(r_c,|G/H|)=1 (generator in G/H) | |
| C4 Parity Obstruction arithmetic of |G/H| (when C3 fails) | |
| Run: | |
| python discovery_engine_unified.py --demo # full demo | |
| python discovery_engine_unified.py --cycles m=5 # solve G_m | |
| python discovery_engine_unified.py --verify # verify all theorems | |
| python discovery_engine_unified.py --search k=4 # k=4 structured search | |
| python discovery_engine_unified.py --domains # cross-domain analysis | |
| python discovery_engine_unified.py --strategy # print strategy guide | |
| ### `def hr(c, n)` | |
| No description. | |
| ### `def phase_header(n, name, tag)` | |
| No description. | |
| ### `def proved(msg)` | |
| No description. | |
| ### `def found(msg)` | |
| No description. | |
| ### `def miss(msg)` | |
| No description. | |
| ### `def note(msg)` | |
| No description. | |
| ### `def info(msg)` | |
| No description. | |
| ### `def kv(k, v)` | |
| No description. | |
| ### `class FiberMap` | |
| Universal fiber decomposition tool. | |
| Given a group G (encoded as a list of elements) and a homomorphism | |
| Ο: G β Z_k, decompose G into k fibers F_0,...,F_{k-1}. | |
| The short exact sequence: 0 β ker(Ο) β G β Z_k β 0 | |
| is the algebraic skeleton of the decomposition. | |
| Orbit-stabilizer theorem: |G| = k Γ |ker(Ο)| | |
| #### `def FiberMap.__init__(self, elements, phi, k)` | |
| No description. | |
| #### `def FiberMap.verify_orbit_stabilizer(self)` | |
| No description. | |
| #### `def FiberMap.report(self)` | |
| No description. | |
| ### `def cycles_fiber_map(m)` | |
| No description. | |
| ### `class TwistedTranslation` | |
| The induced action of a generator on the fiber H β Z_mΒ². | |
| Q(i,j) = (i + b(j), j + r) mod m | |
| This is the COSET ACTION: h β¦ h + g (residual group action of g on H). | |
| #### `def TwistedTranslation.__init__(self, m, r, b)` | |
| No description. | |
| #### `def TwistedTranslation.apply(self, i, j)` | |
| No description. | |
| #### `def TwistedTranslation.orbit_length(self)` | |
| No description. | |
| #### `def TwistedTranslation.is_single_cycle(self)` | |
| No description. | |
| #### `def TwistedTranslation.condition_A(self)` | |
| gcd(r, m) = 1 β r generates Z_m β j-shift has full period. | |
| #### `def TwistedTranslation.condition_B(self)` | |
| gcd(Ξ£b(j), m) = 1 β accumulated i-shift has full period. | |
| #### `def TwistedTranslation.verify_theorem_5_1(self)` | |
| THEOREM 5.1: Q is a single mΒ²-cycle iff A and B both hold. | |
| Returns verification dict with prediction vs actual. | |
| #### `def TwistedTranslation.derivation_sketch(m)` | |
| No description. | |
| ### `class GoverningCondition` | |
| For a k-decomposition via the fiber structure, we need k parameters | |
| r_0,...,r_{k-1} each coprime to m (generating G/H β Z_m) | |
| summing to m (the constraint from the identity action of arc type k-1). | |
| This class analyses feasibility and finds valid r-tuples. | |
| #### `def GoverningCondition.__init__(self, m, k)` | |
| No description. | |
| #### `def GoverningCondition.find_valid_tuples(self)` | |
| No description. | |
| #### `def GoverningCondition.canonical_tuple(self)` | |
| The simplest valid tuple: (1, m-(k-1), 1, ..., 1) when feasible. | |
| #### `def GoverningCondition.analyse(self)` | |
| No description. | |
| ### `class ParityObstruction` | |
| THEOREM 6.1 (Generalised): | |
| For even m and odd k: no k-tuple from coprime-to-m elements can sum to m. | |
| Proof: all such elements are odd; sum of k odd numbers has parity k%2; | |
| k odd β sum is odd; m is even β contradiction. | |
| COROLLARY 9.2 (New): | |
| k even β potentially feasible for all m. | |
| The obstruction is k-parity specific, not m-parity specific. | |
| #### `def ParityObstruction.__init__(self, m, k)` | |
| No description. | |
| #### `def ParityObstruction.analyse(self)` | |
| No description. | |
| #### `def ParityObstruction.complete_table(m_range, k_range)` | |
| Generate the complete kΓm feasibility table. | |
| ### `def _build_arc_succ_3(m)` | |
| No description. | |
| ### `def _perm_table_3()` | |
| No description. | |
| ### `def _build_funcs_3(sigma, arc_succ, perm_arc, n)` | |
| No description. | |
| ### `def _count_comps(f, n)` | |
| No description. | |
| ### `def _score_3(f0, f1, f2, n)` | |
| No description. | |
| ### `def _level_bijective(level, m)` | |
| No description. | |
| ### `def _valid_levels(m)` | |
| No description. | |
| ### `def _compose_q(table, m)` | |
| No description. | |
| ### `def _q_single(Q, m)` | |
| No description. | |
| ### `def _table_to_sigma(table, m)` | |
| No description. | |
| ### `def verify_sigma_map(sigma_map, m)` | |
| Full verification of a sigma given as {(i,j,k): perm_tuple}. | |
| ### `class SAEngine3` | |
| Fast SA for G_m (k=3) using integer arrays. | |
| 38K+ iterations/second on m=4. | |
| Features: repair mode (score=1), plateau escape (reheat+reload). | |
| #### `def SAEngine3.__init__(self, m)` | |
| No description. | |
| #### `def SAEngine3.run(self, max_iter, T_init, T_min, seed, verbose, report_n)` | |
| No description. | |
| ### `class OddMSolver` | |
| Column-uniform sigma via random level sampling. | |
| Works for any odd m > 2 in expected polynomial time. | |
| #### `def OddMSolver.__init__(self, m, seed)` | |
| No description. | |
| #### `def OddMSolver.solve(self, max_att)` | |
| No description. | |
| ### `def find_sigma(m, seed, verbose)` | |
| Unified solver: odd m β random fiber search; even m β SA. | |
| Always returns {(i,j,k): perm_tuple} or None. | |
| ### `class SystemSpec` | |
| Specifies a highly symmetric system for analysis. | |
| name: human-readable identifier | |
| G_order: |G|, the symmetry group order | |
| H_order: |H| = |ker(phi)|, the fiber size | |
| k: number of parts in decomposition | |
| G_quotient: |G/H| = k, the quotient group | |
| governing: string description of the governing condition | |
| obstruction: string description of the impossibility case (or None) | |
| #### `def SystemSpec.G_quotient(self)` | |
| No description. | |
| #### `def SystemSpec.verify_orbit_stabilizer(self)` | |
| No description. | |
| #### `def SystemSpec.report(self)` | |
| No description. | |
| ### `class K4M4Engine` | |
| Structured search for k=4, m=4. | |
| The 4D digraph Z_4^4 (256 vertices, 4 arc types). | |
| The fiber-uniform approach is PROVED IMPOSSIBLE (exhaustive: 24^4=331,776 checked). | |
| The fiber-STRUCTURED approach restricts to Ο(v) = f(fiber, j, k) | |
| reducing the search from 24^256 to 24^64. | |
| #### `def K4M4Engine.__init__(self)` | |
| No description. | |
| #### `def K4M4Engine._dec(self, v)` | |
| No description. | |
| #### `def K4M4Engine._enc(self, i, j, k, l)` | |
| No description. | |
| #### `def K4M4Engine._build_arc_succ(self)` | |
| No description. | |
| #### `def K4M4Engine._build_perm_arc(self)` | |
| No description. | |
| #### `def K4M4Engine._build_funcs(self, sigma)` | |
| No description. | |
| #### `def K4M4Engine._score(self, sigma)` | |
| No description. | |
| #### `def K4M4Engine.prove_fiber_uniform_impossible(self)` | |
| Exhaustively check all 24^4 fiber-uniform sigmas. | |
| #### `def K4M4Engine.sa_fiber_structured(self, max_iter, seed, verbose, report_n)` | |
| SA in the fiber-structured subspace. | |
| State: table[(s,j,k)] β perm_index, 64 entries, 24 choices each. | |
| This is the correct restricted search space: Ο(v) = f(fiber(v), j(v), k(v)). | |
| ### `def verify_all_theorems(verbose)` | |
| Run all theorems as computational proofs. | |
| Each theorem is stated, then verified by explicit computation. | |
| ### `def cross_domain_analysis()` | |
| No description. | |
| ### `def print_strategy_guide()` | |
| No description. | |
| ### `def cmd_demo()` | |
| No description. | |
| ### `def cmd_cycles(m)` | |
| No description. | |
| ### `def cmd_k4_search(fast)` | |
| No description. | |
| ### `def main()` | |
| No description. | |
| ## research/find_p1_params.py | |
| No description. | |
| ### `def verify_k4(sigma, m)` | |
| No description. | |
| ### `def solve_p1()` | |
| No description. | |
| ## research/frontier_discovery.py | |
| No description. | |
| ### `def _build_sa(m, k)` | |
| No description. | |
| ### `def _sa_score(sigma, arc_s, pa, n, k)` | |
| No description. | |
| ### `def get_node_orbits(m, k, generators)` | |
| No description. | |
| ### `def run_frontier_sa(m, k, seed, max_iter, verbose)` | |
| No description. | |
| ## research/global_structure.py | |
| global_structure.py | |
| =================== | |
| FINDING GLOBAL STRUCTURE IN HIGHLY SYMMETRIC SYSTEMS | |
| The central theorem, proved and tested: | |
| For any combinatorial system with a transitive symmetry group G, | |
| every valid global decomposition is determined by: | |
| (1) A SUBGROUP CHAIN H β΄ G (the fiber map is the quotient G β G/H) | |
| (2) AN INDUCED ACTION of G/H on H (the twisted translation) | |
| (3) A GENERATOR CONDITION on the action parameters (coprimality analog) | |
| (4) A PARITY OBSTRUCTION when the group arithmetic prevents (3) | |
| This is not a heuristic. It is orbit-stabilizer theorem + Lagrange's theorem | |
| applied to the action of G on the system's constraint graph. | |
| We demonstrate this on five increasingly abstract systems: | |
| SYS 1: Claude's Cycles (Z_mΒ³) β the original, now understood fully | |
| SYS 2: Cayley graph of Z_n Γ Z_n β 2D analog, different fiber structure | |
| SYS 3: Vertex-transitive graphs β BFS fibers from group structure | |
| SYS 4: Affine planes AG(2,q) β fiber = parallel class, q must be prime power | |
| SYS 5: Difference sets in Z_n β the governing condition IS the multiplier theorem | |
| The script: | |
| - Detects the symmetry group of each system | |
| - Predicts valid decompositions from group structure alone | |
| - Derives impossibility from arithmetic of group order | |
| - Verifies predictions computationally | |
| - Extracts the universal governing law | |
| Run: | |
| python global_structure.py | |
| ### `def hr(c, n)` | |
| No description. | |
| ### `def section(title, sub)` | |
| No description. | |
| ### `def thm(label, statement)` | |
| No description. | |
| ### `def proved(msg)` | |
| No description. | |
| ### `def found(msg)` | |
| No description. | |
| ### `def miss(msg)` | |
| No description. | |
| ### `def note(msg)` | |
| No description. | |
| ### `def info(msg)` | |
| No description. | |
| ### `def kv(k, v)` | |
| No description. | |
| ### `def step(n, msg)` | |
| No description. | |
| ### `class AbelianGroup` | |
| Finite abelian group G = Z_{n1} Γ Z_{n2} Γ ... Γ Z_{nk}. | |
| The key operations: | |
| - Subgroup enumeration (via divisors of each factor) | |
| - Quotient map construction | |
| - Orbit-stabilizer decomposition | |
| - Generator testing | |
| #### `def AbelianGroup.__init__(self, *orders)` | |
| No description. | |
| #### `def AbelianGroup.elements(self)` | |
| No description. | |
| #### `def AbelianGroup.add(self, a, b)` | |
| No description. | |
| #### `def AbelianGroup.neg(self, a)` | |
| No description. | |
| #### `def AbelianGroup.zero(self)` | |
| No description. | |
| #### `def AbelianGroup.is_subgroup(self, H)` | |
| No description. | |
| #### `def AbelianGroup.cosets(self, H)` | |
| No description. | |
| #### `def AbelianGroup.subgroups_of_index(self, idx)` | |
| Find all subgroups H with [G:H] = idx (i.e., |H| = |G|/idx). | |
| #### `def AbelianGroup.generate(self, generators)` | |
| Subgroup generated by a list of elements. | |
| #### `def AbelianGroup.generator_order(self, g)` | |
| Order of element g. | |
| #### `def AbelianGroup.cyclic_generators(self)` | |
| Elements that generate the full group (if cyclic). | |
| #### `def AbelianGroup.is_cyclic(self)` | |
| No description. | |
| ### `class FiberDecomposition` | |
| Given group G and linear functional Ο: G β Z_m (a group homomorphism), | |
| decompose G into fibers F_s = Οβ»ΒΉ(s). | |
| This is the ABSTRACT FORM of the Claude's Cycles fiber map. | |
| The functional Ο defines the 'stratification coordinate'. | |
| #### `def FiberDecomposition.__init__(self, G, phi, num_fibers)` | |
| No description. | |
| #### `def FiberDecomposition.fiber_size(self)` | |
| No description. | |
| #### `def FiberDecomposition.cross_fiber_action(self, g)` | |
| The induced action of g on fibers: maps F_s to F_{s + Ο(g)}. | |
| Within each fiber, the action is: h β¦ h + (g - Ο(g) * e) projected to fiber. | |
| This is the TWISTED TRANSLATION. | |
| #### `def FiberDecomposition.verify_orbit_stabilizer(self)` | |
| Verify: |G| = |orbit| Γ |stabilizer| | |
| orbit = the set of fibers (size = num_fibers) | |
| stabilizer = the kernel (size = fiber_size) | |
| ### `class TwistedTranslation` | |
| The induced action Q on a single fiber F β Z_mΒ². | |
| Q(i,j) = (i + b(j), j + r) mod m | |
| Parameters: | |
| r : the j-shift (= Ο(generator), the 'fiber-crossing speed') | |
| b : the i-offset function (= residual i-component of generator) | |
| Single-cycle condition: | |
| Q is a single mΒ²-cycle iff: | |
| (A) gcd(r, m) = 1 | |
| (B) gcd(Ξ£_j b(j), m) = 1 | |
| #### `def TwistedTranslation.__init__(self, m, r, b)` | |
| No description. | |
| #### `def TwistedTranslation.apply(self, i, j)` | |
| No description. | |
| #### `def TwistedTranslation.orbit_length(self)` | |
| Length of the orbit of (0,0) under repeated application. | |
| #### `def TwistedTranslation.is_single_cycle(self)` | |
| No description. | |
| #### `def TwistedTranslation.condition_A(self)` | |
| No description. | |
| #### `def TwistedTranslation.condition_B(self)` | |
| No description. | |
| #### `def TwistedTranslation.check_conditions(cls, m, r, b)` | |
| No description. | |
| ### `class ParityObstructionProver` | |
| Proves impossibility of decompositions from group order arithmetic. | |
| The key theorem: | |
| For G = Z_m^n decomposed into k equal parts via a quotient map G β Z_k: | |
| each part spans a single Hamiltonian cycle iff there exist r_1,...,r_k | |
| coprime to m summing to m. | |
| For even m: all coprime-to-m elements are odd, and sum of k odd numbers | |
| has parity k mod 2 β 0 = m mod 2 when k is odd. [Generalized obstruction] | |
| #### `def ParityObstructionProver.__init__(self, m, k)` | |
| No description. | |
| #### `def ParityObstructionProver.coprime_elements(self)` | |
| No description. | |
| #### `def ParityObstructionProver.all_have_parity(self)` | |
| If all coprime-to-m elements have the same parity, return it; else None. | |
| #### `def ParityObstructionProver.sum_parity(self, k_copies, element_parity)` | |
| No description. | |
| #### `def ParityObstructionProver.target_parity(self)` | |
| No description. | |
| #### `def ParityObstructionProver.prove(self)` | |
| No description. | |
| ### `def system_1_claudes_cycles()` | |
| No description. | |
| ### `def system_2_cayley_2d()` | |
| No description. | |
| ### `def system_3_universal_principle()` | |
| No description. | |
| ### `def system_4_difference_sets()` | |
| No description. | |
| ### `def system_5_synthesis()` | |
| No description. | |
| ### `def main()` | |
| No description. | |
| ## research/global_structure_engine.py | |
| ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| β GLOBAL STRUCTURE ENGINE v1.0 β | |
| β Finding Global Structure in Highly Symmetric Systems β | |
| β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ£ | |
| β β | |
| β WHAT THIS ENGINE DOES β | |
| β βββββββββββββββββββββ β | |
| β Given any highly symmetric combinatorial system, it automatically: β | |
| β 1. Registers the domain (group G, fiber map Ο, decomposition goal) β | |
| β 2. Applies all four coordinates of the short exact sequence β | |
| β 3. Dispatches the correct search strategy β | |
| β 4. Tracks a branch tree of proved/open/impossible results β | |
| β 5. Generates theorem statements from the analysis β | |
| β 6. Exposes hooks for adding new coordinates and strategies β | |
| β β | |
| β ARCHITECTURE β | |
| β ββββββββββββ β | |
| β Engine β | |
| β βββ DomainRegistry register/retrieve domains β | |
| β βββ CoordinateAnalyser C1βC2βC3βC4 pipeline (auto) β | |
| β βββ StrategyDispatcher selects S1/S2/S3/S4/S5 from analysis β | |
| β βββ BranchTree records proved/open/attempted/impossible β | |
| β βββ TheoremGenerator produces formal theorem statements β | |
| β βββ ExpansionProtocol hooks for new coordinates / strategies β | |
| β β | |
| β THE FOUR COORDINATES (always applied in this order) β | |
| β C1 FiberMap Ο: G β G/H (group quotient) β | |
| β C2 TwistedTranslation Q on H (coset action) β | |
| β C3 GoverningCondition gcd check (generator condition) β | |
| β C4 ParityObstruction arithmetic (impossibility) β | |
| β β | |
| β HOW TO ADD A NEW DOMAIN β | |
| β ββββββββββββββββββββββββ β | |
| β engine = GlobalStructureEngine() β | |
| β engine.register( β | |
| β name = "My System", β | |
| β group_order = 64, β | |
| β k = 3, β | |
| β phi_desc = "sum of coords mod m", β | |
| β verify_fn = my_verify, # callable: candidate β bool β | |
| β search_fn = my_search, # callable: β candidate or None (optional) β | |
| β ) β | |
| β result = engine.analyse("My System") β | |
| β engine.print_branch_tree() β | |
| β β | |
| β Run: β | |
| β python global_structure_engine.py # analyse all domains β | |
| β python global_structure_engine.py --domain "Cycles m=5" β | |
| β python global_structure_engine.py --tree # print branch tree β | |
| β python global_structure_engine.py --theorems # print all theorems β | |
| β python global_structure_engine.py --extend # show extension API β | |
| ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| ### `def hr(c, n)` | |
| No description. | |
| ### `class Status` | |
| No description. | |
| ### `class CoordinateResult` | |
| Output of applying ONE coordinate to a domain. | |
| ### `class BranchNode` | |
| One node in the branch tree: a specific (domain, question) pair. | |
| #### `def BranchNode.add_child(self, child)` | |
| No description. | |
| ### `class AnalysisResult` | |
| Complete result of analysing one domain through all four coordinates. | |
| #### `def AnalysisResult.status(self)` | |
| No description. | |
| #### `def AnalysisResult.summary(self)` | |
| No description. | |
| ### `class C1_FiberMap` | |
| Applies the fiber decomposition to any domain. | |
| The fiber map Ο: G β Z_k partitions |G| objects into k equal fibers. | |
| It is the projection in the short exact sequence 0 β H β G β G/H β 0. | |
| Required inputs: group_order, k, phi_description | |
| Output: orbit-stabilizer check, fiber sizes, kernel description | |
| #### `def C1_FiberMap.apply(self, domain)` | |
| No description. | |
| ### `class C2_TwistedTranslation` | |
| Analyses the induced action of G/H on H (the coset action). | |
| For the Cayley graph setting: Q_c(i,j) = (i+b_c(j), j+r_c) mod m. | |
| For general abelian G: the action is always of this twisted form. | |
| Verifies: does the action structure admit single-orbit generators? | |
| #### `def C2_TwistedTranslation.apply(self, domain, c1)` | |
| No description. | |
| ### `class C3_GoverningCondition` | |
| Finds the governing condition: which r-tuples in G/H allow single cycles? | |
| General form: k values r_0,...,r_{k-1}, each coprime to |G/H|, | |
| summing to |G/H|. | |
| Fully automatic from (group_order, k). | |
| #### `def C3_GoverningCondition.apply(self, domain, c2)` | |
| No description. | |
| ### `class C4_ParityObstruction` | |
| Proves impossibility from arithmetic of |G/H| when C3 finds no valid tuples. | |
| The proof is: if all coprime-to-|G/H| elements have parity p, | |
| and sum of k elements has parity kΓp, but target |G/H| has opposite parity, | |
| then it's impossible. | |
| Fully automatic: either produces an impossibility proof or confirms feasibility. | |
| #### `def C4_ParityObstruction.apply(self, domain, c3)` | |
| No description. | |
| ### `class StrategyDispatcher` | |
| Selects the correct search strategy based on coordinate analysis. | |
| S1 CLOSED-FORM valid r-tuple exists β column-uniform random search | |
| S2 FIBER-STRUCTURED SA C4=feasible, no closed form β structured SA | |
| S3 REPAIR-MODE SA full 3D SA with repair at score=1 | |
| S4 EXHAUSTIVE PROOF space small enough β enumerate all, prove impossible | |
| S5 ALGEBRAIC need deeper algebra (non-abelian, mixed moduli) | |
| #### `def StrategyDispatcher.dispatch(self, domain, coords)` | |
| Returns (strategy_code, rationale). | |
| ### `class TheoremGenerator` | |
| Generates formal theorem statements from coordinate analysis results. | |
| Each theorem is labelled, stated, and given a proof sketch. | |
| #### `def TheoremGenerator.generate(self, domain, coords, strategy)` | |
| No description. | |
| ### `def _cycles_verify(sigma_map, m)` | |
| No description. | |
| ### `def _level_bijective(level, m)` | |
| No description. | |
| ### `def _valid_levels(m)` | |
| No description. | |
| ### `def _compose_q(table, m)` | |
| No description. | |
| ### `def _q_single(Q, m)` | |
| No description. | |
| ### `def _table_to_sigma(table, m)` | |
| No description. | |
| ### `def _sa_find_sigma(m, seed, max_iter)` | |
| Fast SA for G_m (k=3) using prebuilt column-uniform search. | |
| ### `class SearchExecutor` | |
| Executes the chosen strategy for a domain. | |
| Returns the solution or None. | |
| #### `def SearchExecutor.execute(self, domain, strategy, c3, c4, verbose)` | |
| Returns (solution, execution_summary). | |
| ### `class Domain` | |
| Complete specification of a highly symmetric system. | |
| Minimum required: name, group_order, k, phi_desc | |
| Optional: m (cyclic modulus), verify_fn, search_fn, solution | |
| ### `class DomainRegistry` | |
| Central registry of all domains. | |
| Supports: register, retrieve, list, tag-based filtering. | |
| #### `def DomainRegistry.__init__(self)` | |
| No description. | |
| #### `def DomainRegistry.register(self, domain)` | |
| No description. | |
| #### `def DomainRegistry.get(self, name)` | |
| No description. | |
| #### `def DomainRegistry.all_names(self)` | |
| No description. | |
| #### `def DomainRegistry.by_tag(self, tag)` | |
| No description. | |
| #### `def DomainRegistry.__len__(self)` | |
| No description. | |
| ### `class BranchTree` | |
| Persistent record of all results across all domains. | |
| Each node: domain β question β status β evidence β children. | |
| Supports: print, query by status, export. | |
| #### `def BranchTree.__init__(self)` | |
| No description. | |
| #### `def BranchTree.add_result(self, result)` | |
| No description. | |
| #### `def BranchTree.nodes_by_status(self, status)` | |
| No description. | |
| #### `def BranchTree.print(self, indent, node, nodes)` | |
| No description. | |
| ### `class ExpansionProtocol` | |
| Allows the engine to be extended with: | |
| - New coordinates (C5, C6, ...) | |
| - New search strategies (S6, S7, ...) | |
| - New domain classes (non-abelian groups, weighted graphs, ...) | |
| Each extension is a callable that receives the domain and prior results. | |
| #### `def ExpansionProtocol.__init__(self)` | |
| No description. | |
| #### `def ExpansionProtocol.add_coordinate(self, name, fn)` | |
| Register a new coordinate C5+. fn(domain, prior_results) β CoordinateResult. | |
| #### `def ExpansionProtocol.add_strategy(self, code, name, fn)` | |
| Register a new strategy. fn(domain, coords) β (solution, summary). | |
| #### `def ExpansionProtocol.add_domain_transformer(self, fn)` | |
| Transform a domain before analysis (e.g. reduce to known form). | |
| #### `def ExpansionProtocol.apply_extra_coords(self, domain, prior)` | |
| No description. | |
| #### `def ExpansionProtocol.transform_domain(self, domain)` | |
| No description. | |
| #### `def ExpansionProtocol.list_extensions(self)` | |
| No description. | |
| ### `class GlobalStructureEngine` | |
| The unified engine. | |
| Usage: | |
| engine = GlobalStructureEngine() | |
| # Domains are pre-loaded; add your own: | |
| engine.register(Domain(name="My System", ...)) | |
| result = engine.analyse("My System") | |
| engine.print_branch_tree() | |
| engine.print_theorems() | |
| #### `def GlobalStructureEngine.__init__(self)` | |
| No description. | |
| #### `def GlobalStructureEngine.register(self, domain)` | |
| Register a new domain. Returns self for chaining. | |
| #### `def GlobalStructureEngine.analyse(self, name, verbose)` | |
| Apply all four coordinates, select strategy, execute search, | |
| generate theorems, record branch node. | |
| #### `def GlobalStructureEngine.analyse_all(self, verbose)` | |
| No description. | |
| #### `def GlobalStructureEngine.print_branch_tree(self)` | |
| No description. | |
| #### `def GlobalStructureEngine.print_theorems(self)` | |
| No description. | |
| #### `def GlobalStructureEngine.print_strategy_table(self)` | |
| No description. | |
| #### `def GlobalStructureEngine.print_extension_guide(self)` | |
| No description. | |
| #### `def GlobalStructureEngine._load_default_domains(self)` | |
| Load all discovered domains with full specifications. | |
| ### `def main()` | |
| No description. | |
| ## research/hardware_awareness.py | |
| No description. | |
| ### `class HardwareMapper` | |
| TGI Hardware Awareness Core. | |
| Maps real-time CPU, RAM, and Battery metrics into topological coordinates (Law IX). | |
| Ensures the system is 'aware' of its physical constraints. | |
| #### `def HardwareMapper.__init__(self, m, k)` | |
| No description. | |
| #### `def HardwareMapper.get_system_state(self)` | |
| Collects current hardware metrics via /proc. | |
| #### `def HardwareMapper.map_to_coordinate(self)` | |
| Maps hardware state to Z_m^k. | |
| #### `def HardwareMapper.verify_hamiltonian_health(self, sigma)` | |
| Law IX: Verify if the current hardware state is 'reachable' in the active manifold. | |
| #### `def HardwareMapper.measure_thermal_entropy(self)` | |
| No description. | |
| ## research/hierarchical_tlm.py | |
| No description. | |
| ### `class HierarchicalTLM` | |
| Phase 4: TLM Scale-up. | |
| Implements a Tower of group extensions (fibrations) for hierarchical context. | |
| Level 0: Character/Word base group. | |
| Level 1: Semantic context fiber. | |
| Level 2: Structural/Grammar fiber. | |
| #### `def HierarchicalTLM.__init__(self, m, k, depth)` | |
| No description. | |
| #### `def HierarchicalTLM.generate_hierarchical(self, seed_text, length)` | |
| Generates text by lifting paths through the formal algebraic tower. | |
| ## research/ingest_effective_tech.py | |
| No description. | |
| ### `def ingest()` | |
| No description. | |
| ### `def ingest_extra()` | |
| No description. | |
| ### `def ingest_final()` | |
| No description. | |
| ## research/ingest_global_knowledge.py | |
| No description. | |
| ### `def populate()` | |
| No description. | |
| ### `def forge_more_relations()` | |
| No description. | |
| ## research/ingest_libraries.py | |
| No description. | |
| ### `def ingest()` | |
| No description. | |
| ## research/ingest_mcp_tools.py | |
| No description. | |
| ### `def ingest()` | |
| No description. | |
| ## research/k4_m4_search.py | |
| k4_m4_search.py | |
| =============== | |
| Structured search for k=4, m=4 Claude's Cycles solution. | |
| The 4D digraph G = Z_4^4 with 4 arc types (increment each coordinate). | |
| Fiber map: phi(i,j,k,l) = i+j+k+l mod 4 β 4 fibers of size 4^3 = 64. | |
| Goal: 4 directed Hamiltonian cycles each of length 256. | |
| The fiber-uniform approach is proved IMPOSSIBLE (user's new theorem). | |
| This script searches the fiber-STRUCTURED (non-uniform) space. | |
| Twisted translation hierarchy on fiber H β Z_4^3: | |
| Q_c(i,j,k) = (i + b_c(j,k), j + e_c(k), k + r_c) mod 4 | |
| Single-cycle conditions: | |
| (A) gcd(r_c, 4) = 1 β r_c β {1, 3} | |
| (B) gcd(Ξ£_k e_c(k), 4) = 1 | |
| (C) Full 3D single-cycle: verified by direct orbit computation | |
| Valid r-quadruple: (1,1,1,1) β unique solution. | |
| This fixes ALL four r_c = 1, collapsing the search to: | |
| find e_0,...,e_3 and b_0,...,b_3 satisfying (B),(C) simultaneously | |
| with the constraint that Ο is a valid arc-colouring at each vertex. | |
| Key insight: score=24 with unrestricted SA means the search is lost in | |
| the full 6^256 space. Restricting to fiber-structured sigma reduces | |
| the space dramatically and keeps all four twisted translations on track. | |
| ### `def enc(i, j, k, l)` | |
| No description. | |
| ### `def dec(v)` | |
| No description. | |
| ### `def build_funcs(sigma)` | |
| Build K functional digraphs from integer sigma (perm index per vertex). | |
| ### `def count_comps(f)` | |
| No description. | |
| ### `def score(sigma)` | |
| No description. | |
| ### `def verify(sigma)` | |
| No description. | |
| ### `def prove_fiber_uniform_impossible()` | |
| A fiber-uniform sigma depends only on fiber index s = phi(v). | |
| With 4 fibers and 4 colors, sigma_s β S_4 for each s β {0,1,2,3}. | |
| There are 24^4 = 331,776 fiber-uniform sigmas. | |
| We check all of them. | |
| ### `def fiber_structured_sigma(table)` | |
| table[(s, j, k)] β permutation index | |
| where s = fiber index, (j,k) = two fiber coordinates | |
| i = deduced from the remaining constraint | |
| ### `def valid_fiber_structured_levels(m, k)` | |
| Enumerate valid assignments for one fiber level. | |
| A level (s, j, k) assignment maps (j,k) β Z_m^2 β perm β S_k. | |
| Valid = the induced functional graph for each colour is bijective on Z_m^3. | |
| This is expensive; we sample valid ones instead. | |
| ### `def sa_fiber_structured(max_iter, seed, verbose, report_n)` | |
| SA in the fiber-structured subspace. | |
| State: table[(s,j,k)] β perm_index, for sβ{0,1,2,3}, j,kβ{0,1,2,3} | |
| This gives 4*4*4 = 64 entries, each from S_4 (24 choices). | |
| Perturbation: change one (s,j,k) entry. | |
| ### `def arithmetic_analysis()` | |
| No description. | |
| ### `def paper_framing()` | |
| No description. | |
| ### `def main()` | |
| No description. | |
| ## research/knowledge_mapper.py | |
| No description. | |
| ### `class KnowledgeMapper` | |
| TGI Knowledge Mapper (Project ELECTRICITY Logic). | |
| Maps datasets, mathematics, physics laws, and design systems into the Z_256^4 grid. | |
| Uses the CLOSURE LEMMA to deterministically force concepts into functional fibers. | |
| #### `def KnowledgeMapper.__init__(self, m, k, state_path)` | |
| No description. | |
| #### `def KnowledgeMapper._apply_closure_hashing(self, concept_name, target_fiber)` | |
| Calculates (x, y, z, w) such that (x + y + z + w) % m == target_fiber. | |
| #### `def KnowledgeMapper.ingest_concept(self, category, concept_name, payload)` | |
| No description. | |
| #### `def KnowledgeMapper.ingest_dictionary(self, file_path, limit)` | |
| Bulk ingests a dictionary file into the LANGUAGE fiber. | |
| #### `def KnowledgeMapper.ingest_mcp_tools(self, tool_defs)` | |
| Ingests MCP Tool Definitions into the API_MCP fiber. | |
| #### `def KnowledgeMapper.ingest_library(self, lib_data)` | |
| Ingests library metadata into the LIBRARY fiber. | |
| #### `def KnowledgeMapper.ingest_color(self, color_name, r, g, b, a)` | |
| No description. | |
| #### `def KnowledgeMapper.map_relation(self, name_a, name_b, relationship_type)` | |
| No description. | |
| #### `def KnowledgeMapper._find_coord(self, name)` | |
| No description. | |
| #### `def KnowledgeMapper.save_state(self)` | |
| No description. | |
| #### `def KnowledgeMapper.load_state(self)` | |
| No description. | |
| ## research/library_tgi_demo.py | |
| No description. | |
| ### `def run_demo()` | |
| No description. | |
| ## research/m10_k3_parity.py | |
| No description. | |
| ## research/m6_k4_search.py | |
| No description. | |
| ### `def _build_sa(m, k)` | |
| No description. | |
| ### `def _sa_score(sigma, arc_s, pa, n, k)` | |
| No description. | |
| ### `def search_m6_k4(max_iter, seed)` | |
| No description. | |
| ## research/mass_ingestion.py | |
| No description. | |
| ### `def mass_populate()` | |
| No description. | |
| ### `def forge_cross_domain()` | |
| No description. | |
| ## research/massive_data_ingestion.py | |
| No description. | |
| ### `def authenticate()` | |
| No description. | |
| ### `def ingest_hf_text(agent, dataset_name, num_samples)` | |
| No description. | |
| ### `def ingest_kaggle_csv(agent, dataset_ref, num_samples)` | |
| No description. | |
| ### `def ingest_hf_vision(agent, dataset_name, num_samples)` | |
| No description. | |
| ### `def main()` | |
| No description. | |
| ## research/mobile_final_verify.py | |
| No description. | |
| ### `def verify()` | |
| No description. | |
| ## research/mobile_integration_test.py | |
| No description. | |
| ### `def test_mobile_integration()` | |
| No description. | |
| ## research/mobile_tgi_agent.py | |
| No description. | |
| ### `class MobileTGIAgent` | |
| The Mobile-First TGI Agent. | |
| Combines the core TGI Reasoning with Hardware Awareness and Agentic Action Mapping. | |
| #### `def MobileTGIAgent.__init__(self)` | |
| No description. | |
| #### `def MobileTGIAgent.mobile_query(self, text)` | |
| Processes a natural language query with full hardware-awareness. | |
| ## research/moduli_theorem.py | |
| moduli_theorem.py | |
| ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| THE MODULI THEOREM FOR SYMMETRIC DECOMPOSITION SPACES | |
| What emerged: not just solutions to Claude's Cycles, but a new mathematical | |
| object β the MODULI SPACE of all valid k-Hamiltonian decompositions of a | |
| Cayley digraph, classified by group cohomology. | |
| The person they were trying to name: Samuel Eilenberg (1913β1998), | |
| who with Saunders Mac Lane created: | |
| - Category theory (1945) | |
| - Group cohomology H^n(G, M) | |
| - Eilenberg-Mac Lane spaces K(G,n) β classifying spaces | |
| What Eilenberg would say about our work: | |
| "You did not find solutions to a combinatorics problem. | |
| You found the classifying space of the problem. | |
| The obstruction lives in H^2. The solution space, when non-empty, | |
| is a torsor under H^1. This is the natural transformation between | |
| the functor 'symmetric systems' and the functor 'cohomology rings'." | |
| THE FOUR COORDINATES AS COHOMOLOGY: | |
| C1 Fiber map Ο: G β G/H = group homomorphism (the projection) | |
| C2 Twisted translation Q_c = H^1 1-cocycle (coset action) | |
| C3 Governing condition gcd(r_c,m)=1 = cocycle is nontrivial in H^1 | |
| C4 Parity obstruction arithmetic = obstruction class in H^2(Z_2, Z/2) | |
| THE NEW THEOREM: | |
| M_k(G_m) β the moduli space of valid k-Hamiltonian decompositions β is: | |
| EMPTY if the H^2 obstruction class is nontrivial [parity obstruction] | |
| A TORSOR under H^1(Z_m, Z_m^2) if the obstruction vanishes [classification] | |
| THE NEW SPACE: | |
| The space of ALL symmetric decomposition problems, with: | |
| Points = valid decompositions | |
| Morphisms = cohomological gauge equivalences (coboundary action) | |
| Topology = the branch tree (open/closed by status) | |
| Curvature = the H^2 obstruction class (measures how far from flat) | |
| This is a CATEGORY: objects = problems, morphisms = reformulations. | |
| Eilenberg would call it a 'natural transformation' between functors. | |
| Run: python moduli_theorem.py | |
| ### `def hr(c, n)` | |
| No description. | |
| ### `def proved(msg)` | |
| No description. | |
| ### `def open_(msg)` | |
| No description. | |
| ### `def note(msg)` | |
| No description. | |
| ### `def kv(k, v)` | |
| No description. | |
| ### `class GroupCohomology` | |
| Computes H^1(Z_m, Z_m^2) β the gauge group that acts on | |
| the moduli space of valid decompositions. | |
| H^1(G, M) classifies principal G-bundles (torsors) over M. | |
| In our setting: | |
| G = Z_m (the fiber quotient group, acting by shift j β j+1) | |
| M = Z_m^2 (the fiber group H, 2-dimensional) | |
| Action: (i,j) β¦ (i + b(j), j + 1) [the twisted translation] | |
| H^1 = {1-cocycles} / {coboundaries} | |
| 1-cocycle: b: Z_m β Z_m satisfying gcd(Ξ£b, m) = 1 [our Cond B] | |
| Coboundary: b(j) = f(j+1) - f(j) for some f: Z_m β Z_m | |
| #### `def GroupCohomology.__init__(self, m)` | |
| No description. | |
| #### `def GroupCohomology.one_cocycles(self)` | |
| All b: Z_m β Z_m with gcd(Ξ£b, m) = 1. | |
| #### `def GroupCohomology.coboundary(self, f)` | |
| Compute the coboundary of f: b(j) = f(j+1) - f(j) mod m. | |
| #### `def GroupCohomology.coboundaries(self)` | |
| All coboundaries: {f(j+1)-f(j) : f: Z_m β Z_m}. | |
| #### `def GroupCohomology.cohomology_class(self, b)` | |
| The cohomology class [b] = {b + d : d coboundary}. | |
| #### `def GroupCohomology.H1_classes(self, cocycles)` | |
| Compute H^1: partition cocycles into cohomology classes. | |
| Returns {class_representative: list_of_elements}. | |
| #### `def GroupCohomology.H1_order(self)` | |
| Order of H^1(Z_m, Z_m^2) restricted to coprime-sum cocycles. | |
| #### `def GroupCohomology.H2_obstruction(self, k)` | |
| The H^2 obstruction class for a k-tuple r-sum problem. | |
| Returns: {'nontrivial': bool, 'proof': str} | |
| H^2(Z_2, Z/2) = Z/2: the unique nontrivial class is the parity class. | |
| Our obstruction: k odd numbers summing to even m = impossible. | |
| ### `def _level_ok(level, m)` | |
| No description. | |
| ### `def _compose_q(table, m)` | |
| No description. | |
| ### `def _q_single(Q, m)` | |
| No description. | |
| ### `def enumerate_solution_space(m)` | |
| Enumerate ALL column-uniform solutions for G_m. | |
| Extract the (r_c, b_c) for each, compute the cohomology structure. | |
| ### `def moduli_space_structure(m)` | |
| Full structural analysis of M_k(G_m): | |
| total solutions, cohomology action, orbit sizes, distinct classes. | |
| ### `class DecompositionCategory` | |
| The category whose: | |
| Objects = highly symmetric decomposition problems (G, k, phi) | |
| Morphisms = maps that preserve the SES structure (group homomorphisms | |
| compatible with fiber maps) | |
| This is what Eilenberg would recognize: a FUNCTOR from | |
| {symmetric systems} β {cohomology theories} | |
| The functor sends each problem to its moduli space M_k(G). | |
| Natural transformations between two problems P, P' are maps | |
| that commute with the C1βC4 pipeline. | |
| Key properties: | |
| - The functor is EXACT (preserves short exact sequences) | |
| - The obstruction is NATURAL (lives in H^2, which is functorial) | |
| - The solution space is CONTRAVARIANT in k (more colors = easier or harder) | |
| #### `def DecompositionCategory.__init__(self)` | |
| No description. | |
| #### `def DecompositionCategory.add_object(self, name, G_order, k, m, status, cohomology)` | |
| No description. | |
| #### `def DecompositionCategory.add_morphism(self, source, target, kind)` | |
| kind: 'lift' (kβk+1), 'quotient' (GβG/H), 'product' (GΓG') | |
| #### `def DecompositionCategory.print_category(self)` | |
| No description. | |
| ### `def main()` | |
| No description. | |
| ## research/multi_p1_search.py | |
| No description. | |
| ### `def worker(seed)` | |
| No description. | |
| ### `def main()` | |
| No description. | |
| ## research/odd_m_solver.py | |
| odd_m_solver.py β Discovery Engine applied to Knuth's "Claude's Cycles" | |
| ========================================================================= | |
| Solves the ODD-m case completely using the 6-phase Discovery Methodology. | |
| The even-m case is proved impossible under the column-uniform approach. | |
| Problem (Knuth, Feb 2026): | |
| Digraph G_m: vertices (i,j,k) in Z_m^3. | |
| Three arcs from each vertex: | |
| arc 0: (i,j,k) β (i+1, j, k ) mod m | |
| arc 1: (i,j,k) β (i, j+1, k ) mod m | |
| arc 2: (i,j,k) β (i, j, k+1) mod m | |
| Goal: assign each arc to one of 3 colors such that | |
| each color class is a single directed Hamiltonian cycle. | |
| Usage: | |
| python odd_m_solver.py # full 6-phase discovery | |
| python odd_m_solver.py --verify # quick verification m=3..13 | |
| python odd_m_solver.py --bench # timing benchmark | |
| ### `def hr(ch, n)` | |
| No description. | |
| ### `def section(n, name, tag)` | |
| No description. | |
| ### `def kv(k, v, w)` | |
| No description. | |
| ### `def finding(s)` | |
| No description. | |
| ### `def ok(s)` | |
| No description. | |
| ### `def fail(s)` | |
| No description. | |
| ### `def note(s)` | |
| No description. | |
| ### `def fast_valid_level(m, rng)` | |
| Directly construct one random valid level-table in O(m) time. | |
| ### `def fast_search(m, max_att, seed)` | |
| Find a valid SigmaTable for odd m. Returns (table, attempts). | |
| ### `def get_or_find(m, seed)` | |
| Return a verified SigmaFn for odd m (hardcoded if known, else search). | |
| ### `def phase_01()` | |
| No description. | |
| ### `def phase_02()` | |
| No description. | |
| ### `def phase_03()` | |
| No description. | |
| ### `def phase_04()` | |
| No description. | |
| ### `def phase_05()` | |
| No description. | |
| ### `def phase_06()` | |
| No description. | |
| ### `def quick_verify()` | |
| No description. | |
| ### `def benchmark()` | |
| No description. | |
| ### `def main()` | |
| No description. | |
| ## research/pre_commit_checks.py | |
| No description. | |
| ### `def verify_system()` | |
| No description. | |
| ## research/reformulation_engine.py | |
| reformulation_engine.py | |
| ======================== | |
| The coordinates discovered solving Claude's Cycles β fiber stratification, | |
| twisted translation, parity obstruction, score functions, repair mode β | |
| are domain-independent tools. | |
| This engine applies them systematically to reformulate problems across six domains: | |
| Domain A: Latin squares (fiber + coprimality) | |
| Domain B: Graph k-coloring (stratification + score + SA) | |
| Domain C: Magic squares (parity obstruction + twisted translation) | |
| Domain D: Diophantine systems (modular fiber + impossibility proof) | |
| Domain E: Covering codes (layer decomposition + governing condition) | |
| Domain F: Permutation groups (coset fibers + twisted translation) | |
| For each domain we demonstrate: | |
| 1. REFRAME β find the fiber map analog | |
| 2. OBSTRUCT β derive the parity/modular impossibility condition | |
| 3. GOVERN β state the minimal predicate that determines solvability | |
| 4. SCORE β build the continuous objective (bridges searchβverify) | |
| 5. SOLVE β apply SA or direct construction, verify result | |
| 6. BOUND β prove where the construction fails | |
| Run: | |
| python reformulation_engine.py # all domains | |
| python reformulation_engine.py --domain A # single domain | |
| python reformulation_engine.py --domain A B C # selected domains | |
| ### `def hr(c, n)` | |
| No description. | |
| ### `def domain_header(letter, title, tagline)` | |
| No description. | |
| ### `def phase(name, num, desc)` | |
| No description. | |
| ### `def found(msg)` | |
| No description. | |
| ### `def miss(msg)` | |
| No description. | |
| ### `def note(msg)` | |
| No description. | |
| ### `def info(msg)` | |
| No description. | |
| ### `def kv(k, v)` | |
| No description. | |
| ### `class FiberMap` | |
| Tool 1: Fiber Stratification. | |
| Given a set of objects and a function f: objects β layers, | |
| partition the objects into fibers and describe how arcs/constraints | |
| cross between fibers. | |
| #### `def FiberMap.__init__(self, objects, layer_fn, num_layers)` | |
| No description. | |
| #### `def FiberMap.fiber_size(self, s)` | |
| No description. | |
| #### `def FiberMap.report(self)` | |
| No description. | |
| ### `class ParityObstruction` | |
| Tool 2: Modular / Parity Obstruction. | |
| Given a modulus m and a requirement that k values each coprime to m | |
| sum to a target T, decide if this is possible. | |
| Returns the obstruction if impossible, or an example if possible. | |
| #### `def ParityObstruction.__init__(self, m, k, target)` | |
| No description. | |
| #### `def ParityObstruction.coprime_elements(self)` | |
| No description. | |
| #### `def ParityObstruction.analyse(self)` | |
| No description. | |
| ### `class ScoreFunction` | |
| Tool 3: Continuous score bridging search and verification. | |
| score=0 βΊ solution is valid. | |
| The score must be: (a) cheap to compute, (b) monotone toward 0. | |
| #### `def ScoreFunction.__init__(self, verify_fn, score_fn, name)` | |
| No description. | |
| #### `def ScoreFunction.__call__(self, candidate)` | |
| No description. | |
| #### `def ScoreFunction.is_valid(self, candidate)` | |
| No description. | |
| ### `class SAEngine` | |
| Tool 4: Simulated Annealing with repair mode and plateau escape. | |
| Domain-agnostic: needs perturb_fn, score_fn, init_fn. | |
| #### `def SAEngine.__init__(self, init_fn, perturb_fn, score_fn, T_init, T_min, plateau_steps)` | |
| No description. | |
| #### `def SAEngine.run(self, max_iter, seed, repair_fn, verbose, report_n)` | |
| No description. | |
| ### `def domain_A(n)` | |
| No description. | |
| ### `def domain_B()` | |
| No description. | |
| ### `def domain_C(n)` | |
| No description. | |
| ### `def domain_D()` | |
| No description. | |
| ### `def domain_E()` | |
| No description. | |
| ### `def domain_F()` | |
| No description. | |
| ### `def synthesis()` | |
| No description. | |
| ### `def main()` | |
| No description. | |
| ## research/reproduce_p1.py | |
| No description. | |
| ### `def run()` | |
| No description. | |
| ## research/santa_2025_draft.py | |
| Santa 2025: Hamiltonian Decomposition Framework (v2.2 Basin Escape) | |
| Goal: Decompose a complete graph into disjoint Hamiltonian cycles. | |
| ### `class SantaOptimizer` | |
| No description. | |
| #### `def SantaOptimizer.__init__(self, n_cities, m_cycles, seed)` | |
| No description. | |
| #### `def SantaOptimizer.score(self)` | |
| No description. | |
| #### `def SantaOptimizer.solve(self, max_iter)` | |
| No description. | |
| ## research/search_p1_deterministic.py | |
| No description. | |
| ### `def verify_k4(sigma, m)` | |
| No description. | |
| ### `def search()` | |
| No description. | |
| ## research/sovereign_solver_demo.py | |
| No description. | |
| ### `def demo()` | |
| No description. | |
| ## research/tensor_fibration.py | |
| No description. | |
| ### `class TensorFibrationMapper` | |
| TGI Tensor-Fibration Mapper. | |
| Lifts continuous neural weights/tensors into discrete topological manifolds (G_m^k). | |
| Enables analysis of neural structures through the SES framework. | |
| #### `def TensorFibrationMapper.__init__(self, m, k)` | |
| No description. | |
| #### `def TensorFibrationMapper.discretize(self, weights)` | |
| Maps continuous values to Z_m using normalized quantization. | |
| #### `def TensorFibrationMapper.tensor_to_manifold(self, weights)` | |
| Projects a flattened tensor into G_m^k coordinates. | |
| #### `def TensorFibrationMapper.calculate_topological_entropy(self, weights)` | |
| Estimates entropy based on coordinate distribution in G_m^k. | |
| #### `def TensorFibrationMapper.lift_layer(self, layer_weights)` | |
| Performs full lifting of a neural layer to the TGI framework. | |
| ## research/test_admin_vision.py | |
| No description. | |
| ## research/test_deterministic_logic.py | |
| No description. | |
| ### `def verify_construction(m)` | |
| No description. | |
| ## research/test_golden_path.py | |
| No description. | |
| ### `def verify_sigma_simple(sigma, m)` | |
| No description. | |
| ### `def construct_golden(m)` | |
| No description. | |
| ## research/test_m9_obs.py | |
| No description. | |
| ### `def check_fso(m, r)` | |
| No description. | |
| ## research/test_precise_spike.py | |
| No description. | |
| ### `def verify_sigma_simple(sigma, m)` | |
| No description. | |
| ### `def construct(m)` | |
| No description. | |
| ## research/test_spike_33.py | |
| No description. | |
| ### `def test()` | |
| No description. | |
| ## research/test_vision_agent.py | |
| No description. | |
| ## research/tgi_agent.py | |
| No description. | |
| ### `class TGIAgent` | |
| The High-Level Topological General Intelligence (TGI) Agent. | |
| #### `def TGIAgent.__init__(self)` | |
| No description. | |
| #### `def TGIAgent.query(self, data, hierarchical, admin_vision)` | |
| Processes a query through the full TGI pipeline. | |
| #### `def TGIAgent.ingest_knowledge(self, category, name, payload)` | |
| No description. | |
| #### `def TGIAgent.forge_relation(self, name_a, name_b, relation_type)` | |
| No description. | |
| #### `def TGIAgent.ontology_summary(self)` | |
| Provides a summary of the Universal Ontology Mapper state. | |
| #### `def TGIAgent.autonomous_query(self, intent)` | |
| Performs a multi-step autonomous topological plan generation. | |
| #### `def TGIAgent.cross_reason(self, data_list)` | |
| Decomposes multiple queries and merges results for comparative reasoning. | |
| ## research/tgi_autonomy.py | |
| No description. | |
| ### `class SubgroupDiscovery` | |
| Phase 4: Topological Autonomy. | |
| Automatically discovers normal subgroups H and quotients Q for a given G. | |
| This enables recursive manifold decomposition. | |
| #### `def SubgroupDiscovery.__init__(self, m, k)` | |
| No description. | |
| #### `def SubgroupDiscovery.find_quotients(self)` | |
| Identifies possible solvable quotients based on divisibility. | |
| #### `def SubgroupDiscovery.decompose_recursive(self)` | |
| Generates a recursive decomposition path for the manifold. | |
| ### `class DynamicKLift` | |
| Phase 4: Topological Autonomy. | |
| Automatically lifts the manifold dimension (k) to resolve H2 parity obstructions. | |
| #### `def DynamicKLift.__init__(self, m, k)` | |
| No description. | |
| #### `def DynamicKLift.suggest_lift(self)` | |
| If (m even, k odd), suggests k+1 to resolve the parity obstruction. | |
| #### `def DynamicKLift.get_lift_reflection(self)` | |
| No description. | |
| ## research/tgi_core.py | |
| No description. | |
| ### `class TGICore` | |
| The heartbeat of Topological General Intelligence (TGI). Governing by the FSO Codex Laws I-XII. | |
| #### `def TGICore.__init__(self, m, k)` | |
| No description. | |
| #### `def TGICore.set_topology(self, m, k)` | |
| Changes the current topological domain without wiping persistent engines. | |
| #### `def TGICore.reflect(self)` | |
| Topological Reflection: Explains the current state manifold via FSO Laws. | |
| #### `def TGICore.solve_math(self, latex)` | |
| Symbolic-Topological solver governed by Law XI. | |
| #### `def TGICore.reason_on(self, data, solve_manifold)` | |
| Routes and reasons over arbitrary data using the TGI-Parser and FSO Laws. | |
| #### `def TGICore.reasoning_path(self)` | |
| No description. | |
| #### `def TGICore.solve_manifold(self, max_iter, target_core, payload)` | |
| Finds the global structure (Hamiltonian decomposition) with Sovereign optimization. | |
| #### `def TGICore.lift_path(self, sequence, color)` | |
| No description. | |
| #### `def TGICore.hierarchical_lift(self, orders, states)` | |
| Formal tower lifting through multiple manifold layers (Law III). | |
| #### `def TGICore.measure_intelligence(self)` | |
| No description. | |
| ## research/tgi_engine.py | |
| No description. | |
| ### `class TopologicalProjection` | |
| TGI Topological Projection Layer. | |
| Maps raw data into Z_m^k using symmetry-preserving circular embeddings. | |
| Logic: Similar meaning -> Similar Parity -> Identical Geometric Fiber. | |
| #### `def TopologicalProjection.__init__(self, m, k)` | |
| No description. | |
| #### `def TopologicalProjection.project(self, raw_data)` | |
| Maps data to a coordinate in the Torus. | |
| ### `class BouncerGate` | |
| TGI Bouncer Gate (Strict Parity Validation). | |
| Enforces Law I (Dimensional Parity Harmony) at O(1). | |
| Drops "Garbage" (H2 Parity Obstructions) without processing. | |
| #### `def BouncerGate.__init__(self, m, k, target_sum)` | |
| No description. | |
| #### `def BouncerGate.validate(self, coord)` | |
| Law I: (Even m -> Even k). Checks if sum satisfies target parity S. | |
| ### `class FiberImputation` | |
| TGI Self-Healing Layer. | |
| Uses the Closure Lemma (Law III) to solve for missing dimensions. | |
| #### `def FiberImputation.__init__(self, m, target_sum)` | |
| No description. | |
| #### `def FiberImputation.impute_missing(self, partial_coord, k)` | |
| Calculates r_k to close the Hamiltonian loop. | |
| ### `class TGIEngine` | |
| The Moaziz System Execution Layer (Upgraded). | |
| Zero-Preprocessing Ingestion via Geometric Invariant Mapping. | |
| #### `def TGIEngine.__init__(self, m, k, target_sum)` | |
| No description. | |
| #### `def TGIEngine.ingest_transaction(self, tx)` | |
| Ingests a BaridiMob/CIB transaction with zero preprocessing. | |
| ## research/tgi_integration_test.py | |
| No description. | |
| ### `def run_integration_test()` | |
| No description. | |
| ## research/tgi_parser.py | |
| No description. | |
| ### `class TGIParser` | |
| The TGI-Parser: Maps datasets, languages, and math to topological parameters (m, k). | |
| #### `def TGIParser.__init__(self)` | |
| No description. | |
| #### `def TGIParser.parse_input(self, data)` | |
| Detects content type and routes to the correct TGI core. | |
| #### `def TGIParser._route(self, domain, raw_data)` | |
| No description. | |
| ## research/tgi_parser_test.py | |
| No description. | |
| ### `def test_parser_routing()` | |
| No description. | |
| ## research/tgi_system_demo.py | |
| No description. | |
| ### `def hr()` | |
| No description. | |
| ### `def run_demo()` | |
| No description. | |
| ## research/tlm.py | |
| No description. | |
| ### `class TopologicalLanguageModel` | |
| The Topological Language Model (TLM) with Path Lifting and Coordinate Mapping. | |
| #### `def TopologicalLanguageModel.__init__(self, m, k)` | |
| No description. | |
| #### `def TopologicalLanguageModel.tokenize(self, text)` | |
| Maps arbitrary text tokens to Z_m coordinates via hashing. | |
| #### `def TopologicalLanguageModel._ensure_sigma(self)` | |
| No description. | |
| #### `def TopologicalLanguageModel.generate(self, seed_text, length)` | |
| Generates completion using Hamiltonian path lifting. | |
| #### `def TopologicalLanguageModel.generate_path(self, seed_text, length)` | |
| Lifts a seed into a Hamiltonian path of coordinates. | |
| #### `def TopologicalLanguageModel.generate_ontology_grounded(self, seed_text, length)` | |
| Uses the LANGUAGE fiber in the Ontology to ground generation. | |
| ## research/topological_vision.py | |
| No description. | |
| ### `class TopologicalVisionMapper` | |
| TGI Vision Mapper (v2.0). | |
| Lifts pixel data (x, y, color) into discrete topological manifolds (G_m^k). | |
| Enables cohomological gradient analysis and signature extraction. | |
| #### `def TopologicalVisionMapper.__init__(self, m, k)` | |
| No description. | |
| #### `def TopologicalVisionMapper.load_image(self, path, resize)` | |
| Loads and prepares an image for topological mapping. | |
| #### `def TopologicalVisionMapper.image_to_manifold(self, img_array)` | |
| Maps image pixels to G_m^k coordinates. | |
| #### `def TopologicalVisionMapper.calculate_spatial_entropy(self, img_array)` | |
| Measures color distribution complexity across the spatial manifold. | |
| #### `def TopologicalVisionMapper.calculate_cohomological_gradient(self, img_array)` | |
| Calculates the local cohomological gradient (boundary detection). | |
| Measures the degree of non-uniformity in local fiber transitions. | |
| #### `def TopologicalVisionMapper.extract_topological_signature(self, img_array)` | |
| Generates a unique algebraic signature for the image manifold. | |
| #### `def TopologicalVisionMapper.lift_image(self, data)` | |
| Performs full vision lifting to the TGI framework. | |
| ## research/tsp_benchmark.py | |
| No description. | |
| ### `def run_tsp_benchmark()` | |
| No description. | |
| ## research/tsp_evaluator.py | |
| No description. | |
| ### `def is_valid_tour(tour, n)` | |
| No description. | |
| ### `def calculate_tour_length(tour, dist_matrix)` | |
| No description. | |
| ### `class TSPInstance` | |
| No description. | |
| #### `def TSPInstance.__init__(self, name, coords)` | |
| No description. | |
| ### `def load_data(csv_path)` | |
| No description. | |
| ### `def run_evaluation(instance, solver_fn, n_runs, max_iter)` | |
| No description. | |
| ### `def print_result_table(results)` | |
| No description. | |
| ## research/tsp_standard_bench.py | |
| No description. | |
| ### `def parse_tsp(file_path)` | |
| No description. | |
| ### `def solve_nn(coords)` | |
| No description. | |
| ### `def solve_2opt(coords, max_iter, seed)` | |
| No description. | |
| ### `def run()` | |
| No description. | |
| ## research/verify_deterministic_spike.py | |
| No description. | |
| ### `def test_odd_m()` | |
| No description. | |
| ## research/verify_p1_sol.py | |
| No description. | |
| ### `def verify()` | |
| No description. | |
| ## research/verify_sovereign_solver.py | |
| No description. | |
| ### `def test_sovereign_solver()` | |
| No description. | |
| ## research/weighted_moduli_pipeline_v2.py | |
| ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| β WEIGHTED MODULI PIPELINE v2.0 β | |
| β Classifying Space β 8 Closed-Form Weights β Proved Solutions β | |
| β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ£ | |
| β β | |
| β WHAT CHANGED FROM v1.0 β | |
| β βββββββββββββββββββββ β | |
| β v1.0 W4 was O(m^m) β 251ms for m=7. v2.0 W4 = phi(m), O(m). 0.06ms. β | |
| β v1.0 Had 5 weights, approximated. v2.0 Has 8 weights, exact. β | |
| β v1.0 Only G_m domains. v2.0 Accepts any symmetric system. β | |
| β v1.0 Solvers S2/S3 missing. v2.0 All 5 strategies implemented. β | |
| β v1.0 No prediction vs actual. v2.0 Benchmarks weight prediction. β | |
| β v1.0 No cross-domain. v2.0 Latin, Hamming, diff-sets. β | |
| β β | |
| β THE 8 WEIGHTS (all closed-form, all O(mΒ²) or faster) β | |
| β W1 HΒ² obstruction β proved-impossible in O(1). GATE. β | |
| β W2 r-tuple count β how many construction seeds exist β | |
| β W3 canonical seed β the direct construction path β | |
| β W4 HΒΉ order EXACT β phi(m), not approximation. Gauge multiplicity. β | |
| β W5 search exponent β logβ(compressed space). Picks solver. β | |
| β W6 compression ratio β W5/W5_full. How much weight saves. β | |
| β W7 solution estimate β predicted |M_k(G_m)| before any search β | |
| β W8 gauge orbit size β m^{m-1}. Solutions per equivalence class. β | |
| β β | |
| β INTELLIGENCE LAYERS β | |
| β L1 Weight gate W1 β instant proof of impossibility O(1) β | |
| β L2 Construction W3 β column-uniform search with known seed O(fast) β | |
| β L3 Prediction W7 β predict |solutions| before searching β | |
| β L4 Fiber SA W5 β structured SA in compressed space O(less) β | |
| β L5 Verification W4 β know exact multiplicity, stop early β | |
| β β | |
| β DOMAIN PROTOCOL (plug in any symmetric system) β | |
| β Register domain with: name, group_order, k, m, tags β | |
| β Pipeline auto-extracts weights, selects strategy, returns proof. β | |
| β β | |
| β COMMANDS β | |
| β python weighted_moduli_pipeline.py # full demo β | |
| β python weighted_moduli_pipeline.py --weights # 8-weight table β | |
| β python weighted_moduli_pipeline.py --space # classifying space β | |
| β python weighted_moduli_pipeline.py --batch # solve m=3..10, k=2..6 β | |
| β python weighted_moduli_pipeline.py --benchmark # v1 vs v2 speedup β | |
| β python weighted_moduli_pipeline.py --prove 4 3 # prove m=4 k=3 β | |
| β python weighted_moduli_pipeline.py --solve 7 3 # solve m=7 k=3 β | |
| β python weighted_moduli_pipeline.py --domains # all registered domains β | |
| ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| ### `def hr(c, n)` | |
| No description. | |
| ### `def tick(v)` | |
| No description. | |
| ### `class Weights` | |
| 8 compressed invariants. Everything downstream is determined by these. | |
| #### `def Weights.strategy(self)` | |
| No description. | |
| #### `def Weights.solvable(self)` | |
| No description. | |
| #### `def Weights.show(self)` | |
| No description. | |
| ### `class WeightExtractor` | |
| Exact 8-weight extraction. Total cost: O(mΒ² + |cp|^k). | |
| Cached: each (m,k) computed once. | |
| Speedup vs v1.0: | |
| W4: O(m^m) β O(m) (formula: phi(m), not enumeration) | |
| W5: O(m^m) β O(1) (precomputed level_counts table) | |
| Total: microseconds for any m β€ 30 | |
| #### `def WeightExtractor.extract(self, m, k)` | |
| No description. | |
| #### `def WeightExtractor.batch(self, ms, ks)` | |
| No description. | |
| ### `def _level_ok(lv, m)` | |
| No description. | |
| ### `def _valid_levels(m)` | |
| No description. | |
| ### `def _q(table, m)` | |
| No description. | |
| ### `def _qs(Q, m)` | |
| No description. | |
| ### `def _verify(sigma, m)` | |
| No description. | |
| ### `def _tab_to_sigma(tab, m)` | |
| No description. | |
| ### `def _solve_S1(m, seed, max_att)` | |
| No description. | |
| ### `def _solve_S2(m, k, seed, max_iter)` | |
| Fiber-structured SA: Ο(v) = f(fiber(v), j(v), k(v)). | |
| ### `def _prove_S4(w)` | |
| No description. | |
| ### `class ProofBuilder` | |
| No description. | |
| #### `def ProofBuilder.build(self, w, sol)` | |
| No description. | |
| ### `class Domain` | |
| No description. | |
| ### `def register(d)` | |
| No description. | |
| ### `class PResult` | |
| No description. | |
| #### `def PResult.status(self)` | |
| No description. | |
| #### `def PResult.one_line(self)` | |
| No description. | |
| ### `class Pipeline` | |
| No description. | |
| #### `def Pipeline.__init__(self)` | |
| No description. | |
| #### `def Pipeline.run(self, m, k, domain_name, verbose)` | |
| No description. | |
| #### `def Pipeline.run_domain(self, name, verbose)` | |
| No description. | |
| #### `def Pipeline.batch(self, ms, ks, verbose)` | |
| No description. | |
| #### `def Pipeline.stats_line(self)` | |
| No description. | |
| ### `class ClassifyingSpace` | |
| The complete space of (m,k) problems, compressed into weight vectors. | |
| Topology: open sets = feasible; closed = obstructed. | |
| Metric: compression ratio W6 (how much the weights save vs naive search). | |
| #### `def ClassifyingSpace.__init__(self, m_max, k_max)` | |
| No description. | |
| #### `def ClassifyingSpace.obstruction_grid(self)` | |
| No description. | |
| #### `def ClassifyingSpace.compression_grid(self)` | |
| No description. | |
| #### `def ClassifyingSpace.summary(self)` | |
| No description. | |
| #### `def ClassifyingSpace.richest(self, n)` | |
| No description. | |
| #### `def ClassifyingSpace.most_compressed(self, n)` | |
| No description. | |
| ### `def benchmark_vs_v1()` | |
| No description. | |
| ### `def main()` | |
| No description. | |
| ### `class NonAbelianHilbertBridge` | |
| Implementation: `research/non_abelian_bridge.py` | |
| Bridges discrete non-commutative groups with continuous infinite-dimensional Hilbert spaces. | |
| #### `def NonAbelianHilbertBridge.__init__(self, m, dimension)` | |
| - `m`: The modulus of the base Heisenberg group. | |
| - `dimension`: The dimensionality of the Hilbert space approximation. | |
| #### `def calculate_holonomy(self, path)` | |
| Calculates the geometric phase shift for a closed loop in the manifold. | |
| #### `def analyze_frontier_intent(self, intent)` | |
| Performs spectral analysis and resonance energy calculation for a natural language intent. | |