Skip to content

The factorial and the gamma function are defined off the real line - #2260

Open
Rafael-SOWNet wants to merge 1 commit into
masterfrom
a-factorial-is-defined-off-the-real-line
Open

Rafael-SOWNet wants to merge 1 commit into
masterfrom
a-factorial-is-defined-off-the-real-line

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

The factorial's condition was x in RR and (x >= 0 or not x in ZZ). That asked for a real argument as well, though i! is 0.498 - 0.155i and the only poles are the negative integers. x!/x! simplified to an answer with no value at x = i, where it is 1.

The condition is now x in ZZ implies x >= 0: off the integers x in ZZ is false, so the implication is true. It is written the way Simplify writes it, so that a quotient's not x! = 0, which Simplify reads as True under this condition, folds into it. Written as not (x in ZZ and x < 0), the answer carried both clauses.

2.6.0 and master this branch
"x!/x!".ToEntity().Simplify() 1 provided x in RR and (x >= 0 or not x in ZZ) 1 provided x in ZZ implies x >= 0
"x! = 0".ToEntity().Simplify() False provided x in RR and (x >= 0 or not x in ZZ) False provided x in ZZ implies x >= 0
"x!".ToEntity().DomainCondition x in RR and (x >= 0 or not x in ZZ) x in ZZ implies x >= 0

ExponentialSeries.HoldsOverTheRange read the old shape when dropping a factorial's condition over a summation range, so integral(floor(x) / (floor(x) + 1)!, x, 0, +oo) stopped being 1. An implication now holds over the range wherever its conclusion does.

FactorialOffTheRealLineTest: six cases fail on master. SimplifyTest's three x!/x!-shaped tests pinned the old condition and now have the new one. Suite 18185 passed. The F# wrapper suite, the Mcp, Terminal and InteractiveWrapper suites and the AOT smoke test pass. BoundCheck, RootCheck, CasBench, PropCheck, SimpSweep, RuleCheck, CanonCheck and Confluence are unchanged. Found by work/domaincheck.

Part of #2256.

🤖 Generated with Claude Code

The factorial's condition was x in RR and (x >= 0 or not x in ZZ),
which asked for a real argument as well, though i! is 0.498 - 0.155i
and the only poles are the negative integers. x!/x! simplified to
1 provided x in RR and (...), which has no value at x = i, where it is
1. The condition is now x in ZZ implies x >= 0: off the integers x in
ZZ is false and the implication is true. It is written as Simplify
writes it, so that a quotient's not x! = 0, which Simplify reads as
True under this condition, folds into it. As not (x in ZZ and x < 0)
the answer carried both.

ExponentialSeries.HoldsOverTheRange read the old shape to drop a
factorial's condition over a summation range, and
integral(floor(x) / (floor(x) + 1)!, x, 0, +oo) stopped being 1. An
implication now holds over the range wherever its conclusion does.

FactorialOffTheRealLineTest takes the condition at eleven points, off
the real line, at poles and between them, and two simplified quotients
at complex points; six fail on master. SimplifyTest's three
x!/x!-shaped tests pinned the old condition, and now have the new one.

Found by work/domaincheck.

Part of #2256.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@Rafael-SOWNet Rafael-SOWNet added this to the 2.7.0 milestone Oct 30, 2026
@Rafael-SOWNet Rafael-SOWNet moved this from Todo to In review in AngouriMath Oct 30, 2026
@codecov

codecov Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.70%. Comparing base (b035ed1) to head (69407da).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2260      +/-   ##
==========================================
- Coverage   86.71%   86.70%   -0.02%     
==========================================
  Files         310      310              
  Lines       67790    67819      +29     
  Branches    19666    19676      +10     
==========================================
+ Hits        58786    58801      +15     
- Misses       4892     4898       +6     
- Partials     4112     4120       +8     
Flag Coverage Δ
cpp 37.77% <ø> (ø)
csharp 87.25% <100.00%> (-0.02%) ⬇️
fsharp 32.97% <ø> (ø)
interactive 40.72% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...Functions/Algebra/Polynomials/ExponentialSeries.cs 76.25% <100.00%> (-2.26%) ⬇️
...nuous/Evaluation.Continuous.Arithmetics.Classes.cs 86.98% <100.00%> (ø)
...lification/Patterns/Patterns.EqualityInequality.cs 88.77% <100.00%> (ø)

... and 8 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

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

Labels

None yet

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

1 participant