General recursive function: Difference between revisions

Content deleted Content added
Add reference to article on computable functions
m Examples: \operatorname
Line 49:
The following examples are intended just to demonstrate the use of the minimization operator; they could also be defined without it, albeit in a more complicated way, since they are all primitive recursive.
{{unordered list
|The [[integer square root]] of <math>{{mvar|x</math>}} can be defined as the least <math>{{mvar|z</math>}} such that <math>(z+1)^2 > x</math>. Using the minimization operator, a general recursive definition is <math>\operatorname{Isqrt} = \mu(\operatorname{Not} \circ \operatorname{Gt} \circ (\operatorname{Mul} \circ (S \circ P_1^2,S \circ P_1^2), P_2^2))</math>, where <{{math>|Not</math>}}, <{{math>|Gt</math>}}, and <{{math>|Mul</math>}} are logical negation, greater-than, and multiplication,<ref>defined in [[Primitive recursive function#Junctors]], [[Primitive recursive function#Equality predicate]], and [[Primitive recursive function#Multiplication]]</ref> respectively. In fact, <math>(\operatorname{Not} \circ \operatorname{Gt} \circ (\operatorname{Mul} \circ (S \circ P_1^2,S \circ P_1^2), P_2^2)) \; (z,x) = (\lnot S(z)*S(z) > x)</math> is <math>{{mvar|0</math>}} if, and only if, <math>S(z)*S(z) > x</math> holds. Hence <math>\operatorname{Isqrt}(x)</math> is the least <math>{{mvar|z</math>}} such that <math>S(z)*S(z) > x</math> holds. The negation junctor <{{math>|Not</math>}} is needed since <{{math>|Gt</math>}} encodes truth by <math>{{val|1</math>}}, while <math>\{{mvar|&mu</math>;}} seeks for <math>{{val|0</math>}}.
}}
The following examples define general recursive functions that are not primitive recursive; hence they cannot avoid using the minimization operator.