Interval test
This functionality, denoted as [a<x<b] tests whether [x] lives in a public interval (a;b).
It is implemented as follows:
- [r∈RFp]B, calculate [r]=i=0∑l−12i[ri]
- Open [r+x], and denote a′=(r+x)−b;b′=(r+x)−a
- Now, we output ([a′<Br]∧[r<Bb′])∨([a′+p<Br]∧[r<Bb′+p])
Here, some of the public terms are trivial automatically, and do not need to be calculated (any checks that are out of the range [0..p−1]).