feat: numerical comparison of literals in `where` clauses
Author: liangyiliangCreated Jul 12, 2024Updated Sep 6, 2024
Labelssystem:languagesystem:compiler
Is your feature request related to a problem? Please describe.
Now that we have substance literals (#1682) it would be nice to have some sort of built-in predicates for literal numbers, like <, <=, ==, >, and >=. It would also need to support numerical computations.
That way we can reason about literals like,
forall Number n1; Number n2
where Pred(n1); Pred(n2); n1 < n2 {
...
}Notice that these "predicates" don't really appear in Substance, so we cannot directly perform matching against Substance. Instead we would need to first generate a list of matchings from all other declarations/predicates, and then filter them on which ones are not satisfied.
Implementation concerns
I feel that we may be able to reuse the "calculator" that I implemented for substance sequences (indexed sets) (#1572).
Source: penrose/penrose