Predicate Logic and relational databases
- First order forumals can be used to express queries about relational
databases.
- Consider the database of a library, with information about books,
subscribe
Normal forms:
- We know how to write a truth table for any formula, but can we find a
formula for any truth table?
- Def:
. A literal is a P.F. that consist only of a P.V. or the negation of a P.V.
.
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
Non-deterministic F.S.A.
- 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, i
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
Induction
- 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:
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 (
Predicate Logic
It is a generalization of propositional logic; involves predicates.
Predicates:
- Example: sentences "if it rains, Joe/Mary/Peter brings his/her umbrella"
can be represented using unre
- 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
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:
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 quan