Partial vs. Total Recursive Functions

Graduate Depth 59 in the knowledge graph I know this Set as goal
Unlocks 2 downstream topics
recursion partial-functions computability

Core Idea

Partial recursive functions (computable by Turing machines) may not halt on all inputs, while total recursive functions halt on every input. Not all computable functions are total: the halting problem shows no total recursive function can predict if an arbitrary program halts. This gap between partial and total computability is foundational to undecidability.

How It's Best Learned

Write examples of partial functions (e.g., integer division when denominator is computed) and total functions, then study the proof that some total functions are not computable.

Common Misconceptions

Explainer

You have already studied general recursive (µ-recursive) functions, which extend primitive recursion with the minimization operator µ. The µ-operator searches for the least input satisfying a predicate — and it may search forever if no such input exists. This possibility of non-termination is precisely what introduces partiality: a partial recursive function is one that may be undefined on some inputs (meaning a Turing machine computing it diverges on those inputs). A total recursive function, by contrast, halts and returns a value on every input without exception.

Partiality is not a defect in the theory; it is an unavoidable feature of any sufficiently powerful computational model. Any system capable of simulating other programs — including Turing machines — will inevitably contain programs that loop forever on some inputs. You cannot excise all non-terminating programs while preserving the same expressive power. More precisely, the set of total recursive functions is not recursively enumerable: there is no algorithm that, given a program description, decides whether that program is total.

This asymmetry is the crux of the halting problem's undecidability, which you will explore next. If totality were decidable, you could decide halting: to ask whether M halts on w, build a new function f that, on any input, simulates M on w and outputs 0 if M halts — then ask whether f is total. Since halting is undecidable, totality must be undecidable too. The argument works by a diagonalization similar to Cantor's: any hypothetical totality-tester could be used to construct a self-defeating function, producing a contradiction.

The practical lesson is directional: computability and termination are distinct properties that do not imply each other. You can write a partial function that always gives the correct answer whenever it terminates, or a total function that always terminates but cannot solve certain problems at all. The partial recursive functions are exactly the computable functions — those computed by some Turing machine. The total computable functions are a strict subset. The gap between "total recursive" and "all total functions" contains functions that are always defined yet cannot be computed by any algorithm, and understanding that gap is a central project of computability theory.

Practice Questions 5 questions

Prerequisite Chain

Counting to 10Counting to 20Understanding ZeroThe Number ZeroCounting to FiveOne-to-One CorrespondenceCombining Small Groups Within 5Addition Within 10Addition Within 20Two-Digit Addition Without RegroupingTwo-Digit Addition with RegroupingAddition Within 100Repeated Addition as MultiplicationMultiplication Facts Within 100Division as Equal SharingDivision as Grouping (Measurement Division)Division: Grouping (Repeated Subtraction) ModelDivision: Fair Sharing ModelDivision as Equal SharingDivision as GroupingBasic Division FactsDivision Facts Within 100Two-Digit by One-Digit DivisionDivision with RemaindersRemainders and Quotients in DivisionDivision Word ProblemsIntroduction to Long DivisionFactors and MultiplesPrime and Composite NumbersEquivalent FractionsRelating Fractions and DecimalsDecimal Place ValueReading and Writing DecimalsComparing and Ordering DecimalsAdding and Subtracting DecimalsMultiplying DecimalsDividing DecimalsDividing FractionsMixed Number ArithmeticOrder of OperationsInteger Order of OperationsVariable ExpressionsThe Distributive PropertyVariables and Expressions ReviewIntroduction to PolynomialsAdding and Subtracting PolynomialsMultiplying PolynomialsFactorialPermutationsCombinationsCounting Principles: Addition and Multiplication RulesDefining Finite Sets RigorouslyRecursive Definitions on Finite SetsNatural Numbers in Set Theory: Iterative ConstructionFormal Arithmetic and ExpressibilityPrimitive Recursive FunctionsAckermann FunctionGeneral Recursive Functions and the μ-OperatorMu-Recursive FunctionsPartial vs. Total Recursive Functions

Longest path: 60 steps · 328 total prerequisite topics

Prerequisites (2)

Leads To (1)