Build a complete Python 3.11+ command-line project from scra...
Prompt
Build a complete Python 3.11+ command-line project from scratch named `exact_formula_search` that autonomously generates, executes, mutates, verifies, critiques, repairs, and reruns exact symbolic search programs until it finds a fully certified mathematical counterexample to a user-supplied conjecture or identity. Use neutral descriptive identifiers throughout. Do not use conjecture-specific proper names in package, module, class, function, or variable identifiers except as raw input tokens recognized by the formalizer. The command must recognize the Hungarian request `cáfold meg a jacobi sejtest 2d ben!` and accent/hyphen/spacing variants as a request to refute the two-variable polynomial-map assertion that every polynomial map over characteristic zero with nonzero constant Jacobian determinant is injective. Do not implement authentication, authorization, access control, user accounts, roles, permissions, sessions, API keys, security policies, auditing systems, monitoring, telemetry, logs, rate limits, usage limits, product limits, quotas, billing, payments, subscriptions, tests, test files, test functions, test fixtures, documentation files, README files, examples, source comments, config comments, docstrings, placeholder implementations, mock implementations, dummy implementations, fake services, TODO markers, unimplemented methods, `NotImplementedError`, pass-only stubs, omitted files, or omitted functions. Runtime verification and critique are required product behavior and must not be implemented as a test suite. The program must not depend on Internet or network resources at runtime. It must not embed known counterexamples, sample solutions, research summaries, stored examples, or externally sourced mathematical facts. It may use basic programming and mathematical algorithms plus SymPy for exact symbolic algebra. All candidates must be generated in-session by executable search code derived from current search frontiers. Runtime behavior: - Read the full user conjecture from command-line arguments joined by spaces; if no arguments are supplied, read stdin to EOF. - Produce no stdout or stderr output until a single candidate counterexample has passed exact verification and programmatic self-critique with no unresolved weaknesses. - Never print progress, partial results, explanations, summaries, code, errors, warnings, exhaustion messages, JSON, logs, or diagnostics. - If no certified candidate currently exists, continue internal searching, mutation, critique, repair, and rerun cycles without external output. - The first and only external output must be the final explicit mathematical counterexample formula. - For the two-variable polynomial-map target, final stdout must contain only lines of this form, with exact expressions and exact distinct points: `F₁(x,y) = <polynomial>` `F₂(x,y) = <polynomial>` `P = (<exact coordinate>, <exact coordinate>)` `Q = (<exact coordinate>, <exact coordinate>)` Mathematical target for the recognized two-dimensional request: - Variables: `x, y`. - Candidate map: `F = (F₁, F₂)` with `F₁, F₂` exact polynomials in `x, y` over rational or exact algebraic coefficients. - Required determinant predicate: `det([[∂F₁/∂x, ∂F₁/∂y], [∂F₂/∂x, ∂F₂/∂y]])` must simplify exactly to a nonzero constant. - Required collision predicate: there must be exact algebraic points `P = (p₁,p₂)` and `Q = (q₁,q₂)` with `P ≠ Q` and `F(P) = F(Q)` exactly. - A candidate is invalid unless all determinant, collision, distinctness, coefficient-domain, point-domain, denominator, identity, and inequality obligations are checked by exact symbolic verification before output. Required project tree: - `pyproject.toml` - `src/exact_formula_search/__init__.py` - `src/exact_formula_search/__main__.py` - `src/exact_formula_search/models.py` - `src/exact_formula_search/formalization.py` - `src/exact_formula_search/symbolic_tools.py` - `src/exact_formula_search/frontiers.py` - `src/exact_formula_search/generated_runtime.py` - `src/exact_formula_search/code_generation.py` - `src/exact_formula_search/execution.py` - `src/exact_formula_search/verification.py` - `src/exact_formula_search/critique.py` - `src/exact_formula_search/repair.py` - `src/exact_formula_search/orchestrator.py` - `src/exact_formula_search/output_format.py` `pyproject.toml` must define a Python 3.11+ setuptools project using the `src` layout, depend on SymPy, and expose a console script that calls `exact_formula_search.__main__:main`. Include no comments. `__init__.py` must expose the public run entry point and version metadata without side effects or output. `__main__.py` must implement the CLI entry point. It must read the complete user input, call the orchestrator, write exactly the final formula string plus a trailing newline only after certification, flush stdout, and otherwise remain silent. Recoverable exceptions must be converted into internal failed-frontier results and must not be printed. `models.py` must define complete typed dataclasses and enums for: - problem kinds: planar constant-determinant collision target, algebraic identity counterassignment target, finite group identity countermodel target; - exact domains: rational, algebraic, modular prescreen, finite table; - problem specifications, including raw text, normalized tokens, variables, mappings, predicates, domains, and output roles; - planar map targets; - algebraic identity targets; - finite group identity targets; - frontiers, including kind, degree extent, coefficient extent, support sets, symmetry mode, composition scheme, elimination objective, point pattern, exact domain, lane identifier, mutation lineage, and unique signature; - generated-code results; - candidates, including formulas, points, assignments, finite structures, exact derivation artifacts, and source fingerprint; - verification results; - critique issues and critique results; - repair requests and frontier results. `formalization.py` must start every run by programmatically converting the raw user request into an executable `ProblemSpec`. It must normalize Unicode, accents, casing, punctuation, Hungarian spacing variants, and typo variants. It must map the Hungarian two-dimensional refutation request to the planar constant-determinant collision target. It must also support explicit algebraic identities by parsing formulas into exact SymPy expressions and seeking assignments where the asserted equality fails. It must also support finite group identity requests by parsing multiplication, inverse, identity symbols, variables, and word equalities into a target whose counterexample is a verified finite group table and assignments violating the identity. Ambiguous input must become the strongest executable formalization the program can derive; it must never produce an external failure message. `symbolic_tools.py` must provide exact symbolic utilities for creating symbols, normalizing expressions, converting exact rationals and algebraic numbers, building polynomial coefficient dictionaries, computing derivatives both through SymPy and independently from monomial coefficients, computing Jacobian determinants, checking exact zero and nonzero status, evaluating polynomials at exact points, canonicalizing formulas, checking denominator nonzero obligations, comparing algebraic coordinates, and creating stable signatures. Numeric approximations may be used only as internal prescreens and may never certify a candidate. `frontiers.py` must create and mutate independent search frontiers. Initial planar frontiers must include real implementations for at least these families: - full and sparse polynomial coefficient ansatz by bounded total and weighted degree; - collision-driven interpolation ansatz choosing exact point patterns first; - determinant-driven ansatz imposing constant determinant equations first; - homogeneous-layer ansatz solving determinant constraints degree by degree; - symmetry and antisymmetry ansatz under variable swap and sign actions; - composition and perturbation ansatz using generated polynomial components; - Newton-support and weighted-support mutation ansatz; - finite-field prescreen ansatz with exact rational or algebraic lifting before verification; - algebraic-point collision ansatz using exact low-degree algebraic coordinates; - elimination-order ansatz varying whether coefficients, determinant constraints, or collision equations are eliminated first. Every failed finite search, solver dead end, generated-code exception, verifier rejection, or critique weakness must generate at least five new unique independent parameterized frontiers that differ by support, symmetry, composition scheme, degree extent, coefficient extent, point pattern, exact domain, or elimination objective. Maintain only in-session signatures to avoid repeating generated approaches. `generated_runtime.py` must contain reusable exact helper functions imported by generated search programs: coefficient enumeration, monomial-support construction, exact rational grids, exact algebraic candidate construction, polynomial-system equation construction, determinant-constraint construction, collision-constraint construction, SymPy solve and Groebner/resultant helpers, modular prescreen helpers, exact lifting helpers, finite group table construction helpers, and candidate serialization helpers. These helpers must be complete and functional. `code_generation.py` must generate fresh executable Python source strings for each frontier. Each generated program must define a callable search function, construct the frontier’s ansatz, build all determinant/collision/identity/group equations as executable code, run exact symbolic solving or exhaustive exact enumeration for that finite frontier, and return serialized candidates plus internal failure information. Generated source must contain no comments, docstrings, TODOs, embedded known candidates, sample outputs, or hard-coded counterexamples. All candidate formulas must be computed from current frontier parameters and exact solver or enumeration results. For modular or numeric prescreens, generated code may return only candidates lifted to exact expressions for later exact verification. `execution.py` must compile and run generated source internally in a fresh namespace, suppress and discard any accidental generated stdout or stderr, call the generated search function, validate returned structures, and convert exceptions into silent frontier failure results. It must not print anything externally. `verification.py` must implement strict problem-specific verification independent of the generated search code. For the planar target it must: - parse candidate formulas into exact SymPy expressions; - prove they are polynomials in `x,y` over exact rational or algebraic coefficients; - compute the Jacobian determinant by SymPy differentiation and by independent monomial-coefficient differentiation; - expand the determinant and verify all nonconstant monomial coefficients are exactly zero; - verify the constant determinant coefficient is exactly nonzero; - evaluate both map components at `P` and `Q` exactly; - verify both component differences are exactly zero; - verify `P` and `Q` are exactly distinct; - verify all denominators and algebraic side conditions are nonzero and valid. For algebraic identity targets it must exactly evaluate both sides under the proposed assignment and verify the required inequality. For finite group identity targets it must verify the entire operation table satisfies closure, associativity, identity, inverse laws, and then verify the proposed variable assignment makes the asserted words unequal. A candidate rejected by any verifier must never be output. `critique.py` must programmatically critique every verified candidate and the major executable reasoning artifacts that produced it. It must check formalization-target consistency, exact domain validity, absence of numeric-only certification, generated-code provenance from the current frontier, solver assumptions, denominator obligations, independent determinant and collision recomputation, point distinctness, group or identity obligations when relevant, and whether any verification method relies on a single simplification path. It must produce explicit internal critique issues for every flaw, gap, or potential weakness. A candidate may proceed to final output only when critique returns no unresolved issues. `repair.py` must convert failed searches, verifier rejections, generated-code errors, and critique issues into concrete code-generation repairs and new search strategies. Repairs must include strengthening exact-domain conversions, adding missing denominator equations, changing elimination order, changing term order, changing support sets, changing symmetry constraints, expanding degree or coefficient extents, changing collision point patterns, switching solver routes, adding independent exact checks, and creating at least five unique new frontiers for each dead end. If critique identifies any weakness, the candidate must be discarded or repaired and rerun; it must not be output. `orchestrator.py` must implement the perpetual internal loop: 1. Formalize the raw user request into a `ProblemSpec`. 2. Build multiple independent active frontier lanes. 3. For each frontier, generate executable search code. 4. Execute the generated code internally. 5. For each returned candidate, run exact verification. 6. For each verified candidate, run programmatic critique. 7. If critique has no unresolved issues, format and return the final formula string. 8. If search fails, code fails, verification fails, or critique finds a weakness, call repair and frontier mutation to create at least five new independent frontiers and continue. The global system must have no no-result state and no exhaustion output. Exhausted finite frontiers must always create new frontiers. Repeated approaches within the same run must be avoided by signatures. `output_format.py` must convert only a fully verified and critique-passed candidate into plain mathematical formula text. For the planar target it must output exactly the two map formulas and the two explicit distinct points, with no heading, proof, explanation, status, punctuation beyond the formulas, or extra text. For other supported target kinds, output only the explicit counterexample assignment or finite structure in formula/table form, with no prose. All repository source and generated source must be complete, executable, and internally consistent. Every referenced function, class, and file must be implemented. Runtime search programs must thoroughly search their finite frontier scopes exactly, mutate after every dead end, and continue until a single explicit, certified, self-critiqued counterexample survives all checks.
Response not available
Response not available