Go backward to A.3 Explicit Function Definitions Go up to A Defining New Notions Go forward to A.5 Recursive Definitions |
Let f(x0, ..., xn-1) be a y such that F.
However, this is just another way of writing an explicit definition
f(x0, ..., xn-1) := such y: Fwhere (such y: F) is a term in which f does not occur and with no other free variables than x0, ..., xn-1 (y is bound).
(such x: F)is a term with bound variable x.
The value of this term is some x such that F holds (if such an x exists). We omit the parentheses if F is clear.
Frequently, we write
such x in S: Fto denote such x: x in S /\ F.
Reasoning When reasoning about implicitly defined objects with have to take special care because the definition may be inconsistent (i.e., no object with the denoted property exists) or not unique (multiple objects satisfy the property).
All that we actually have is the knowledge
i.e., if an object with property F exists, then the object denoted by the "such term" satisfies F as well.
(exists x: F) => (forall x: x = (such x: F) => F),
Consequently, we have for a function definition
f(x0, ..., xn-1) := such y: Fthe knowledge
i.e., for any tuple of function arguments the result value satisfies F, provided that such a value indeed exists.
(forall x0, ..., xn-1: (exists y: F) => (forall y: y = f(x0, ..., xn-1) => F)),
Therefore, for given x0, ..., xn-1, we first have to prove
exists y: F.before we may assume that, for every y = f(x0, ..., xn-1), F holds.
x/y := such q: q*y = x.Then 12/4 = 3 because 3*4 = 12.
Take a := 1/0. We must not assume that a*0 = 1, because we cannot prove exists q: q*0 = 1.
Such Terms and Predicates An alternative to defining a function
is always to define a predicate
f(x) := such y: F
Apparently, we then have the relationship
p(x, y) : <=> F.
However, it may be easier to understand (and to reason about) statements that are formulated with the help of the predicate than with the corresponding "such" term: for every formula G, the statement
f(x) := such y: p(x, y).
is equivalent to
G[y <- f(x)]
which may be preferrable in some situations.
(forall y: p(x, y) => G)
We then wish to state that, for all sequences s and t,
lim(s) := such a: s converges to a.
where, for every i in N, (s+t)i = si + ti.
lim(s+t) = lim(s)+lim(t)
Inserting the definition of "lim" gives us the statement
which is rather difficult to prove.
(such a: s+t converges to a) = (such b: s converges to b) + (such c: t converges to c)
However, above statement can be also formulated as
which is much more amenable to a formal proof.
forall a, b, c: (s+t converges to a /\ s converges to b /\ t converges to c) => a = b+c.
As the previous example shows, it may be advisable to "switch" from the formulation of a statement with "such terms" to a statement with corresponding predicates to understand the subtleties of the statement.
Logic Evaluator We have a restricted form of the "such" quantifier that allows to express the value of the term (such x in S: F) as
In general, the quantifier binds multiple variables x0, ..., xn-1 and returns a value of term T where F holds:such(x in S: F, x)
The value of this term can be expressed by the standard quantifier assuch(x_0 in~ T_0, ..., x_n-1 in~ T_n-1: F, T)
where t is a variable that does not occur in T and F.
(let t = such t that (exists x0 in T0, ..., xn-1 in Tn-1: t=<x0, ..., xn-1> /\ F) x0 = t0, ... xn-1 = tn-1: T)
Operational Interpretation A such
expression is an
instance of the Java class shown below.
public final class SuchThat implements Term { private String variable; private Term domain; private Formula formula; private Term term; public SuchThat(String _variable, Term _domain, Formula _formula, Term _term) { variable = _variable; domain = _domain; formula = _formula; term = _term; } public Value eval() throws EvalException { Iterator iterator = Model.iterator(domain); while (iterator.hasNext()) { Value result = null; Context.begin(variable, iterator.next()); if (formula.eval()) result = term.eval(); Context.end(); if (result != null) return result; } throw new EvalException("no such value"); } }
The Java expression (new SuchThat(x, d, F,
T)).eval()
computes the value of let x = (such x
in d: F): T. As one can see, we iterate over
d and establish new contexts in which x is assigned each value
of the domain in turn. In each context, we evaluate F. If the formula
is true, we evaluate T and return its value.
Unique Implicit Function Definitions The "such quanifier" does not necessarily determine a unique value, consequently an implicit function definition not always determines a function uniquely.
Let f(x) be a y such that y | x.or, in other words,
f(x) := such y: y | xwhere | denotes the predicate "divides". Then all we know is that f(12) | 12 (because exists y: y | 12), and consequently f(12) in {1, 2, 3, 4, 6, 12}.
Frequently, however an implicit definition is given in the form
let f(x0, ..., xn-1) be the y such that Fwhich implies that there exists at most one y that satisfies F for given x0, ..., xn-1.
This is equivalent to stating, in addition to
also the condition (which has to be proved)
f(x0, ..., xn-1) := such y: F,
(forall x0, ..., xn-1, y: F => y = f(x0, ..., xn-1)).
Let f(x) be the y such that y | x.because from 6|12 we must not conclude f(12) = 6.
However, we may define
Let x/y be the q such that q*y = x.Since 3*4=12, we may conclude 12/4 = 3.