Last updated

# Logical operators

## >

pact
``(> x y)``
pact
``(> x y)``
• takes `x`: a
• takes `y`: a
• produces `bool`
• where a is of type `integer` or `decimal`

True if `x` > `y`

Supported in either invariants or properties.

## <

pact
``(< x y)``
pact
``(< x y)``
• takes `x`: a
• takes `y`: a
• produces `bool`
• where a is of type `integer` or `decimal`

True if `x` < `y`

Supported in either invariants or properties.

## >=

pact
``(>= x y)``
pact
``(>= x y)``
• takes `x`: a
• takes `y`: a
• produces `bool`
• where a is of type `integer` or `decimal`

True if `x` >= `y`

Supported in either invariants or properties.

## <=

pact
``(<= x y)``
pact
``(<= x y)``
• takes `x`: a
• takes `y`: a
• produces `bool`
• where a is of type `integer` or `decimal`

True if `x` <= `y`

Supported in either invariants or properties.

## =

pact
``(= x y)``
pact
``(= x y)``
• takes `x`: a
• takes `y`: a
• produces `bool`
• where a is of type `integer`, `decimal`, `string`, `time`, `bool`, `object`, or `keyset`

True if `x` = `y`

Supported in either invariants or properties.

### !=

pact
``(!= x y)``
pact
``(!= x y)``
• takes `x`: a
• takes `y`: a
• produces `bool`
• where a is of type `integer`, `decimal`, `string`, `time`, `bool`, `object`, or `keyset`

True if `x` != `y`

Supported in either invariants or properties.

## and

pact
``(and x y)``
pact
``(and x y)``
• takes `x`: `bool`
• takes `y`: `bool`
• produces `bool`

Short-circuiting logical conjunction

Supported in either invariants or properties.

## or

pact
``(or x y)``
pact
``(or x y)``
• takes `x`: `bool`
• takes `y`: `bool`
• produces `bool`

Short-circuiting logical disjunction

Supported in either invariants or properties.

## not

pact
``(not x)``
pact
``(not x)``
• takes `x`: `bool`
• produces `bool`

Logical negation

Supported in either invariants or properties.

## when

pact
``(when x y)``
pact
``(when x y)``
• takes `x`: `bool`
• takes `y`: `bool`
• produces `bool`

Logical implication. Equivalent to `(or (not x) y)`.

Supported in either invariants or properties.

## and?

pact
``(and? f g a)``
pact
``(and? f g a)``
• takes `f`: a -> `bool`
• takes `g`: a -> `bool`
• takes `a`: a
• produces `bool`

`and` the results of applying both `f` and `g` to `a`

Supported in either invariants or properties.

## or?

pact
``(or? f g a)``
pact
``(or? f g a)``
• takes `f`: a -> `bool`
• takes `g`: a -> `bool`
• takes `a`: a
• produces `bool`

`or` the results of applying both `f` and `g` to `a`

Supported in either invariants or properties.

## hash

pact
``(hash s)``
pact
``(hash s)``
• takes `s`: `bool`
• produces `string`

BLAKE2b 256-bit hash of bool values

Supported in properties only.