Skip to content

Commit 1b43bdb

Browse files
author
Release Manager
committed
gh-39718: Add a note regarding element containment testing Something I notice while working on #39717. Previously, the clause "Otherwise, …" doesn't hold. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [x] I have updated the documentation and checked the documentation preview. (see https://doc-pr-39718--sagemath.netlify.app/html/en/themati c_tutorials/coercion_and_categories.html#equality-and-element- containment) ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - #12345: short description why this is a dependency --> <!-- - #34567: ... --> URL: #39718 Reported by: user202729 Reviewer(s): Vincent Macri
2 parents 02da09c + 2b51201 commit 1b43bdb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/doc/en/thematic_tutorials/coercion_and_categories.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1003,7 +1003,7 @@ three building blocks: conversion, coercion, and equality test.
10031003

10041004
#. Clearly, if the conversion `P(x)` raises an error, then `x` cannot be seen as an element of `P`. On the other hand, a conversion `P(x)` can generally do very nasty things. So, the fact that `P(x)` works without error is necessary, but not sufficient for `x \in P`.
10051005
#. If `P` is the parent of `x`, then the conversion `P(x)` will not change `x` (at least, that's the default). Hence, we will have `x=P(x)`.
1006-
#. Sage uses coercion not only for arithmetic operations, but also for comparison: *If* there is a coercion from the parent of `x` to `P`, then the equality test ``x==P(x)`` reduces to ``P(x)==P(x)``. Otherwise, ``x==P(x)`` will evaluate as false.
1006+
#. Sage uses coercion not only for arithmetic operations, but also for comparison: *If* there is a coercion from the parent of `x` to `P`, then the equality test ``x==P(x)`` reduces to ``P(x)==P(x)``. (Otherwise, the equality test might still hold. For example ``mod(1, 4) in ZZ`` is true, even though there is no coercion from ``Zmod(4)`` to ``ZZ``, because ``ZZ(mod(1, 4)) == 1``)
10071007

10081008
That leads to the following default implementation of element containment testing:
10091009

0 commit comments

Comments
 (0)