Discrete Structures
Lecture Notes, 17 Nov 2010
Last Update: 17 November 2010
Note:
or
material is highlighted
|
Note: A username and password may be required to access certain
documents.
Please
contact
Bill Rapaport.
Index to all lecture notes
…Previous lecture
§4.3: Recursive Definitions (cont'd)
- Given Peano's axioms & the recursive definition of "+", we can
add;
can we also multiply?
- Recursive definition of "*":
- base case:
- recursive case:
m * S(n) =def (m * n) + m
- Notes:
- The recursive case could also be written:
m * (n+1) =def (m*n) + m
which makes it look like the distributive law
- If both + and * are thought of as functions
that take ordered pairs of natural numbers as I/P,
then + returns the first element
and * returns the second element
when the second element = 0
- * is defined in terms of 0, S, and +;
+ was defined in terms of 0 & S;
0 & S were defined by Peano's axioms;
Peano's axioms were expressed in terms of FOL & set theory.
- E.g.)
- We can also define predicates & relations recursively:
- The predicate "is divisible by 3" can be defined
recursively as follows:
Notation: "3|n" for: 3 divides n (i.e., n is divisible by 3)
(where "divides" and "is divisible by" mean
"evenly divisible with no
remainder")
- Base Case:
(∀n ≤ 9)[3|n ↔ n ∈ {0,3,6,9}]
- i.e., there are 4 base cases!
- Recursive Case:
(∀n > 9)[3|n ↔ 3|(sum of digits of n)]
- E.g.)
3|975?
3|975 ↔ 3|(9+7+5), by rec case, because 975 > 9
↔ 3|21, by arithmetic
↔ 3|(2+1), by rec case, because 21 > 9
↔ 3|3, by arithmetic
But 3|3 is true, by base case
∴ 3|975 (in fact, 975/3=325)
- E.g.)
3|325?
3/325 ↔ 3|(3+2+5) ↔ 3|10 ↔ 3|1+0 ↔ 3|1
But ¬(3|1), by base case
∴ ¬(3|325) (in fact 325/3=108, remainder = 1)
- Recursion is the heart of CS!
- Church-Turing Thesis:
A function is "computable" iff it can be expressed recursively
- See my
"What Is Computation?"
- Other things—like set and "strings"
(sequences of symbols)—
can also be defined recursively;
see "A Recursive Definition of Strings"
- And here's a recursive definition of WFF of FOL:
- Recursive Def of "Term" of FOL:
- Base Case:
Any variable is a term.
Any constant is a term.
- Recursive Case:
Let t1, …, tn be terms.
Let f be an n-place function symbol.
Then f(t1, …, tn) is a term.
- Recursive Def of "WFF" of FOL:
- Base Case:
Let P be an n-place predicate.
Let t1, …, tn be terms.
Then the "string" P(t1, …, tn) is
a(n atomic) well-formed formula (WFF) of FOL.
- Recursive Case:
Let A,B be WFFs of FOL.
Let v be a variable.
Then:
- ¬A
- (A ∨ B)
- (A ∧ B)
- (A → B)
- (A ↔ B)
- ∀vA
- ∃vA
are (molecular) WFFs of FOL
- Closure clause: Nothing else is a WFF of FOL
- Let A be a WFF of FOL.
Then A is a proposition =def A has no free variables.
And A is a propositional function =def A has a free variable.
- E.g.)
- If "+" is a function symbol for the addition function,
then +(x,y) is a term,
by the recursive case of the definition of
"term".
- For convenience, we can write it as "x+y", instead.
- If "Odd" is a predicate, then Odd(x+y) is a WF propositional
function,
by the base case of the def of WFF.
- But Even(Odd(x)+Odd(y)) is not WF!
- Because the base case only allows a term to
be the argument of a predicate!
- P(a,b), where a,b are constants, is a WF proposition,
by the base case
- Q(c), where c is a constant, is a WF proposition
by the base case
- P(x,y), where x,y are variables, is a WF propositional
function, by the base case
- ¬P(a,b) is a WF proposition by rec case (i)
& the base
case
- ¬Q(c) is a WF proposition by rec case (i) & the base case
- (P(a,b) ∨ ¬Q(c)) is a WF proposition by rec case (ii),
because each of the constitutent WFFs is WF,
the first one by the base
case,
and the second one by rec case (ii) (& the base case)
- ((P(a,b) ∨ ¬Q(c)) → ¬P(a,b)) is a WF
proposition
by rec
case (iv),
because each of the constituent WFFs is WF,
the first one
(i.e., the antecedent) by the previous example
and the second one (i.e.,
the consequent) by the third example
- ∀x((P(a,b) ∨ ¬Q(c)) → ¬P(a,b)) is a WF
proposition
by rec case (vi),
because the scope of the quantifier is
WF by the previous example.
- Notes:
- This way of doing things doesn't require brackets
in the
recursive definition of quantified propositions
- The quantifier's variable, x, is "vacuous":
- It doesn't appear in the scope.
- This is odd, but legitimate.
- Here's a real example: ∀x[2+2=4]
- This says: For all things x in the domain, 2+2=4.
That's true of anything in any domain!
- ∃xP(x), where x is a variable, is WF by rec case (vii),
because P(x) is a WF propositional function by the base case.
-
- Question:
- "⊕" is the symbol for exclusive disjunction.
Let A,B be WFFs of FOL.
Is (A ⊕ B) a WFF of FOL?
- Answer:
- Not according to the above definition.
- But surely it "should be" considered as a WFF of FOL, right?
- Here's how we can use it without changing the definition
of WFF:
- We can define the symbol "⊕" as follows:
Let A,B be any 2 WFFs of FOL.
Then let (A ⊕ B) be an abbreviation for:
- In other words,
any time that we use (A ⊕ B),
we would just be being lazy,
and we should really write out the full definition,
which is a WFF of FOL.
§§7.1–7.2: Recurrence Relations
- Recursive Def (of a sequence {an}):
Let ai be terms of the sequence.
Let Ci be constants.
Let h be a function.
Base Cases (or: Initial Conditions):
Recursive Case (or: Recurrence Relation):
-
-
Normally, an = f(n) "explicitly";
i.e.)
the nth term of the sequence would be defined directly in terms of
n
- Questions:
-
What's the relation between f & h?
- Can we compute f, given h?
Next lecture…
Text copyright © 2010 by William J. Rapaport
(rapaport@buffalo.edu)
Cartoon links and screen-captures appear here for your enjoyment.
They are not meant to infringe on any copyrights held by the creators.
For more information on any cartoon, click on it, or contact me.
http://www.cse.buffalo.edu/~rapaport/191/F10/lecturenotes-20101117.html-20101117