Move NUM_FLOOR/NUM_CEILING to realaxTheory #1256
Merged
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.
Hi,
The floor and ceiling of real numbers are more naturally defined on integers (see
INT_FLOOR
andINT_CEILING
inintrealTheory
), but theNUM_FLOOR
andNUM_CEILING
defined inrealTheory
are still useful (they only work on positive reals) sometimes:The problem is that both
NUM_FLOOR
andINT_FLOOR
are overloaded byflr
(so isclg
forNUM_CEILING
, etc.), and currently there's no good way to set preferences toNUM_FLOOR
. Sincereal_of_rat
was opened somewhere in the middle of dependencies, this has become a problem.For example, in
examples/probability/large_numberTheory
(NOTE: the whole probability theory was developed without using any integers, directly), I had to use the following code to putNUM_FLOOR
overINT_FLOOR
:I was thinking (also due to some discussions on Discord) that putting
NUM_FLOOR
andNUM_CEILING
into the operator list ofrealLib.prefer_real
may help, but actually it doesn't: I cannot callprefer_real()
inlarge_numberTheory
where extreals should be preferred. Instead, I had to usedeprecate_int ()
anddeprecate_rat ()
to disable the parsing preferences of integers and rationals.To minimize incompatibilities, I think it's reasonable to add a new function
realLib.prefer_num_floor
, focusing on these two operators. (Other solutions are welcome.) This is what's done in this PR.--Chun