Opened 2 years ago
Last modified 23 months ago
#24171 needs_work enhancement
Formal set membership function
Reported by:  rws  Owned by:  

Priority:  major  Milestone:  sage8.2 
Component:  symbolics  Keywords:  
Cc:  vdelecroix  Merged in:  
Authors:  Ralf Stephan  Reviewers:  Travis Scrimshaw 
Report Upstream:  N/A  Work issues:  
Branch:  u/rws/241711 (Commits)  Commit:  628f9220672280b526134311efdab819aa3f05c5 
Dependencies:  #24284 #24378 #24456  Stopgaps: 
Description (last modified by )
To express solution sets from solvers an expressioniselementofset relation is needed. For ease of implementation this can be made a formal function, likely named "contains" or "element_of". It would depend on sets being made coercible into SR.
Change History (31)
comment:1 Changed 2 years ago by
 Description modified (diff)
comment:2 Changed 2 years ago by
 Branch set to u/rws/formal_set_membership_function
comment:3 Changed 2 years ago by
 Commit set to 669ea22318ab33f23f727626eb30e59fa138d253
 Status changed from new to needs_review
comment:4 Changed 2 years ago by
I can reproduce this error
********************************************************************** File "src/sage/misc/dev_tools.py", line 438, in sage.misc.dev_tools.import_statements Failed example: load_submodules(sage.sets) Expected: load sage.sets.real_set... succeeded load sage.sets.set_from_iterator... succeeded Got: load sage.sets.set_from_iterator... succeeded
I think why this now fails is because real_set
is now loaded on startup.
comment:5 Changed 2 years ago by
 Status changed from needs_review to needs_work
I think it would be good if RealSet
answered positive to is_Set
, I'm just not sure how to accomplish it correctly. If done it wouldn't need to be loaded at start.
comment:6 Changed 2 years ago by
 Commit changed from 669ea22318ab33f23f727626eb30e59fa138d253 to af82717b1bfeffbe6fc972686882916b0525b149
comment:7 Changed 2 years ago by
 Status changed from needs_work to needs_review
comment:8 Changed 2 years ago by
 Commit changed from af82717b1bfeffbe6fc972686882916b0525b149 to 592ce8745028ec0659b952e872dfff0a85ef5a5d
Branch pushed to git repo; I updated commit sha1. New commits:
592ce87  24171: Py3 fixes

comment:9 Changed 2 years ago by
 Reviewers set to Travis Scrimshaw
 Status changed from needs_review to positive_review
LGTM. Thanks.
comment:10 Changed 2 years ago by
Thanks for the review.
comment:12 Changed 2 years ago by
 Commit changed from 592ce8745028ec0659b952e872dfff0a85ef5a5d to aa11a3ee31cb75f5acf2e5cef1db52fd2092893b
Branch pushed to git repo; I updated commit sha1. New commits:
aa11a3e  Merge branch 'develop' into t/24171/formal_set_membership_function

comment:13 Changed 2 years ago by
 Status changed from needs_work to positive_review
comment:15 Changed 2 years ago by
comment:16 Changed 2 years ago by
 Branch changed from u/rws/formal_set_membership_function to u/rws/24171
comment:17 Changed 2 years ago by
 Commit changed from aa11a3ee31cb75f5acf2e5cef1db52fd2092893b to ac6af264cb8beed2c7196691003ff93552a9f5b9
OK, I added junk to the branch, so what Volker means are the patchbot plugin fails. Also, the rare random fails are now happening frequently so patchbot pass depend on the blockers.
New commits:
ac6af26  24171: Formal set memberhzip function

comment:18 Changed 2 years ago by
 Dependencies set to #24284 #24378
comment:19 Changed 2 years ago by
Actually the reason why #24171 fails the random expression tests is because the here introduced function is yet another function that fails that test.
comment:20 Changed 2 years ago by
 Commit changed from ac6af264cb8beed2c7196691003ff93552a9f5b9 to 365ea784a37f3a99202ce2f801ce901d29d36cca
Branch pushed to git repo; I updated commit sha1. New commits:
6559c5e  24282: Exclude some functions with arg restrictions from random testing

5db62d3  Merge branch 'u/rws/exclude_some_functions_with_arg_restrictions_from_random_testing' of git://trac.sagemath.org/sage into tmp17

365ea78  24171: exclude element_of from random testing too

comment:21 Changed 2 years ago by
 Dependencies changed from #24284 #24378 to #24284 #24378 #24443
comment:22 Changed 2 years ago by
 Cc vdelecroix added
 Status changed from needs_work to needs_info
The following problem appeared: to be able to use a symbolic element_of
function its arguments (1. expression, 2. set/domain) must be convertible to the symbolic ring. One doctest in symbolic/ring.pyx
tests that r
(the R interpreter) does not convert to symbolic. But r
is in Sets()
and so we cannot simply test for x in Sets()
and allow conversion of x
because r
would then be allowed.
So we must test for all kinds of sets, e.g. ZZ in InfiniteEnumeratedSets()
, RR in Fields()
, RealSet(0,1) in SetsWithPartialMaps()
, and Set(range(0,5)) in FiniteSets()
, because we need to catch all of these but cannot use the catchall in Sets()
. Is the R interpreter really in the sets category? Is there a better catchall?
comment:23 followup: ↓ 24 Changed 2 years ago by
BTW RealSet(oo,oo) in Fields()
is False which looks like a bug, right?
comment:24 in reply to: ↑ 23 ; followup: ↓ 25 Changed 2 years ago by
Replying to rws:
BTW
RealSet(oo,oo) in Fields()
is False which looks like a bug, right?
Not to me. RealSet(oo,oo)
or RealSet(0,1)
act as a facade (like in Sets().Facade()
). That is to say, it does not have any proper elements. Making it a field would be rather artificial because the operation +
and *
that might (or might not) exist on the elements is obtained from other parts of Sage.
comment:25 in reply to: ↑ 24 ; followup: ↓ 26 Changed 2 years ago by
Replying to vdelecroix:
...
RealSet(oo,oo)
orRealSet(0,1)
act as a facade ...
Is there an object that can act as the set of real numbers in Sage?
comment:26 in reply to: ↑ 25 ; followup: ↓ 27 Changed 2 years ago by
Replying to rws:
Replying to vdelecroix:
...
RealSet(oo,oo)
orRealSet(0,1)
act as a facade ...Is there an object that can act as the set of real numbers in Sage?
Very sadly, no!
My dream is:
 rename
RealField(prec)
>RealFloatingPointField_mpfr(prec)
 rename
RealLazyField
>RealComputableField
andRLF > RCF
 create a class
RealField()
to model (abstractly) the set of real numbers  rename
RR
>RFPF
The reason for 2./3. is that we want to distinguish between the field of all real numbers (denoted RR
in math literature) and the field of computable numbers (which is a countable subfield). An element of RCF
would simply be a computer program that gives access to the digit expansion of a number. It should provide access to all mathematical constants like pi
, e
, etc and most transcendental functions. A serious problem about RCF
is that the equality is not decidable... but we can not avoid it.
The set of real numbers (my number 3. in the list) would not implement anything serious. It would only act as an abstract set that can be obtained as the metric completion of QQ
. It could be used as a building block for more advanced structures (like manfiolds).
I put 4. apart as it is a serious backward incompatibility.reasons.
comment:27 in reply to: ↑ 26 Changed 2 years ago by
 Dependencies changed from #24284 #24378 #24443 to #24284 #24378 #24456
 Status changed from needs_info to needs_work
comment:28 Changed 2 years ago by
 Branch changed from u/rws/24171 to u/rws/241711
comment:29 Changed 2 years ago by
 Commit changed from 365ea784a37f3a99202ce2f801ce901d29d36cca to 628f9220672280b526134311efdab819aa3f05c5
 Status changed from needs_work to needs_review
comment:30 Changed 2 years ago by
Note that we have no proper check for if something is a subset of the complexes. I ended up allowing conversion of all finite sets and (NN, ZZ, QQ, RealField, RealSet, AA)
to symbolic.
comment:31 Changed 23 months ago by
 Status changed from needs_review to needs_work
New commits:
24171: Formal set membership function