constructive mathematics, realizability, computability
propositions as types, proofs as programs, computational trinitarianism
Broadly speaking nondeterministic computations/algorithms are those whose outcome is indefinite, or else dependent on parameters that are not known or specified when the computation/algorithm is laid out (they may become known at “runtime”).
Beware that in complexity theory, at least, by a “non-determinstic algorithm” one really refers instead (or more specifically) to the shortest path that a non-deterministic machine could potentially take to arrive at a desired result (cf. the NIST entry). This is the sense in which “non-determinism” appears for instance in the name of the complexity class “NP” .
(…)
A basic programming language-model of non-determinism is via dependence of a program on an unspecified parameter , whose value is indefinite but imagined to become known at execution time – say via user input, or by observing the actual value of a random variable in an experiment and/or by making a measurement of a stochastic process or a quantum measurement of a quantum state (see below).
In this model, a non-deterministic program taking input data of data type and producing output data of nominal type would be an actual (determinstic) program of the form
whose de facto output data type is not but the function type . This means that the -result of computing for any remains “un-determined” or “indefinite” unless and until a parameter is somehow chosen (say “randomly”, “experimentally” or in whichever way), in which case only we obtain definite data .
It makes sense to say that the data type
exhibits a “-indefinitess effect” that goes along with the execution of the program, making its output indefinite. Such side effects in computing may be modeled by monads in computer science (see there for more). Indeed is a classical example of such a monad, often called the -reader monad, reflecting the idea that it postpones returning definite output data until it has “read in” an otherwise unspecified parameter.
Incidentally, in terms of modal logic the parameter type plays the role of the set of “possible worlds” in which the given non-deterministic computation may take definite values. For more on this modal logic perspective see at necessity and possibility the section relation to potentiality.
Now the monad-structure on allows to carry along this indefiniteness effect so that followup programs, nominally waiting for input data in , are consistently treated as non-deterministic, dependent on specification of , too.
Concretely, if
and
are two such non-deterministic programs but conditioned on the same global random variable , then their consistent composition, as such, is their Kleisli composition (which involves the categorical multiplication-operation in the reader monad, see there for details):
Of course, in general the non-determinism of a program need not be parameterized over a fixed parameter type . If the sequence of parameters is known beforehand, one can form their product type and proceed as above, but in general even that sequence may not be pre-specified and further effect handling besides a fixed reader monad needs to be considered (…).
A fundamental example of non-deterministic computation is quantum computation, where the process of quantum measurement produces outcomes that – to the best knowledge of the current state of fundamental physics – are fundamentally non-deterministic in that there is not even in principle a way to predict a given outcome with certainty (only their probability distribution is fixed by quantum theory).
The possible results of a quantum measurement are indexed by a “measurement basis” which is exactly a (finite) set serving as the parameter type in the modal logic-discussion above. The only difference for quantum computation is that quantum data types are linear types, so that the relevant reader monad here is a linear version of the classical reader monad – see at quantum reader monad for details.
A formulation of (non-deterministic) quantum computation in terms of the resulting -modal linear type theory is discussed at quantum circuits via dependent linear types.
But in fact the quantum reader monad is (for finite ) a Frobenius monad and as such isomorphic (see here) to the “classical structures” Frobenius monad has long been proposed to model quantum measurement in quantum information theory via dagger-compact categories (Coecke & Pavlović (2008))
Something reminiscent of – but different from – non-deterministic computation appears (see the quotes below) in differential linear logic, where the cut-elimination procedure has been argued to “intuitively correspond” to non-determinism:
The differential linear cut rule receives as input a proof of type and returns as output a formal sum of proofs of type . During the procedure, several proofs can be formed to eliminate cuts from the proof in the previous step, these different possibilities are summed and thus the algorithm returns a formal sum of proofs. The nondetermism is here realized by the addition of proofs as formal sums of proofs that can be understood as a disjunction but in not exactly the same way that the linear disjunction because it’s a disjunction of proofs and not of formulas. An algorithm which returns where are two proofs of the same type returns in fact the disjunction of and because it can’t chose between the two possibilities. On the level of the syntactic proof theory, one cannot code this sum only by the intermediate of a biproduct in a semiadditive category, because it would imply that the algorithm would introduce cuts that will not be eliminated: in a semiadditive category, the sum is defined by combining the structural morphisms of the products and coproducts, which are then equal, through composition, ie. through the cut rule. One thus works in a CMon-enriched symmetric monoidal category where we have access to a sum of morphism without necessarily biproducts. In the case where one considers the additive connectors in the logic, the additive disjunction and the additive conjunction are then equated under the presence of formal sums and one can reobtain this formal sum through the biproduct in the semantics. But the semantics is not able to explain the syntactic subtleties related to cut elimination and the difference between a formal sum of two proofs and a sum obtained through cuts and biproducts.
In contradistinction, the cut elimination of linear logic is a deterministic algorithm and doesn’t imply formal sums of proofs. Thus, in linear logic, if one includes the additive disjunction and the additive conjunction, they are not necessarily equated forming a biproduct in the syntax, as in differential linear logic.
From Ehrhard (2008), Introduction:
“when one linearizes a proof obtained by contracting two linear inputs of a proof, one has to choose between these two inputs, and there is no canonical way of doing so: we take the non-deterministic superposition of the two possibilities. Syntactically, this means that one must accept the possibility of adding proofs of the same formula, which is standard in mathematics, but hard to accept as a primitive logical operation on proofs.”
However, Erhardt & Regnier (2009), p. 3 admit that:
“Notice that in our axiomatization of sums in the differential lambda-calculus, the non-deterministic reduction rule will not be valid, but sums will nevertheless intuitively correspond to a version of non-deterministic choice where all the actual choice operations are postponed: the result of a term reduction will in general be a large formal sum of terms, and we can reduce the really ”non-deterministic“ part of the computation to a unique ultimate step consisting in choosing one term of that sum. This step is however a fiction and will not appear as a reduction rule of our calculus”
See also:
Nondeterministic Turing machines:
The notion in complexity theory:
The above treatment of non-deterministic quantum computation via the quantum reader monad is made explicit in
Concerning the quasi-example of cut elimination in differential linear logic:
Last revised on March 16, 2023 at 05:45:39. See the history of this page for a list of all contributions to it.