## 2.5.1 Predicates

In the traffic light example, we have already encountered several predicates: The invariants of a model and the guards of an event. The proof obligations generated by Rodin are also predicates. A predicate is simply an expression, the value of which is either true or false.

The simplest predicates are (ASCII: true) and (ASCII: false). We can also assert if arbitrary objects of the same type are equal with or not equal with (ASCII: /=). Predicates can be combined with the usual logical operators:

 symbol ASCII conjunction (and) & disjunction (or) or implication => equivalence <=> negation (not) not

We can use universal quantification to express a statement that is valid for all possible values a variable might have. The universal quantifier is (ASCII: !). For example, in order to show that any given number greater than zero and multiplied with two is greater than one, we can use the following expression:

When a variable is introduced by a quantifier, the type of the variable must be clear. In this case Rodin can infer that must be of type integer because the operator is defined only on integers. Sometimes the type cannot be inferred, e.g., in

and could be integers, Boolean values or some other type. In this case, we must make the type of the variables explicit by stating that and are elements of the appropriate sets. Let’s use integers again to correct the previous expression:

The conjunction operator () has a stronger binding that the implication , so the above expression is equivalent to

If you are unsure which of the operators bind stronger, we advise you to use parenthesis to avoid mistakes.

Existential quantification on the other hand is used to state that there is an object of a certain type fulfilling a given property. The existential quantifier is (ASCII: #). The following example expression states that there is a Boolean value different from :

As you can see, we again added type information for . We put the type information on the left side of the implication () for the universal quantification , but for existential quantification we add it via a conjunction ().