Repository navigation
Speculative Function Properties
Speculative. A proposal, not adopted.
The Ideas page lists the Function* property family (FunctionDomain, FunctionRange, FunctionInjective, FunctionMonotonicity, FunctionSingularities and the rest) as "the largest coherent block on the Wolfram frontier" that belongs upstream. Reading the tree, the block is mostly not on the frontier: thirteen of the heads already answer here, in @notatio/analytic, for a small closed set of single-variable shapes. The frontier data lists only two family members, FunctionBijective and FunctionPoles. What is left to design is how the existing heads grow from a shape classifier into a structural analysis, two missing heads, a repair of three soundness gaps in what exists, and where the code lives so compute-engine can take it.
"Measured" means I read it in the tree at origin/main (bfa63e225) or counted it from a file there, or read it in compute-engine at tag v0.187.1 (the pin is 0.187.0 || 0.187.1, pnpm-workspace.yaml:41), and the path:line is given. Compute-engine paths are ce@v0.187.1:path. The clone at ~/Playground/@enumeratio/compute-engine has 8c3b9f519 (2026-10-06) checked out, which is older than the pin and has a dirty tree, so I read the tag through git archive. I also grepped origin/main there (e5c3026fe, 2026-11-15, package version 0.192.0). "Assumed" means reasoned or recalled, not read or counted. Nothing was run: there is no node_modules, so every statement about what an expression evaluates to is read from code or from a committed example row, and the claims about unsoundness in §3.0 are from reading.
Do not open this as a new upstream block. Do it in this order:
- Slice 0, repair what exists (§3.0): three answers the current code gives that are wrong or inexact. Cheap, and they bound what "sound" has to mean for the rest.
-
Slice 1, one condition kernel and
FunctionDomain(§3.1): replace the shape classifier with a walk over the expression that returns a set of reals with exact endpoints. Every other head reads this set. - Slice 2, singularities, discontinuities, poles, continuity, analyticity (§3.2), slice 3, range, sign, monotonicity, convexity, injectivity, surjectivity, bijectivity (§3.3), and slice 4, period (§3.4). Slices 2 and 3 are independent of each other once slice 1 lands.
Write the kernel as patches in packages/ce-patches/ (one per slice), shaped as the compute-engine files they would become, and make @notatio/analytic stop declaring a head once its patch declares it. Open one design issue upstream before any pull request (answer 3 in the open questions): compute-engine has no inequality solver and has ruled real quantifier elimination out of plan, so the condition kernel is a design call for its maintainer, not a drop-in head.
-
Thirteen heads, one classifier.
FunctionDomain,FunctionRange,FunctionMonotonicity,FunctionConvexity,FunctionSign,FunctionInjective,FunctionSurjective,FunctionSingularities,FunctionDiscontinuities,FunctionAnalytic,FunctionMeromorphic,FunctionPeriod,FunctionContinuousare declared inpackages/symbols/analysis/analytic/src/function-properties.ts:946-1026, each lazy, each declining (leaving the call unevaluated) whenrecognizereturnsundefined. -
The classifier is a closed vocabulary, not a recursion.
recognize(function-properties.ts:193-248) accepts a polynomial, a rational function,Sqrtof a degree 1 or 2 polynomial,Ln/Log/Exp/Sin/Cos/Tanof an affine argument, in one variable. It does not compose:Log(Tan(x) - 1),Gamma(1 - x^2),Sqrt(x^2) - xall decline.signShapehandles degree 0 to 2 and a bare monomial (:276-306);x/(x^4 - 1)declines. -
A second path for special functions.
FunctionRangeofAiryAi,AiryBiandBesselYgoes through derivative zeros and a conserved-energy tail bound (function-range.ts:1-15). It is the repo's one precedent for a range proved by a certificate rather than a closed form. -
Records.
packages/symbols/analysis/analytic/reference/Function*/hold the examples, each with a Wolfram column (examples.values.wolfram.tsv) cross-checked by hand against Wolfram 15.0.0 (sourcecolumn). The reference pages state what each head declines (FunctionDomain/index.md,FunctionMonotonicity/index.md,FunctionPeriod/index.md). -
Where the heads live. The records say
library: "@notatio/analytic", notce-patches.AGENTS.md("Upstream candidates") puts a head compute-engine would plausibly take inpackages/ce-patches/from the start; these were not written that way.packages/ce-patches/src/patches/holds noFunction*patch. -
Wolfram surface.
to-wolfram.ts:338-348restructuresFunctionContinuous(f, x, domain)into Wolfram'sFunctionContinuous[{f, domain}, x]. No otherFunction*head has a restructuring. -
Oracle comparison by equivalence.
packages/oracle/src/symbolic.ts:470-493compares relational answers as statements (Equivalent, thenResolveoverRealsunder a 20 s cap, elseIndeterminate), not by spelling.packages/oracle/tests/symbolic.test.ts:349-358pins it forFunctionRange. - The idea as it stood on Ideas was stale. It listed the family as missing and mentioned none of this.
packages/census/src/wolfram-frontier-data.ts was generated from Wolfram's documentation examples for the 795 symbols the head map claims, 52,424 examples in all (:3-4). FRONTIER (:20) lists heads those examples call that we do not answer, with uses. CALL_FORMS (:2270) lists, for symbols we do map, up to FORM_LIMIT = 10 distinct example calls (packages/census/scripts/collect-wolfram-frontier.ts:155,165).
So the counts mean two different things:
-
FunctionBijective: 6 uses (:1156-1157).FunctionPoles: 3 uses (:2028-2029). These are the only twoFunction*family heads inFRONTIER. No example text is kept for either, only the count, so their Wolfram signatures are assumed by analogy (FunctionPoles[f, x]returning a condition,FunctionBijective[f, x]a boolean). - The other thirteen are in
CALL_FORMS(:4277-4440) because we map them. Each shows 10 calls exceptFunctionSingularitiesandFunctionDiscontinuities, which show 9, so those two are the complete set of distinct documentation calls and the rest have at least 10. There is no frequency ranking for them in the data; ranking needs the collector rerun without the cap. -
FunctionInterpolationis documented (packages/reference/src/wolfram-documented-data.ts:2644) and named (system-names.ts:2967) but appears in neither list: zero uses in the examples of mapped symbols. I leave it out; from its name it is not a property (assumed, unread).
Call forms in the 128 shown calls (counted by a regex over the printed strings; indicative, not exact):
| Form | Example from the data | Of 128 |
|---|---|---|
| plain, one variable, reals | FunctionDomain[x/(x^2 - 1), x] |
50 |
| domain argument |
FunctionPeriod[Sin[x], x, Reals], FunctionInjective[E^x, x, Complexes]
|
most of the rest, mainly Complexes and Integers
|
restriction {f, cond}
|
FunctionMonotonicity[{Log[x], x > 0}, x] |
about 30 |
| several variables | FunctionSingularities[Beta[x, y], {x, y}] |
about 20 |
| options | FunctionConvexity[Abs[x], x, StrictInequalities -> True] |
at least 1 |
Head by head. "Returns" is what Wolfram answers in the examples that carry a Wolfram column (reference/Function*/examples.values.wolfram.tsv); "here" is the state at bfa63e225.
| Head | Wolfram call and return (from the data) | Here |
|---|---|---|
FunctionDomain |
f, x[, dom] → condition in x. FunctionDomain[1/x, x] is x < 0 || x > 0; Tan[x] is NotElement[1/2 + x/Pi, Integers]; FunctionDomain[x*y, x] is True
|
closed vocabulary; Tan and any second variable decline |
FunctionRange |
f, x, y[, dom] → condition in y. Sin[x] is -1 <= y <= 1; 1/(x^2 - 1) is y <= -1 || y > 0
|
constant-numerator rationals, degree ≤ 2, Sqrt of a quadratic, Exp, Ln, trig; the quadratic denominator declines (examples.tsv, row a-quadratic-denominator-is-declined) |
FunctionMonotonicity |
f, x → 1, -1, 0, Indeterminate. x^2 and Sqrt[x] are Indeterminate
|
polynomials and Exp; Indeterminate is returned as an unevaluated call (function-properties.ts:918-922) |
FunctionConvexity, FunctionSign
|
same shape as monotonicity. Sign[x^3] and Convexity[x^3] are Indeterminate
|
same |
FunctionInjective, FunctionSurjective
|
True/False. Surjective takes a codomain; Tan[x], x is True, Sin[x], x is False
|
injective: affine, odd monomial, Exp, Ln, Sqrt of an affine, Möbius; surjective: onto Reals only (function-properties.ts surjective declare) |
FunctionSingularities, FunctionDiscontinuities
|
f, x → condition. Sqrt[x] is x <= 0; Tan[x] is Cos[x] == 0; 1/x is x == 0
|
same vocabulary |
FunctionContinuous, FunctionAnalytic, FunctionMeromorphic
|
True/False; FunctionContinuous[{Log[x], x >= 0}, x] is False, {Log[x], x > 0} is True
|
same vocabulary; continuity takes the restriction as a third argument, not Wolfram's list |
FunctionPeriod |
f, x → the period or 0. Sin[2 x] is Pi; Assuming[a > 0, Sin[a x]] is 2 Pi/a
|
single trig term only; sums with different frequencies decline (FunctionPeriod/index.md) |
FunctionBijective, FunctionPoles
|
not kept | not declared |
Wolfram's third argument is a domain (Reals, Complexes, Integers). Here it is not an option and not a Rule key: options are Rules and option keys are never domain names (AGENTS.md, "Names"). It is written as the variable spec compute-engine's own Solve takes, Element(x, ComplexNumbers) (see §2), with a restriction as Element(x, set, condition). Reals and Complexes read as RealNumbers and ComplexNumbers, as FunctionSurjective already accepts Reals/RealNumbers for its codomain.
At v0.187.1. None of the family is declared there: grepping src, docs and ROADMAP.md for the thirteen names finds nothing, at the tag or at origin/main (0.192.0).
-
A condition is an expression, not an object. Inequalities are
Less,LessEqual(Greatercanonicalizes toLess), variadic soLess(a, x, b)is a chain (ce@v0.187.1:src/compute-engine/library/relational-operator.ts:1688-1700,1738), joined withAnd/Or; membership isElement/NotElement(library/sets.ts:873,1070). A restriction is a single-branchIf(cond, value)(boxed-expression/conditional-value.ts:220-227), andextractIntervalBoundsreads interval bounds for a symbol out of that shape,And, and chains (boxed-expression/inequality-bounds.ts:32).Interval(lo, hi)is aset<real>withOpen/Closedendpoint markers, endpoints possibly infinite (library/collections.ts:13423-13450). -
No inequality solver. A univariate
SolveofLess/LessEqual/Greater/GreaterEqualstays inert on purpose, and a list of inequalities with noEqualdoes too (boxed-expression/solve-domain.ts:53-57,903-921). Quantifier elimination over the reals is in the ROADMAP as "a major subsystem, listed for completeness, not planned" (ROADMAP.md:323-326), andResolveis on the list of names that stay inert (docs/MATHEMATICA-NAMES.md:70-79). -
A root finder with a completeness rule.
Solve(eq, spec…)takes specs that are a symbol orElement(symbol, collection[, condition])(library/core.ts:10159-10188). A root list that is only part of the roots is not an answer and theSolvestays unevaluated (boxed-expression/solve-domain.ts:184-188); the principal roots of a periodic equation become families with a fresh integer parameter (:967-975,periodicRootFamiliesat:4006).findUnivariateRootsis exported fromboxed-expression/solve.ts:4606and records instatswhether the list is complete. That is the decline rule this family needs, already enforced for roots. (The clone's checked-outROADMAP.mdstill describes an older principal-set-only behaviour; the tag's does not, and the source above is what I cite.) -
A certificate pattern. Interval arithmetic proves a root list complete by cutting a window into cells and proving each root-free, up to
MAX_ENCLOSURE_CELLS = 200_000(solve-domain.ts:202,4405-4440). A cell is root-free only if the enclosure of f isinterval, orsingularwith a bounded value, and excludes 0;emptyandpartialprove nothing, because the interval target reads a value that is non-real at an intermediate step as no value, while√x·√(x − 1)is real atx = −1(:4357-4384,enclosureExcludesZero). The interval library returnsinterval,empty,entire,singularorpartial(clipped at the domain) per operation (interval/types.ts:68-79) and was written to detect singularities (interval/index.ts:1-9). That is the machinery for sign, monotonicity and range certificates, and the caveat carries over: a sign proof is valid only where f is real on the whole cell. -
Calculus.
D(library/calculus.ts:7046),Limitwith directions andLimit(f, x, a)at infinity (:10033). Derivatives of elementary heads are inD's table; special functions are partial (assumed, not surveyed). -
Sign facts on definitions, not domain facts. An operator definition may carry
sgn(ops)(types-definitions.ts:925-945; read byboxed-expression/sgn.ts:5-31, which falls back to a ranged result type such asreal<0.0001..0.0015>). The signatures are complex-wide on purpose:Lnis(complex | infinity, …) -> complex | infinityandLn(0)is the in-carrier value−∞(library/arithmetic.ts:9558-9578),Sqrtthe same (:12821),Tanhas finite poles whose value is~oo(library/trigonometry.ts:995-1000). So a definition does not say "real on x > 0"; that fact exists only inside result-type handlers:logType(library/type-handlers.ts:598),poleReciprocalType(:674),boundedInverseTrigTypewithARCSIN_DOMAIN/ARCSEC_DOMAIN(:832,881,903). There is no table of "where this operator is real and finite". -
Per-operator analytic metadata, small.
ce.functionProperties(name)returns Fungrim-derived poles, zeros, branch points and cuts, essential singularities, holomorphic domain and meromorphy (function-properties/index.ts:1-14,function-properties/types.ts:28-48). The data covers 25 operators and 115 entries (function-properties-data.jsonmanifest);Tan,LogandSqrthave no records,Gammahas polesNonPositiveIntegers. It is a complex-plane store keyed by operator at one distinguished variable, with no composition. -
Tests. Compute-engine's own suites are Jest
describe/test(test/compute-engine/function-properties.test.ts:1-10); the PR checklist is on Contributing ("Writing a compute-engine PR").
What this means: compute-engine has the expression forms for conditions, a root finder that declines when it cannot certify, interval arithmetic that can certify signs, and derivatives. It lacks a way to turn "this operator's argument must be positive" into a condition and combine such conditions. That missing layer is slice 1.
Soundness for every head: the call returns an answer only when the answer is exact; otherwise it stays unevaluated. A condition returned for FunctionDomain is the exact domain, never a subset or superset. FunctionRange returns the exact image or declines. A predicate returns True/False only when proved. Indeterminate (monotonicity, sign, convexity) is returned only when the derivative is proved to change sign, per Wolfram's use of it. Endpoints are exact numbers, not doubles.
Definition of "defined": real x is in the domain when f(x) is a finite real number, as Wolfram's FunctionDomain over Reals. Because compute-engine's Ln(0) evaluates to −∞ and Tan(π/2) to ~oo, "evaluates without error" is not the test; the rules below carry their own exclusions.
Each is a test row first. All read from function-properties.ts; none run.
-
FunctionDomain(Sqrt(-x^2), x)reads asFalse. The radicand's shape isnonposwith its one zero at 0 (:294);conditionSignwithwant = "nonneg", non-strict, returnsFalsewhen the signs do not match (:343-344). The domain isx == 0. The same branch returnsFalseforFunctionSingularities(Sqrt(x^2), x), thoughSqrt(x^2)is not analytic at 0 and the file's own comment saysSqrtis singular at its boundary zero (:608-612). Fix: a touch point is a one-point set in the non-strict cases, neverFalse. -
Roots are doubles.
polyOfreads every constant throughexpr.N()(:94-102),signShapetakesMath.sqrt(disc)(:289-293) anddisc === 0on doubles (:294), and the boundary reaches the condition as a JS number (:320).x^2 - 2therefore yields a float bound where±Sqrt(2)is the answer, andx^2 - 1/3 x + 1/36's double root depends on rounding. The header's "exact, real coefficients" (:15) is exact only for integers of small size. The rule "decline rather than answer wrong" applies: keep coefficients and roots as boxed exact numbers (assumed that upstream uses its polynomial helpers,boxed-expression/polynomials.ts, whichsolve-domain.ts:34imports), and decline when a root has no exact form compute-engine can box. -
Indeterminateis returned as the unevaluated call (:918-922), which merges "proved not monotone" with "could not decide". Wolfram answersIndeterminateforx^2(FunctionMonotonicity/examples.values.wolfram.tsv). See answer 4.
Machinery: a RealSet, an ordered finite union of intervals with exact endpoints and open/closed ends, plus one extra form for a periodic exclusion (§ below). It has intersect, union, complement, preimage through monotone pieces, and a toCondition that writes the canonical Or/Less chain or True/False. Conditions are written by this one function, so the output form is stable (§5).
Rules, structural recursion over the expression as canonicalized:
| Node | Domain |
|---|---|
| number, symbol not x | all of ℝ (a parameter, see below) |
x |
ℝ |
Add, Multiply, Subtract
|
intersection of the operands' domains |
Divide(p, q), Power(q, -n)
|
dom(p) ∩ dom(q) minus the real zeros of q |
Sqrt(g), Power(g, 1/2n)
|
dom(g) ∩ {g ≥ 0} |
Ln(g), Log(g)
|
dom(g) ∩ {g > 0} |
Power(g, h) with non-integer rational h |
by the denominator of h: odd roots all of dom(g), even roots {g ≥ 0}; others decline |
Arcsin(g), Arccos(g)
|
dom(g) ∩ {−1 ≤ g ≤ 1} |
Tan(g), Sec, Cot, Csc
|
dom(g) minus {cos g = 0} (or {sin g = 0}) |
Exp, Sin, Cos, Sinh, Cosh, Arctan, Abs
|
dom(g) |
Gamma(g) |
dom(g) minus {g ∈ ℤ≤0} |
| anything else | decline |
To evaluate "{g ≥ 0}" for a compound g: find the real roots of g with Solve over Element(x, RealNumbers), require the root list complete (compute-engine's own rule above), split the line at the roots, and take the sign of g on each piece by interval arithmetic at a test point with a certificate (g's interval over the piece excludes 0), not by evaluating one float. A root list that is not complete, or a piece whose sign is not certified, declines the whole call; the certificate is enclosureExcludesZero's: g real on the whole piece and its enclosure excluding 0. This is the one new solver capability: it is a sign-chart over Solve, not a general inequality solver.
Periodic exclusions: Solve(Cos(g) = 0, x) returns a family x₀ + k·T with a fresh integer parameter, or stays unevaluated (solve-domain.ts:184-188,967-975). For g affine with exact coefficients the family inverts to a condition on x, written as Wolfram does, NotElement of an affine expression in x over Integers (the data row tangent-s-domain-is-declined in FunctionDomain/examples.values.wolfram.tsv: NotElement[1/2 + x/Pi, Integers]). For compound g the family is a set of g-values, and its preimage under g is not generally solvable: decline. Intersecting a RealSet with such an exclusion is done only when the other side is all of ℝ or one interval, as NotElement joined with And; a union of intervals with an exclusion declines at first.
Parameters: a free symbol other than x is a parameter. If it occurs in no condition-producing node it does not change the answer, and FunctionDomain(x*y, x) is True as Wolfram answers (FunctionDomain/examples.tsv, row a-multivariate-expression-declines, wolfram.note). If it occurs in a condition, decline. This is sound and covers the one row where we currently differ.
Complex domains (Element(x, ComplexNumbers)): out of slice 1. Over ℂ the domain is where the principal-branch function has a value, which for Log is ℂ minus 0, not the cut; the data has such calls (FunctionDomain[Log[Tan[x] - 1], x, Complexes]) and answers need the pole sets of §3.2. Decline until slice 2.
Not done: products that cancel (x * (1/x)). Compute-engine canonicalizes before the head sees it, and I have not read whether it cancels x * x^-1 (assumed it does, which would make FunctionDomain answer for the simplified form; a probe belongs in the first test).
Machinery: slice 1's walk, plus a pole and branch table per operator and Limit.
-
FunctionSingularities(f, x)over ℝ = (ℝ minus dom f) closure ∪ real poles ∪ real branch points, following Wolfram's convention thatSqrt[x]is singular at 0 (x <= 0) and1/xat 0 (FunctionSingularities/examples.values.wolfram.tsv). Per-operator table:Tan: {cos g = 0};Gamma: {g ∈ ℤ≤0};Ln,Sqrt: boundary of the domain; rational: zeros of the denominator not cancelled by the numerator (a zero of numerator and denominator of equal or higher multiplicity is removable: a root ofqwithpalso zero declines unless the multiplicities are compared byD). -
FunctionDiscontinuitiesequals singularities for the recognized shapes today (:630); the split appears only withFloor,Abs-like or piecewise heads, which slice 2 leaves declined. -
FunctionPoles(3 uses): the subset of singularities where the one-sided limit is~ooor ±∞. Proof: a zero of the denominator of exact multiplicity m, numerator nonzero there, checked withLimit. Return as a condition likeFunctionSingularities. Signature assumed. -
FunctionContinuous,FunctionAnalytic,FunctionMeromorphic:Truewhen the singularity set over the stated domain is empty (continuous, analytic), when it consists only of poles (meromorphic over ℂ). Over ℝ, "analytic" is "no singularity and every operator in the walk is entire on its argument's range" (Abs,Floorare not). - Complex poles and branch points of named special functions come from
ce.functionProperties(§2), applied only when the argument is the variable itself or affine in it. Over 25 operators it is coverage, not method;Tan,Log,Sqrtneed the table above regardless.
Machinery: slice 1's domain components (each a connected interval), D, root completeness from Solve, Limit at component ends, interval certificates for the sign of f' (or f'') between critical points.
On one component I (f continuous there because slice 2 reports no singularity inside it):
-
Monotonicity:
1if f' ≥ 0 on I with zeros isolated,-1for ≤ 0,0if f' ≡ 0,Indeterminateif f' has a certified sign change inside I. With more than one component, Wolfram'sIndeterminatefor a domain that is not ℝ (Sqrt[x];FunctionMonotonicity/index.md) applies; asking over a stated restrictionElement(x, RealNumbers, cond)is how to get a per-interval answer. Certificate: f' has no sign change if the root list is complete and the sign is certified on each side. -
Convexity and sign: the same with f'' and f. Sign is the sign of f on dom f;
FunctionSign[x - Sqrt[x^2], x]appears in the data, which needsAbs/Sqrt(g^2)handled as piecewise, so it declines at first. -
Range: on a component, the image is an interval bounded by the extreme values at critical points and the one-sided limits at ends; the answer is the union over components, as a condition in y built by the same
toCondition. Sound only with a complete critical-point list and a finite-or-infinite limit at each end thatLimitreturns exactly. Wolfram's row1/(x^2 - 1)isy <= -1 || y > 0: components (−∞,−1), (−1,1), (1,∞), images (0,∞), (−∞,−1], (0,∞); the union is the answer and this is exactly the row we decline today for want of the vertex value (FunctionRange/examples.tsv). -
Injective:
Trueif f is strictly monotone on each component and the images of different components are disjoint (so1/xisTrue, as Wolfram answers);Falseif a component has an interior critical point where f' changes sign (a continuous function with an interior extremum is not one-to-one), or two components' images overlap. Anything else declines. -
Surjective onto a set S: range equals S. Onto
RealsisFunctionRange == True; onto another codomain, decline exceptIntegersover an integer-valued domain (the data hasFunctionSurjective[{x/2 + 1, Element[x, Integers], Element[y, Integers]}, x, y]; assumed out of scope for the first version). -
Bijective (6 uses):
Andof injective and surjective.Falseif either isFalse;Trueif both areTrue; otherwise unevaluated. Cheap once both exist.
Range of a function the elementary rules do not cover (the Bessel family) keeps the tail-bound certificate (function-range.ts).
Machinery: a trig recogniser, independent of the rest. For a sum of terms c_k·T_k(a_k x + b_k) with T in Sin, Cos, Tan and exact rational ratios a_k/a_j, the periods form a group generated by P = 2π/g where g is the greatest common divisor of the |a_k| (π/g if every term is Tan; the common refinement for a mix). Terms of the same frequency combine into one sinusoid, so cancellation to zero is possible (sin(ax+b1) - sin(ax+b1) is not seen, but sin(ax) + sin(ax + π) is): decline when two terms share a frequency and their sum could vanish. A product of trig terms reduces by the product-to-sum identities, or declines. Non-periodicity (0) is already returned for polynomials, Exp, Ln, Sqrt and rationals (function-properties.ts:706-722) and extends by the same monotone-or-unbounded argument. Integer-domain periods (Mod[n, 8], (-1)^n; 4 of the 10 shown) are a separate machinery (residue arithmetic) and out of this page.
Counts rank nothing here (§1), so the order is by shared machinery: what each slice needs from the one before.
| Slice | Delivers | Needs | In ce-patches as |
Tests |
|---|---|---|---|---|
| 0 | the three repairs of §3.0 | nothing | edits in @notatio/analytic (no patch yet; it is already ours) |
rows in reference/Function*/examples.tsv with known for the touch-point and irrational-root cases; run through known.test.ts (AGENTS.md, "Reference entries") |
| 1 |
RealSet, toCondition, FunctionDomain for the §3.1 table and the parameter rule |
0 | patch function-domain: src/compute-engine/library/function-analysis.ts (path assumed) for the kernel and the head |
compute-engine style table-driven Jest: evaluate(), .N()-free, parse route, compound argument that reduces to it; reference examples as snapshots; oracle rows from Wolfram compared as statements (symbolic.ts:470-493) |
| 2 | singularities, discontinuities, poles, continuous, analytic, meromorphic; complex domains | 1 | patch function-singularities; FunctionPoles joins the frontier collector's claimed set |
same; add each pole/branch-point table row as an example with its Wolfram column |
| 3 | monotonicity, convexity, sign, range, injective, surjective, bijective | 1, 2 (a component is continuous) | patch function-derivative-sign
|
same; the sampled check below |
| 4 | period for trig sums | independent | patch function-period
|
same |
Moving a head from @notatio/analytic to a patch: the patch declares the head, declareAnalytic stops declaring it, the record's library: changes, and the manifest's fixed(ce) (packages/ce-patches/src/patch.ts:13-44) is the issue's repro, true when a fresh engine already evaluates FunctionDomain(1/x, x) to something other than the held call (assumed shape; tests/landed.test.ts:1-50 runs it on a fresh ComputeEngine, and must not see our declaration). Each patch is sized like the pull request it becomes.
An independent oracle, as Contributing requires (a second computation by different means, not a regression): for FunctionDomain and FunctionRange, sample x on and off each reported interval and test with .N() that f(x) is a finite real exactly where the condition holds, and that every sampled value lies in the reported range and the extremes are approached. For monotonicity and injectivity, sampled differences. This is independent of Wolfram, so a verdict that disagrees with Wolfram is a finding, not a noise (AGENTS.md: a failing oracle row is a symptom).
Compute-engine's checklist items that apply: tests in a file named after the issue (item-<issue>-<topic>.test.ts), a CHANGELOG entry under ## [Unreleased], comments per docs/COMMENTING-GUIDELINES.md. "Every route in the same change" has no compiled target to carry here: the heads return conditions, so no JavaScript or GLSL lowering applies (assumed; state it in the PR).
-
Normal forms differ from Wolfram's. Wolfram prints
Inequality[-2, LessEqual, x, LessEqual, 2]where we write[LessEqual, -2, x, 2];x < -1 || Inequality[-1, Less, x, Less, 1] || x > 1against ourOrof the same pieces;NotElement[1/2 + x/Pi, Integers]against any equivalent spelling of the tangent poles (reference/FunctionDomain/examples.values.wolfram.tsv). Compare by equivalence, never by text. The existing comparison falls toIndeterminatewhenResolveexceeds 20 s (symbolic.ts:487-492), which is no verdict, not agreement; count those separately. -
Branch cuts and complex domains. Compute-engine's carriers are complex-wide, so no definition says where a function is real (§2).
FunctionSingularitiesfollows Wolfram in counting the cut and branch point as singular on the reals (x <= 0forSqrt/Log), which is not the complement of the domain. Over ℂ the same convention needs the principal branch's cut written out. Slice 1 stays real for this reason. -
Piecewise and non-analytic heads.
Abs,Floor,Sign,Max,Min,If/Whichneed case splits in every head; declined in slices 1 to 3,AbsandSqrt(g^2)first (they are in the data:FunctionSign[Abs[x], x],FunctionMonotonicity[Sqrt[x^2] - x, x]). -
Canonicalization changes the question. Compute-engine canonicalizes before a lazy head runs, so
x/xmay already be1(assumed, §3.1). Wolfram's head holds its arguments (attributes: HoldAllin the records); the domain of the written expression and of the simplified one differ. -
Performance of repeated solving. The walk calls
Solveonce per condition-producing node and interval arithmetic once per piece. Bound it: node count, the existingMAX_DEGREE = 8(function-properties.ts:25), a cell cap likeMAX_ENCLOSURE_CELLS(solve-domain.ts:202,4438), the engine deadline (checkDeadline(ce._deadlineFrame), as the enclosure loop does), and a per-call cache keyed on the boxed subexpression. A decline on a cap is the answer, never a partial list. -
Multivariate regions.
FunctionDomain[(x + y)/(x^2 - y^2), {x, y}]is a region in the plane; that is cylindrical decomposition, which compute-engine does not plan (ROADMAP.md:323). Decline. - Exactness. §3.0 above; this is the risk the existing code already carries.
-
Fungrim store scope. Poles from
ce.functionPropertiesapply to the bare operator only; applying them under a composition without a preimage computation is wrong (Gamma(1 - x^2)has poles at ±1, ±Sqrt(2), … not at the integers).
-
Correct the Ideas page? Recommended: yes. Say the family is implemented for single-variable shapes in
@notatio/analytic, nameFunctionBijectiveandFunctionPolesas the frontier heads, and link this page. It costs one line and stops the next reader treating the block as unstarted. -
Where does the kernel live? Recommended: new patches in
packages/ce-patches/,@notatio/analyticdrops each head as its patch lands. Reason:AGENTS.mdputs upstream-plausible heads there from the start, and the kernel is exactly the upstream-plausible part; the reference records stay in@notatio/analyticor move topackages/reference/entries/with the heads (theirlibrary:field decides). -
Open a design issue upstream first, and alone? Recommended: yes, alone, covering slice 1 only. The repo rule is to post an issue alone when the work may be rejected or needs the maintainer's design call; both hold. Compute-engine has no inequality solver and
Resolve/QE is "not planned" (ROADMAP.md:323,docs/MATHEMATICA-NAMES.md:79), so a condition kernel is a first. The issue asks: WolframFunction*names or others; theElement(x, set[, cond])variable-spec convention; aRealSetinternal type versus building conditions directly; whether the Fungrim store should feed it. Batch with nothing else; it is a design, so the owner signs off the draft before posting. -
Indeterminateor unevaluated for a proved non-monotone function? Recommended: returnIndeterminatewhen the derivative's sign change is certified, stay unevaluated otherwise. Reason: Wolfram's own answer forx^2isIndeterminate, the current choice loses the difference between "proved not monotone" and "could not tell" (function-properties.ts:918-922), andIndeterminateas a returned value is compute-engine's own convention (follow CE 0.141, memorynan-vs-indeterminate, not re-read here). -
Exact roots or decline? Recommended: exact boxed endpoints; decline when a root has no exact form. Reason:
AGENTS.md, "decline rather than answer wrong"; a float boundary in an exact condition is wrong in the last digit and wrong in kind. -
Spelling of the domain argument. Recommended:
FunctionDomain(f, Element(x, ComplexNumbers)), restrictionElement(x, RealNumbers, cond), barexfor the reals. Reason: compute-engine'sSolvealready takes this spec (core.ts:10171-10174), a compute-engine ruling beats Wolfram's third-argument lean, and it keeps domains out of options. MigrateFunctionContinuous(f, x, cond), whose third argument is a bare condition and so differs from every other head here. - Multivariate and region answers? Recommended: not in this family now; only the parameter rule of §3.1. Reason: regions need cylindrical decomposition, which upstream does not plan, and the sound subset adds a parameter case at no cost.
- Rerun the frontier collector without the 10-call cap to get real counts? Recommended: yes, one run, since the order above is by machinery and the data cannot say whether a head with the cheapest machinery is also the most used. It needs a Wolfram kernel and about as long as its header says; I have not run it.
-
FunctionInterpolation: recommended to exclude from the family. It is not a property of f (assumed from the name; zero uses in the mapped symbols' examples).
Measured (read at origin/main bfa63e225 or at ce@v0.187.1, path:line above): the thirteen declared heads and the shapes recognize accepts; the three §3.0 behaviours (read, not run); that FunctionBijective has 6 uses and FunctionPoles 3; the 9-versus-10 call counts per head and the 128 and 50 totals (a regex count, indicative); the Wolfram column of the committed examples; that compute-engine declares none of the heads at v0.187.1 or origin/main (grep); that Solve of an inequality is inert, QE is not planned, Solve takes Element specs, interval results have five kinds; that operator signatures are complex-wide; the size of the Fungrim store.
Assumed: Wolfram's signatures and return shapes for FunctionPoles and FunctionBijective; what Wolfram returns for the multi-variable and Complexes calls (only their inputs are in the data); that ce.box makes a JS number a machine float in a condition (function-properties.ts:320); whether compute-engine canonicalizes x/x before a lazy head; the existence and behavior of upstream's polynomial helpers outside compute-engine; that no compiled lane applies; the fixed(ce) probe shape; that Indeterminate is a returned value upstream follows; the new file and patch names; the derivative table's coverage of special functions.