Skip to content

The Standard Library

delehef edited this page Jun 11, 2023 · 12 revisions

The Standard Library

Corset comes with a standard library, that provides functions commonly used in the writing of constraints.

Chronological Functions

Chronological functions peeks into the past or future values of columns or expressions, allowing the writing of constraints describing to the temporal evolution of the system rather than its instantaneous state.

Access Functions

Access functions fetch the value of a column at a different row than the currently evaluated one, and are the primitives used to build all more specialized chronological function.

(shift X n) [(Column{M} int) -> Column{M}]
returns the value of the column X n steps in the past (if n is negative) or the future (if n is positive)
(prev X) [(Column{M} -> Column{M}]
return the value of X one step in the past
(next X) [(Column{M} -> Column{M}]
return the value of X one step in the future

Variation Functions

These functions define constraints to the variation of a column in the temporal dimension.

(did-inc! X offset) [(Column{M} integer) -> 𝕃]
ensures that X increased by offset during the transition between the previous row and the current
(did-dec! X offset) [(Column{M} integer) -> 𝕃]
ensures that X decreased by offset during the transition between the previous row and the current
(will-inc! X offset) [(Column{M} integer) -> 𝕃]
ensures that X will increase by offset during the transition between the current row and the next one
(will-dec! X offset) [(Column{M} integer) -> 𝕃]
ensures that X will decrease by offset during the transition between the current row and the next one
(remained-constant! X) [(Column{M}) -> 𝕃]
ensures that X has not changed its value between the previous row and the current one
(will-remain-constant! X) [(Column{M}) -> 𝕃]
ensures that X will not change its value between the current row and the next one
Clone this wiki locally