Skip to content

IEnumerable<Entity> -> Set in InvertNode #318

Description

@WhiteBlackGoose

Because not every node when being inverted returns a finite set. For example,
|x| = a should return { a e ^ (i * r) : r in RR and a >= 0 }

Activity

  1. added this to the 1.2 milestone on Jan 26, 2021
  2. modified the milestones: 1.2, 1.6 on Mar 2, 2021
  3. added
    AcceptedFor proposals, which were approved and will be implemented
    on Mar 24, 2021
  4. added a commit that references this issue on Aug 8, 2026
  5. Rafael-SOWNet commented on Aug 8, 2026

    @Rafael-SOWNet
    Member

    Measured this while sorting out what has to happen before 2.0, and it changes what is left here.

    The parametric sets already work

    abs(x) = a      ->  { a * e ^ (i * r_1) provided r_1 in RR }
    sin(x) = a      ->  { arcsin(a) + 2 * pi * n_1, pi - arcsin(a) + 2 * pi * n_1 }
    x ^ 2 = a       ->  { sqrt(a), -sqrt(a) }
    

    on master (21f0d16). The first is the example in this issue, and it comes back in the shape asked for. Inversions that are not finite sets are already expressed as parametric ones, via ConditionalSet and Providedf.

    It is also not an API change

    Invert is internal and InvertNode is private protected:

    internal IEnumerable<Entity> Invert(Entity value, Entity x)
    private protected abstract IEnumerable<Entity> InvertNode(Entity value, Entity x)

    so what they return is nobody's contract, and changing the type breaks no consumer. I had this filed as a decision that only a major version could take; it is not, and it does not need to wait for 2.0. (The doc comment on Invert already says it "returns a Set", so the intent was recorded even though the signature was not changed.)

    What is actually left, and it is worse than a signature

    The sentence in this issue names two halves:

    |x| = a should return { a e ^ (i * r) : r in RR **and a >= 0** }

    The r in RR half is implemented. The a >= 0 half is not, and without it the result is wrong rather than merely loose:

    abs(x) = -1     ->  { -e ^ (i * r_1) provided r_1 in RR }
    

    At r_1 = 0 that is x = -1, and abs(-1) = 1, not -1. No member satisfies the equation; the answer should be the empty set. Filed as #812.

    So the useful remainder of this issue is the guard, not the return type — and it is a wrong-answer fix, which outranks the refactor. Changing IEnumerable<Entity> to Set is still reasonable tidying whenever someone is in here, just not urgent and not breaking.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    AcceptedFor proposals, which were approved and will be implemented

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions