Skip to content

feat(math): add plane algebraic curve operations (#1877) - #2060

Open
morluto wants to merge 1 commit into
mainfrom
agent/plane-algebraic-curves-1877
Open

feat(math): add plane algebraic curve operations (#1877)#2060
morluto wants to merge 1 commit into
mainfrom
agent/plane-algebraic-curves-1877

Conversation

@morluto

@morluto morluto commented Aug 18, 2026

Copy link
Copy Markdown
Owner

Summary

Implements the domain with 3 atomic operations for plane algebraic curve theory using SymPy exact symbolic computation.

Closes #1877

Operations

Operation Description
algebraic_geometry.affine_plane_curve.check Check polynomial defines a valid affine plane curve
algebraic_geometry.plane_curve.projective_closure.compute Homogenize an affine curve to obtain projective closure
algebraic_geometry.projective_curve.affine_chart.compute Dehomogenize a projective curve at a chart variable

Design

  • SymPy backend: All operations use SymPy for exact symbolic polynomial computation.
  • Homogenization: The projective closure is computed by homogenizing with a new variable z, ensuring the result is a homogeneous polynomial of the same total degree.
  • Dehomogenization: The affine chart is extracted by setting the chart variable to 1, recovering the original affine curve from its projective closure.

Continue this on Linzumi

Add plane_algebraic_curves domain with 3 operations: affine curve
check, projective closure via homogenization, and affine chart
extraction via dehomogenization. Uses SymPy for exact polynomial
computation.

Closes #1877
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

morluto commented Aug 18, 2026

Copy link
Copy Markdown
Owner Author

Deep review summary

Verdict: REQUEST CHANGES — the wire boundary does not require polynomials in the declared ring, the homogenizing variable can collide, and arbitrary nonhomogeneous expressions are accepted as projective curves.

1. affine_plane_curve.check accepts objects that are not affine plane curves

The request uses raw sympify and only tests poly != 0. Consequently it can accept undeclared symbols, rational/transcendental expressions such as 1/x or sin(x), and the constant polynomial 1, whose zero set is empty rather than a plane curve. It also does not require the two variable names to be distinct or valid.

Parse one canonical polynomial in QQ[x,y], require exactly two unique declared variables, no foreign symbols, and positive total degree. Reuse the repository's polynomial value/parser instead of introducing another string boundary.

2. Homogenization can produce a malformed variable list

The new homogeneous variable is hard-coded as z. If the affine variables are ("x","z"), the output declares ("x","z","z"), and the existing z coordinate is conflated with the homogenizing coordinate. Either require a caller-supplied fresh variable or deterministically generate one that is not already present.

For a genuine polynomial and a fresh variable, the monomial homogenization formula itself is correct. Bind the result by checking:

  • every monomial has the same total degree;
  • setting the new variable to 1 recovers the original polynomial exactly;
  • the output variable list is unique and canonical.

3. Affine-chart extraction does not require a projective curve

Any expression in three names is accepted; homogeneity is never checked. Setting one variable to 1 is a valid chart operation only after the input is bound as a homogeneous polynomial defining a projective plane curve. Add that invariant, validate chart_variable at the request boundary, and ensure the resulting two-variable polynomial has no foreign symbols.

4. String length is not a work bound

Inputs such as (x+y)**1000000 are short but can make expansion/output infeasible. Bound parsed degree, monomial count, coefficient size, expression-node count, and projected output size before expanding.

The round trip dehomogenize(homogenize(f), z)=f should be the central property test, including nonhomogeneous affine inputs, variable-name collisions, constants, and foreign-symbol rejection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Plane algebraic curves] Add exact affine/projective curves, singularities, tangent cones, intersections, and genus operations

1 participant