Repository navigation
An interval under a function monotone on it is the interval between the images of its ends, and a product or quotient of two intervals is an interval - #1423
Merged
Conversation
…he images of its ends, and a product or quotient of two intervals is an interval What #322 has left after #1117 and #1118: a function applied to an interval, and an interval times an interval. A function monotone on an interval maps it to the interval between the images of its ends -- in the same order when increasing, reversed when decreasing -- each end attained exactly when the end it comes from is, and an infinite image never attained: ln((0; 1)) is (-oo; 0), and so is ln([0; 1)), since ln(0) is not a value. Answered for the functions the library has nodes for on the intervals where they are monotone: ln and log for any positive base but 1 on the positives, b^I for such a base everywhere, I^n for a whole n (odd everywhere; even on either side of zero and folded across it; negative through the reciprocal where zero is outside), I^(1/n) from zero on, abs, arctan everywhere, arcsin and arccos on [-1; 1]. A product of two intervals with finite numeric ends is the interval between the least and the greatest of the four products of ends, an end attained where both its factors are; a quotient is the product by the reciprocal, which is an interval exactly when the divisor does not contain zero, and that also answers a constant over such an interval, which #1118 left. Symbolic ends and factors, a sine over an interval, a root of a negative interval and a divisor around zero are left as written. Recorded in BREAKING-CHANGES.md against a v2.5.0 build, where every one of these was left as written. Full suite green; benchmark gate PASSED. Closes #322. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
Rafael-SOWNet
added a commit
that referenced
this pull request
Sep 21, 2026
Item 6 of the reference's docket (#1409), the half that needs no pair. image(f(x), x in A) is { f(x) : x in A }, which is union({f(x)}, x in A): listed over a listed A, an interval by interval arithmetic where x occurs once in f -- exact for one occurrence and the operations that have images (#1423); the reference's 9c/5 + 32 on (0, 100) is (32, 212) -- and otherwise the family, which answers membership through the quantifiers. preimage(f(x), x in A, Y) is { x in A : f(x) in Y }, and a set builder of that shape is solved on evaluation where the statement solver reads the membership (a listed Y, an interval; #1440), the solutions cut by A: the pre-images of x^2 (Ex 7.3.10), with the one of (0, 1) excluding 0 where the book prints (-1, 1). That shape only: a set builder is not solved on evaluation in general, that being a search on every evaluation. The performance baseline moves to this run. ParseHard reached +3.2% over the baseline recorded at 86af577, and it is the ten function tokens added to the grammar since -- about 12 KB/op each, whatever the input, measured by removing the two of this change and nothing else (3,727,130 to 3,703,015 B/op): a cost in the ANTLR runtime's per-parse work, filed as #1441. Every other row is within 1% of the old baseline. #1409 Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What #322 has left after #1117 (subtraction reflects) and #1118 (scaling): a function applied to an interval, and an interval times an interval. Per the comment there, "just do it".
Images. A function monotone on an interval maps it to the interval between the images of its ends — same order when increasing, reversed when decreasing — each end attained exactly when the end it comes from is, and an infinite image never attained:
ln((0; 1))is(-oo; 0), and so isln([0; 1)). Answered for the nodes the library has, on the intervals where they are monotone, and declined elsewhere:ln((0; 1)),ln([1; e]),log(1/2, (0; 1])(-oo; 0),[0; 1],[0; +oo)e^[0; 1],2^(-oo; 0),(1/2)^[0; 2][1; e],(0; 1),[1/4; 1][1; 2]^2,(-2; 1]^2,(-3; -1)^2,[-2; 3)^3[1; 4],[0; 4)(folded across zero),(1; 9),[-8; 27)[1; 2]^(-1),(0; 1]^(-1),1 / (0; 1],2 / (0; 1)[1/2; 1],[1; +oo),[1; +oo),(2; +oo)sqrt([0; 4]),sqrt((1; 9))[0; 2],(1; 3)abs((-1; 2]),abs((-5; -1])[0; 2],[1; 5)arctan((-oo; +oo)),arcsin([-1; 1]),arccos([0; 1])(-pi/2; pi/2),[-pi/2; pi/2],[0; pi/2]ln((-1; 1)),(-1; 4)^(1/2),[-8; 8]^(1/3),1 / [-1; 1],arcsin([0; 2]),sin([0; 1]),(0; 1) * k,[a; b]^2Products.
(1; 2) * (3; 4)is(3; 8),[1; 2] * [-1; 1]is[-2; 2],[-2; 3] * [-1; 4]is[-8; 12]: the interval between the least and the greatest of the four products of ends, an end attained where both its factors are. A quotient is the product by the reciprocal, which is an interval exactly when the divisor does not contain zero —(1; 2) / (3; 4)is(1/4; 2/3),[1; 2] / [-1; 1]stays. The reciprocal also answers a constant over such an interval, which #1118 left with a note (2 / (0; 1)→(2; +oo);2 / [-1; 1]still stays, andIntervalScalingTestnow pins that pair).All in
Functions/IntervalArithmetic.cs; the arms inMulf,Divf,Powf,Logf,Absf,Arctanf,Arcsinf,Arccosfare one pattern each. Only numeric ends are read.IntervalImageTesthas the rows above; BREAKING-CHANGES.md rows measured on a v2.5.0 build, where every one was left as written. Full suite 11775 passed, 0 failed; benchmark gate PASSED (SimplifyHard 183,758,496 B against the 182,240,824 B of the congruence PR, +0.8%; ParseHard identical).Closes #322.
🤖 Generated with Claude Code
https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura