#32089 closed enhancement (fixed)

ConditionSet

Reported by: Matthias Köppe Owned by:
Priority: major Milestone: sage-9.4
Component: symbolics Keywords:
Cc: Travis Scrimshaw, Eric Gourgoulhon Merged in:
Authors: Matthias Koeppe Reviewers: Travis Scrimshaw
Report Upstream: N/A Work issues:
Branch: f135a05 (Commits, GitHub, GitLab) Commit: f135a05bd39d633e8ce5ed45cfe24d0eaf10bf5d
Dependencies: #32013, #32015 Stopgaps:

Status badges

Description (last modified by Matthias Köppe)

(from #24176).

We define a class ConditionSet for subsets of elements given by a logical "and" of finitely many predicates.

If the given predicates (condition) are symbolic, a ConditionSet can be converted to a SymPy ConditionSet; the _sympy_ method falls back to creating a SageSet wrapper otherwise.

As an application, we provide Chart and RealChart with a method codomain.

Change History (48)

comment:1 Changed 17 months ago by Matthias Köppe

Authors: Matthias Koeppe
Description: modified (diff)
Summary: ConditionSet_callable_symbolic_expressionConditionSet, ConditionSet_callable_symbolic_expression

comment:2 Changed 17 months ago by Matthias Köppe

Branch: u/mkoeppe/conditionset__conditionset_callable_symbolic_expression

comment:3 Changed 17 months ago by Matthias Köppe

Cc: Travis Scrimshaw Eric Gourgoulhon added
Commit: 2d5d4b9550eebe91aaa4f46a46a2e07a109c0e9a

Last 10 new commits:

dbdfc06InternalRealInterval, RealSet: Remove extra whitespace in latex, add documentation
7f56338PiecewiseFunction: Adjust doctests for changed RealSet repr
8abdc8bsrc/sage/functions/piecewise.py: Add coding header
5b0f85dMerge #31880
e768463Merge #31877
cb93c99RealSet: Inherit from Set_base, Set_boolean_operators, Set_add_sub_operators
3a6f9bdRealSet.symmetric_difference: New
08c52c2Set_base._test_as_set_object: Skip _test_pickling
4f4a964Merge #32013
2d5d4b9sage.sets.condition_set: New

comment:4 Changed 17 months ago by git

Commit: 2d5d4b9550eebe91aaa4f46a46a2e07a109c0e9a8c2cce8eb5aef51c981ef0bf116c3193603ab712

Branch pushed to git repo; I updated commit sha1. New commits:

8c2cce8ConditionSet: Complete basic implementation

comment:5 Changed 17 months ago by git

Commit: 8c2cce8eb5aef51c981ef0bf116c3193603ab712126773766f68934ef1f7f99836c837ca2284a63e

Branch pushed to git repo; I updated commit sha1. New commits:

1267737ConditionSet: Add example

comment:6 Changed 17 months ago by Matthias Köppe

I'm going to extend it to lists of several conditions

comment:7 Changed 17 months ago by Matthias Köppe

Dependencies: #32013#31931, #32013

comment:8 Changed 17 months ago by git

Commit: 126773766f68934ef1f7f99836c837ca2284a63e44f72930283a95afb6aa860fa905f57d28e4d513

Branch pushed to git repo; I updated commit sha1. Last 10 new commits:

6e5cac6sage.interfaces.sympy_wrapper, Sets.ParentMethods._sympy_: New
3cac256sage.interfaces.sympy_wrapper: Add doctests
eef604eSageSet: Finish docstrings; handle symbolic _contains
2baae58Sets.ParentMethods._sympy_: Call sympy_init
153b3e5Merge #31938
c06c965sage.interfaces.sympy_wrapper.SageSet: Add another doctest
f535127Merge #31938
32cdd5cMerge #31877
36e742dMerge #31931
44f7293ConditionSet: Accept several predicates

comment:9 Changed 17 months ago by git

Commit: 44f72930283a95afb6aa860fa905f57d28e4d513720bed24066b1adf00935238edf14ab88c8d4e45

Branch pushed to git repo; I updated commit sha1. New commits:

4e604ecRealSet.interval: New
48ac8e9Chart._check_restrictions: Simplify code by using any/all
720bed2{Chart,RealChart}.codomain: New

comment:10 Changed 17 months ago by Matthias Köppe

Description: modified (diff)

comment:11 Changed 17 months ago by git

Commit: 720bed24066b1adf00935238edf14ab88c8d4e451c13f2d16eb2afd3bd0ff6b722aca5035bf1d81b

Branch pushed to git repo; I updated commit sha1. New commits:

200b1efMerge tag '9.4.beta4' into t/32013/initialize_a_set_from_a_convexset_base_instance
1c13f2dMerge #32013

comment:12 Changed 17 months ago by git

Commit: 1c13f2d16eb2afd3bd0ff6b722aca5035bf1d81bb31b2c7a3116336b6cc9e2cd0744b7ddec4ec0ee

Branch pushed to git repo; I updated commit sha1. New commits:

b31b2c7ConditionSet: Support generator notation, add examples

comment:13 Changed 17 months ago by Matthias Köppe

Dependencies: #31931, #32013#31931, #32013, #32015

comment:14 Changed 17 months ago by git

Commit: b31b2c7a3116336b6cc9e2cd0744b7ddec4ec0eebb67e1139268b0b5cc69ad8af3959be798d48258

Branch pushed to git repo; I updated commit sha1. New commits:

91b0b16Merge #32013
789dc05Merge #31931
3dd50e4sage.sets.set.Set_object: Add _sympy_ methods to subclasses
7f35aeeMerge #32013
bb67e11Merge #32015

comment:15 Changed 17 months ago by git

Commit: bb67e1139268b0b5cc69ad8af3959be798d48258eb975f37a99b8390a1fc7f042f47982d5a6704f5

Branch pushed to git repo; I updated commit sha1. New commits:

eb975f3ConditionSet: Remove unnecessary subclass, add examples

comment:16 Changed 17 months ago by git

Commit: eb975f37a99b8390a1fc7f042f47982d5a6704f5468f621faec4ae084e70e3a4ae6fbe16275fe653

Branch pushed to git repo; I updated commit sha1. New commits:

d6162a6sage.interfaces.sympy_wrapper.SageSet.__str__, __repr__: New
468f621ConditionSet._sympy_: Fall back to creating a wrapper if necessary

comment:17 Changed 17 months ago by Matthias Köppe

Description: modified (diff)
Status: newneeds_review
Summary: ConditionSet, ConditionSet_callable_symbolic_expressionConditionSet

comment:18 Changed 17 months ago by git

Commit: 468f621faec4ae084e70e3a4ae6fbe16275fe653a745649024059791d35da56b1376fc0f0ef6e0c0

Branch pushed to git repo; I updated commit sha1. New commits:

a745649Chart.codomain, _restrict_set: Handle set/frozenset as ANDs in anticipation of #32102

comment:19 Changed 17 months ago by Travis Scrimshaw

Note that this is duplicating some of the framework in sage/combinat/combinat.py with FilteredCombinatorialClass.

What do we want the intersection of two condition sets to be? Mainly, do we want the generic intersection? It could be another condition set object naturally, which would be more direct for operations such as containment check or iteration.

comment:20 in reply to:  19 ; Changed 17 months ago by Matthias Köppe

Replying to tscrim:

Note that this is duplicating some of the framework in sage/combinat/combinat.py with FilteredCombinatorialClass.

Thanks for the pointer! I was not aware of this. But it looks to me like this whole *CombinatorialClass business is deprecated?

comment:21 in reply to:  19 ; Changed 17 months ago by Matthias Köppe

Replying to tscrim:

What do we want the intersection of two condition sets to be? Mainly, do we want the generic intersection? It could be another condition set object naturally, which would be more direct for operations such as containment check or iteration.

A specialized intersection method is of course a natural candidate to be added in a follow-up ticket. If for nothing else, certainly for more succinct printing.

comment:22 in reply to:  20 Changed 17 months ago by Travis Scrimshaw

Replying to mkoeppe:

Replying to tscrim:

Note that this is duplicating some of the framework in sage/combinat/combinat.py with FilteredCombinatorialClass.

Thanks for the pointer! I was not aware of this. But it looks to me like this whole *CombinatorialClass business is deprecated?

Indeed, but some of it is still used without a true replacement ready IIRC.

comment:23 in reply to:  21 Changed 17 months ago by Travis Scrimshaw

Replying to mkoeppe:

Replying to tscrim:

What do we want the intersection of two condition sets to be? Mainly, do we want the generic intersection? It could be another condition set object naturally, which would be more direct for operations such as containment check or iteration.

A specialized intersection method is of course a natural candidate to be added in a follow-up ticket. If for nothing else, certainly for more succinct printing.

Why can't we do it on this ticket? It seems simple enough to check if other is a ConditionSet, and then just create a new such instance with the concatenation of the conditions.

comment:24 Changed 17 months ago by git

Commit: a745649024059791d35da56b1376fc0f0ef6e0c028a51bb362092bfd69b12b4761070e1a0f73ca15

Branch pushed to git repo; I updated commit sha1. New commits:

1c1d67cConditionSet: Fix up for CallableSymbolicExpression inputs
89a230aConditionSet: Sort/uniq the symbolic conditions
28a51bbConditionSet.intersection: New

comment:25 Changed 17 months ago by Matthias Köppe

OK, here we go. Caught and fixed a bug along the way.

comment:26 Changed 17 months ago by git

Commit: 28a51bb362092bfd69b12b4761070e1a0f73ca15ac561ae53e341043a75609f1f0ccec86b8983daa

Branch pushed to git repo; I updated commit sha1. New commits:

ac561aeChart._restrict_set: Update doctest output

comment:27 Changed 17 months ago by Travis Scrimshaw

Reviewers: Travis Scrimshaw
Status: needs_reviewpositive_review

Thank you. LGTM (modulo the doctest failure for the dependency).

comment:28 Changed 17 months ago by git

Commit: ac561ae53e341043a75609f1f0ccec86b8983daa4844cd6efb0763e340d4171a1660500d07851722
Status: positive_reviewneeds_review

Branch pushed to git repo; I updated commit sha1 and set ticket back to needs_review. New commits:

63c2cfeConvexSet_base._test_convex_set: Do not test _test_as_set_object here
4844cd6Merge #32013

comment:29 Changed 17 months ago by Matthias Köppe

Dependencies: #31931, #32013, #32015#32013, #32015

comment:30 Changed 17 months ago by Travis Scrimshaw

Status: needs_reviewpositive_review

comment:31 Changed 17 months ago by Matthias Köppe

Thank you!

comment:32 Changed 17 months ago by git

Commit: 4844cd6efb0763e340d4171a1660500d0785172282f12e2420069109ff25311057516cc4d409e848
Status: positive_reviewneeds_review

Branch pushed to git repo; I updated commit sha1 and set ticket back to needs_review. Last 10 new commits:

2a23cb5Unicode symbol 2202 (partial) for the text display of coordinate frames
5d096f1f-string for unicode_symbol in TensorProductFunctor and SignedTensorProductFunctor
76c2fd5Use Unicode symbol for the Riemann sphere example
5167e6cUse Unicode symbol for default text display of RealLine
332410bUse unicode_otimes in TensorProductFunctor and SignedTensorProductFunctor
f5d15d2Merge branch 'public/manifolds/unicode_art' of git://trac.sagemath.org/sage into Sage 9.4.beta4.
d87d09b#30473: fix doctest error in DiffMap.pullback
f2ae50e#30473: fix doctests outside sage/manifolds and sage/tensor/modules
55240bbMerge #30473
82f12e2Merge #32013

comment:33 Changed 17 months ago by Matthias Köppe

Merged updated #32013.

comment:34 Changed 17 months ago by Matthias Köppe

Status: needs_reviewneeds_work

Unfortunately the sort order of the symbolic conditions is not stable. I'll have to fix this

comment:35 Changed 17 months ago by git

Commit: 82f12e2420069109ff25311057516cc4d409e84869d045a4556bc20f6b3d6aaf65c0e1241ecfbdc2

Branch pushed to git repo; I updated commit sha1. New commits:

0f60232ConditionSet: Do not sort the conditions, just use _stable_uniq
69d045aConditionSet: In doctests, do not rename ZZ^2 etc.

comment:36 Changed 17 months ago by Matthias Köppe

Status: needs_workneeds_review

Also the doctests that tried to use (ZZ^2).rename("ZZ^2") for cosmetic reasons were not stable. I have removed this complication.

comment:37 Changed 17 months ago by Travis Scrimshaw

Status: needs_reviewpositive_review

For future reference, you can simply call X.rename() to revert back to the default name. This can be used to make the doctest stable.

comment:38 Changed 17 months ago by Matthias Köppe

Thanks!

comment:39 Changed 17 months ago by Volker Braun

Status: positive_reviewneeds_work
[docpdf] Underfull \hbox (badness 10000) in paragraph at lines 5889--5891
[docpdf] \T1/txtt/m/sl/10 set.Set_boolean_operators\T1/qtm/m/n/10 , \T1/txtt/m/sl/10 sag
[docpdf] e.sets.set.Set_add_sub_operators\T1/qtm/m/n/10 , [][]\T1/txtt/m/n/10 sage.struc
[docpdf] ture.
[docpdf] ! Missing $ inserted.
[docpdf] <inserted text> 
[docpdf]                 $
[docpdf] l.5923 ...us{}even at 0x...\PYGZgt{}(x) \PYGZcb{}}
[docpdf]                                                   
[docpdf] ? 
[docpdf] ! Emergency stop.

comment:40 Changed 17 months ago by git

Commit: 69d045a4556bc20f6b3d6aaf65c0e1241ecfbdc21eb270a5e34e0ae634e73054d644499f10c16779

Branch pushed to git repo; I updated commit sha1. New commits:

daeb91esrc/sage/sets/set.py: Fix docstring markup
2cf2199Merge #32015
1eb270asrc/sage/docs/conf.py: Add more \ensuremath to \DeclareUnicodeCharacter

comment:41 Changed 17 months ago by Matthias Köppe

Status: needs_workneeds_review

comment:42 Changed 17 months ago by Travis Scrimshaw

Status: needs_reviewpositive_review

LGTM.

comment:43 Changed 17 months ago by Matthias Köppe

Thanks.

comment:44 Changed 17 months ago by git

Commit: 1eb270a5e34e0ae634e73054d644499f10c16779141ecde3a8382635148f88aa8f5a736fd2f29a95
Status: positive_reviewneeds_review

Branch pushed to git repo; I updated commit sha1 and set ticket back to needs_review. New commits:

2682469src/sage/interfaces/sympy_wrapper.py: Use Family, not Set, in doctests to make sure that the SageSet wrapper is actually used
753babbSet_object_enumerated._sympy_: Translate empty sets to EmptySet
141ecdeMerge #32015

comment:45 Changed 17 months ago by Matthias Köppe

Status: needs_reviewpositive_review

comment:46 Changed 17 months ago by git

Commit: 141ecde3a8382635148f88aa8f5a736fd2f29a95f135a05bd39d633e8ce5ed45cfe24d0eaf10bf5d
Status: positive_reviewneeds_review

Branch pushed to git repo; I updated commit sha1 and set ticket back to needs_review. Last 10 new commits:

f85e710Chart: in the description of the argument coord_restrictions, replace all instances of 'restrictions' by 'coord_restrictions'
80f6195Chart, RealChart: In class docstring, order arguments as they appear in __classcall__/__init__
a39e6fcDiffChart, RealDiffChart: In class docstring, order arguments as they appear in __classcall__/__init__; add description of argument coord_restrictions
cdf20b0TopologicalManifold.chart: Add description of argument coord_restrictions
741fd2eTopologicalManifold.chart: Add an example of using coord_restrictions
bf62543Merge branch 't/32089/conditionset__conditionset_callable_symbolic_expression' into t/32009/eliminate_direct_use_of_the_chart__domain_attribute
141ccb5Merge #32009
c89c697Merge #32102
451f5cfSets.ParentMethods: Update doctest
f135a05Merge #32015

comment:47 Changed 17 months ago by Matthias Köppe

Status: needs_reviewpositive_review

comment:48 Changed 17 months ago by Volker Braun

Branch: u/mkoeppe/conditionset__conditionset_callable_symbolic_expressionf135a05bd39d633e8ce5ed45cfe24d0eaf10bf5d
Resolution: fixed
Status: positive_reviewclosed
Note: See TracTickets for help on using tickets.