using AngouriMath; namespace AIStudio.Tools.Mathematics; /// /// The index of a family of solutions, such as n in union({ pi / 6 + 2 * pi * n }, n in ZZ), with the set it ranges over. /// /// The index, which the family binds. /// The set the index ranges over, e.g., the integers. public sealed record SolutionIndex(Entity.Variable Variable, Entity.Set Over) { /// /// Whether the index may take an integer, as far as AngouriMath can decide it. /// /// The integer. /// True when the set of the index surely contains the integer. public bool Takes(int value) => this.Over.TryContains(Entity.Number.Integer.Create(value), out var contains) && contains; }