definition:
|
pred :: Nat -> Nat
pred IHi = failed -- 1 has no predecessor
pred (O IHi) = IHi -- 2 - 1 = 1
pred (O x@(O _)) = I (pred x) -- 2*2*n - 1 = 2*(2*n-1) + 1
pred (O (I x)) = I (O x) -- 2*(2*n + 1) - 1 = 2*2*n + 1
pred (I x) = O x -- 2*n + 1 -1 = 2*n
|
demand:
|
argument 1
|
deterministic:
|
deterministic operation
|
documentation:
|
--- Predecessor, O(n)
|
failfree:
|
{I,O}
|
indeterministic:
|
referentially transparent operation
|
infix:
|
no fixity defined
|
iotype:
|
{({O}) |-> {I,IHi} || ({I}) |-> {O}}
|
name:
|
pred
|
precedence:
|
no precedence defined
|
result-values:
|
{I,IHi,O}
|
signature:
|
Nat -> Nat
|
solution-complete:
|
operation might suspend on free variables
|
terminating:
|
yes
|
totally-defined:
|
possibly non-reducible on same data term
|