The draft of P1788 is structured into four levels. These levels are similar to those from IEEE754 standard.
Here is a small snippet form the current version of the draft:
 Level 1 (Mathematical Model level) defines the mathematical theory underlying the standard. The entities at
this level are mathematical intervals and operations on them. Conforming implementations shall
implement this theory.
 Level 2 (Interval datum level) is the central part of the standard. Here the mathematical theory is
approximated by an implementationdefined finite set of entities and operations. A level 2 entity
is called a datum (plural “datums” in this standard, since “data” is often misleading). In addition
to an ordinary (bare) interval, this level defines a decorated interval, comprising a bare interval and
a decoration. Decorations implement the P1788 exception handling mechanism.
 Level 3 (Representation of interval data) defines the representation of interval datums in terms of underlying floating
point datums. A level 3 entity is an interval object.
 Level 4 (Bit strings) is concerned with the encoding of interval objects. A level 4 entity is a bit
string, though it may be broken into noncontiguous parts in memory.
I think that it is quite natural to structure our "checker" in the same way.
 Level 1 checks input and outputs that are mathematical intervals with real bounds.
 Level 2 checks inputs and outputs that are intervals with binary or decimal floatingpoint bounds. Intervals at this level are decorated with attribute bits. Checker predicates of level 2 are defined using checker predicates of level 1
 Level 3 checks pairs of floatingpoint numbers together with decoration. Predicates of level 3 use checker predicates of level
 Level 4 checks bit string. Predicates of level 4 use predicates of level3
At this message I consider how to express level 1 checks as Scala prdicates. Instead of intervals with real bounds we shall consider intervals with Rational bounds. First let us define what is Interval at Mathematical model levelclass MathInterval {}
case object Empty extends MathInterval {}
case class Nonnempty(inf: Rational, sup: Rational) extends MathInterval {}
The predicate isValiddef isValid(x: MathInterval): Boolean = x match {
case Empty => true
case Nonemptu(inf, sup) => inf < sup 
inf == sup && inf != Rational.NEGATIVE_INFINITY && sup != Rational.POSITIVE_INFINITY
}
We define isSubset predicatedef isSubset(x: MathInterval, y: MathInterval): Boolean = isValid(x) && isValid(y) && x match {
case Empty => true
case Nonempty(xi,xs) => y match {
case Empty => false
case Nonempty(yi,ys) => yi <= xi && xs <= ys
}
}
The predicate addShall def addShall(x: MathInterval; y: MathInterval; r: MathInterval): Boolean = isValid(x) and isValid(y) && isValid(r) && x match {
case Empty => true
case Nonempty(xi, xs) => y match {
case Empty => true
case Nonempty(yi, ys) => isSubset(Nonempty(xi + yi, xs + ys), r)
}
}
The predicate sqrtShall def sqrtShall(x: MathInterval, r: MathInterval): Boolean = isValid(x) && isValid(r) && r match {
case Empty => true
case Nonempty(xi, xs) && xs < 0 => true
case Nonempty(xi,xs) && xs >= 0 => r match {
case Empty => false
case Nonempty(ri,rs) => (ri <= 0  xi >= ri*ri) && xs <= rs*rs
}
}
