The usual boolean operators
(or
(not
(=>
Where
(define q::bool)
(define r::bool)
(theorem simple1 (=> (and (=> p q) (=> q r)) (=> p r)))
(theorem simple2 (=> (not (or p q)) (and (not p) (not q))))
Equations (=) and disequations (/=) between expressions are written using the following notation.
(/=
In Yices, there is no distinction between formulas and terms. So, so equations and disequations can be used to express bi-implication and exclusive-or. Examples:
(theorem simple1 (or (= x 0) (= x 1) (= x 2)))
(define y::(subrange 0 1))
(define z::(subrange 0 1))
(define w::(subrange 0 1))
(theorem simple2 (not (and (/= y z) (/= y w) (/= z w))))
(define p::bool)
(theorem simple3 (= p p))
Conditional expressions have the following equivalent forms:
(ite
where
(define y::real)
(theorem simple (>= (if (>= x y) x y) x))
Parallel local aliases can be made using
where n is at least 1, and each
Examples:
(define f::(-> int int))
(define g::(-> int int int))
(define y::int (let ((aux::int (f (f x)))) (g aux aux)))
Quantified expressions are introduced with the keywords
(exists (
Arithmetic inequalities between reals and integers are written using
(define y::int)
(theorem simple (or (< x y) (> x y) (= x y)))
The symbols
(define y::int)
(theorem simple (=> (and (= (+ x (* 2 y)) 5) (>= x 1)) (<= y 2)))
The application of a function
Notice that
(define x::int)
(define y::int ((f x) x))
(define g::(-> int int int))
(define w::int (g x y))
Functions can be functionally updated using the
The update expression is semantically equivalent to:
Example:
(define f2::(-> int int))
(define i1::int)
(define i2::int)
(define v1::int)
(define v2::int)
(define v3::int)
(define a1::bool (/= v1 v2))
(define a2::bool (/= i1 i2))
(define a3::bool (= (update f1 (i1) v1) (update (update f2 (i1) v2) (i2) v3)))
(theorem main (not (and a1 a2 a3)))
Lambda expressions denote unnamed functions. They have the following form:
For example, the function which adds 3 to an integer may be written:
Tuples are of the form:
where n is at least 2 and
(define x::int (select t 1))
(define y::int (select t 2))
Tuples can be functionally updated using the
Example:
(define t2::(tuple int int int) (update t1 2 100))
Records are of the form:
where n is at least 1,
(define a::int (select r x))
(define b::int (select r y))
Records can be functionally updated using the
Example:
(define r2::(record x::int y::int) (update r1 x 100)