Arithmetic

Naturals

The most basic type of number in Vehicle are the natural numbers. The type of natural numbers is written as Nat.

The available operations over naturals are:

Operation

Syntax

Type

Support

Add

x + y

Nat Nat Nat

All backends fully supported

Multiply

x * y

Nat Nat Nat

All backends fully supported

Divide

x / y

Nat Nat Real

All backends fully supported

Compare

x < y
x > y
x <= y
x >= y
x == y
x != y

Nat Nat Bool

All backends fully supported

Note that inequalities can be chained, so that x < y <= z will be expanded to x < y and y <= z.

Reals

The type of real numbers is written as Real.

The available operations over reals are:

Operation

Syntax

Type

Support

Add

x + y

Real Real Real

All backends fully supported

Subtract

x - y

Real Real Real

All backends fully supported

Multiply

x * y

Real Real Real

Training fully supported
Verification partially supported ()
Agda fully supported
Rocq fully supported
Imandra fully supported
Isabelle fully supported

Divide

x / y

Real Real Real

Training fully supported
Verification partially supported ()
Agda fully supported
Rocq fully supported
Imandra fully supported
Isabelle fully supported

Negation

- y

Real Real

All backends fully supported

Compare

x < y
x > y
x <= y
x >= y
x == y
x != y

Real Real Bool

All backends fully supported

Min

min x y

Real Real Real

All backends fully supported

Max

max x y

Real Real Real

All backends fully supported

Infinity

infinity

Real

Training fully supported
Verification not supported but easy to add
Agda not supported but easy to add
Rocq not supported but easy to add
Imandra not supported but easy to add
Isabelle not supported but easy to add

Note

We are aware that the disconnect between the semantics of real numbers and floating point can lead to soundness bugs in verification. Adding floating point types with configurable precision is on our road map.