forked from regb/scala-smtlib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Reals.scala
51 lines (41 loc) · 1.41 KB
/
Reals.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package smtlib
package theories
import trees.Terms._
import Operations._
object Reals {
/*
* TODO: how about providing a Rational constructor? maybe it should go in Constructors?
*/
object RealSort {
def apply(): Sort = {
Sort(Identifier(SSymbol("Real")))
}
def unapply(sort: Sort): Boolean = sort match {
case Sort(Identifier(SSymbol("Real"), Seq()), Seq()) => true
case _ => false
}
}
object NumeralLit {
def apply(value: BigInt): Term = SNumeral(value)
def unapply(term: Term): Option[BigInt] = term match {
case SNumeral(value) => Some(value)
case _ => None
}
}
object DecimalLit {
def apply(value: BigDecimal): Term = SDecimal(value)
def unapply(term: Term): Option[BigDecimal] = term match {
case SDecimal(value) => Some(value)
case _ => None
}
}
object Neg extends Operation1 { override val name = "-" }
object Add extends Operation2 { override val name = "+" }
object Sub extends Operation2 { override val name = "-" }
object Mul extends Operation2 { override val name = "*" }
object Div extends Operation2 { override val name = "/" }
object LessThan extends Operation2 { override val name = "<" }
object LessEquals extends Operation2 { override val name = "<=" }
object GreaterThan extends Operation2 { override val name = ">" }
object GreaterEquals extends Operation2 { override val name = ">=" }
}