Truth value assignment (or just truth assignment):
- Gives a value (0 or 1) to each propositional variable.
- Value can be extended to all formulas using those variables through the
truth tables, by working "inside-out" (example).
- A truth assignment "sa
Regular Languages
- We have shown that a language is accepted by a FSA iff there is a R.E. for it.
- A language is called regular iff it is denoted by some R.E., or equivalently,
iff it is accepted by a FSA (deterministic or non-deterministic).
- This pro
Proving Logical Equivalences
Prove or disprove each of the logical equivalences below, without
using truth tables:
a) p -> (q /\ r) LEQV (p -> q) /\ (p -> r)
answer: p -> (q /\ r)
LEQV ~p \/ (q /\ r)
(-> law)
LEQV (~p \/ q) /\ (~p \/ r)
(distributivity of
Propositional Logic
Notation for expressing concepts precisely, and formalism for reasoning.
"Propositions" are statements, which are either true or false,
as opposed to other kinds of English sentences (e.g., commands, questions).
Example: "David works h
Propositional Formulas:
- Let PV be a set of propositional variables. The set of propositional formulas
PF is the smallest set such that:
. any variable in PV is in PF.
. if p1 and p2 are in PF then so do the following expressions: ~p1, (p1 /\ p2),
(p1 \/
Structures, valuations, interpretations:
- A "structure" S for a first-order language L consists of:
. a domain D (nonempty)
. for each constant symbol c of L, an element c^S of D
. for each n-ary predicate symbol A of L, a relation A^S over D^n
. if L co
Termination Questions
Termination: Let E = l + 1 - i. E is definitely an integer because l and i
are both integers. Sine f <= l by the precondition: E_0 = l + 1 - i_0 =
l + 1 - f >= 1, and since i_k <= l at the begining of each iteration of the
loop, i_cf
RecBinSearch. Recurrence for worst-case running time of
RecBinSearch is:
cfw_4
if n = 1
T(n) = cfw_
cfw_ 7 + max cfw_ T(ceil(n/2), T(floor(n/2) + 1 if n > 1
1. Repeated substitutions. Since this is used only to get a guess, we
are allowed to make simplif
Regular Expressions
- Regular expressions describe sets of strings using a small number of
basic operations.
- The set of regular expressions (regexps) over an alphabet S is defined
as follows, assuming that S does not contain symbols "cfw_" and "e":
. cf
Test Preparation Questions
1- Let L be the set of strings over cfw_0,1 that contain both 01 and 10
as substrings.
(a) Daw the diagram of a DFSA that accepts L
(b) Give a regular expression that denotes L.
Answer: for part (a) one way is to have q0 -0-> q1
Example 2: Prove that for any natural numbers n >= 1, if x is a real
number such that 1 + x > 0 then (1 + x)^n >= 1+nx.
. S(n) can be defined as "if x is a real number and 1 + x > 0 then
(1 + x)^n >= 1 + nx".
. We want to prove S(n), for all n >= 1. (Note