Predicate Logic and relational databases
- First order forumals can be used to express queries about relational
- Consider the database of a library, with information about books,
subscribers, and books that have been borrowed.
. Each book is a
- We know how to write a truth table for any formula, but can we find a
formula for any truth table?
. A literal is a P.F. that consist only of a P.V. or the negation of a P.V.
. A minterm is a formula that is literal, or a conjunctio
NFSA Acceptance Question
Example : Now consider we have the following NFSA which accepts the
language denoted by (010+01)^*1^*. (not that this is different from the
one we obtained at the end of last example).
- set of states: Q=cfw_a,b,c,d
- accepting st
- Is a variation of DFSA. From each state, for an input symbol, say a,
there may be more than one state that it may go. There is no
restrictions on the choice of next state, if there are any.
- It may even change state without rea
Example 1: We want to define the E set of well-formed, fully parenthesised
algebraic expressions involving variables x, y, and z, and
operations +, -, *, and :
(As an example, (x + y)* z) should be in the set while y(:z)+ should not)
. Here is the definit
- Induction can be used to define things, such as functions, sets, etc.
- Inductive definitions of functions yield easy recursive programs.
Example 1: Let f:N -> N be the following function:
if n = 0
f(n) = <
\ f(n - 1) + 2n - 1 if n > 0
Omega and O: Lower bounds vs. upper bounds:
- Recall T(n) = maximum running time of an algorithm over all inputs of
size n, so proving asymptotic bounds on T(n) requires care.
- To prove upper bound (i.e., T(n) is O(f(n), must show that there
It is a generalization of propositional logic; involves predicates.
- Example: sentences "if it rains, Joe/Mary/Peter brings his/her umbrella"
can be represented using unrelated prop. variables r, u, v, w, but
notation is easie
- Substitution of equals:
. If A LEQV B and C' obtained from C by replacing some occurrences
of A by B, then C' LEQV C.
(Similar to algebra: e.g., x = y means x^2 + x = y^2 + x.)
Example: p -> q LEQV ~p \/ q so r \/ (p -> q) LEQV r \/ ~p \/ q.
Proofs by Induction ("ordinary" induction or "simple" induction):
- To prove statements of the form "for all n >= x, S(n)" ,
where S(n) represents some statement about the number n, proceed in steps:
. Base case: prove S(x) is true. Often (but not always)
Prenex normal form
- A first-order formula is in Prenex Normal Form (PNF) iff all its
quantifiers appear at the begining of it: Q1 x1 Q2 x2 . Qk xk E
(each Qi is either forall or exits and E is a quantifier-free
Example: forall x exis