ShotDs.Stt.Booleans (shot_ds v1.0.0)

Copy Markdown View Source

Church's encoding of Booleans in simple type theory (STT).

Church defines Booleans as lambda-abstractions which take a value for truth and a value for falsity. Conversely, the term denoting truth (tt) projects the first value, the term for falsity (ff) projects the second.

Note

Some standard encodings like if-then-else are only definable as parameterized family of terms in STT, not as polymorphic statements.

Summary

Functions

Returns the simple type of an encoded Boolean, i.e. $\iota\to\iota\to\iota$.

Generates a variable term with the given name corresponding to a Church Boolean.

Operators

Generates the Church Boolean corresponding to the logical conjunction of the Boolean terms associated with the given IDs.

Generates the Church Boolean corresponding to the negation of the Boolean term associated with the given ID.

Generates the Church boolean corresponding to the logical disjunction of the Boolean terms associated with the given IDs.

Values

Returns the ID of the term corresponding to the Boolean value false.

Returns the ID of the term corresponding to the Boolean value true.

Functions

b_type()

@spec b_type() :: ShotDs.Data.Type.t()

Returns the simple type of an encoded Boolean, i.e. $\iota\to\iota\to\iota$.

b_var(name)

Generates a variable term with the given name corresponding to a Church Boolean.

Operators

b_and(p, q)

Generates the Church Boolean corresponding to the logical conjunction of the Boolean terms associated with the given IDs.

$$ \mathtt{b\_and} := \lambda PQAB.\text{ }P\text{ }(Q\text{ }A\text{ }B)\text{ }B $$

b_not(p)

Generates the Church Boolean corresponding to the negation of the Boolean term associated with the given ID.

$$ \mathtt{b\_not} := \lambda PAB.\text{ }P\text{ }B\text{ }A $$

b_or(p, q)

Generates the Church boolean corresponding to the logical disjunction of the Boolean terms associated with the given IDs.

$$ \mathtt{b\_or} := \lambda PQAB.\text{ }P\text{ }A\text{ }(Q\text{ }A\text{ }B) $$

Values

ff()

@spec ff() :: ShotDs.Data.Term.term_id()

Returns the ID of the term corresponding to the Boolean value false.

$$ \mathtt{ff} := \lambda AB.\text{ }B $$

tt()

@spec tt() :: ShotDs.Data.Term.term_id()

Returns the ID of the term corresponding to the Boolean value true.

$$ \mathtt{tt} := \lambda AB.\text{ }A $$