Discrete Structures: Comprehensive Lecture 6–25 Notes
Predicate Logic (First-Order Logic)
- Predicate / Propositional Function
• Declarative statement with ≥ 1 variable; notation: P(x),Q(x),R(x).
• Returns T or F once all variables receive specific values.
• Example: P(x)=x<5;\ P(1)=T;\ P(10)=F. - Need for Predicates
• Propositional Logic insufficient for statements like “Every CS computer is protected” or “Some students have brown hair.”
• Predicate Logic adds quantification over domains (universes of discourse). - Truth Testing
• Statement categories in slides: proposition? 10+4=14 → Yes; x+2=5 → No (open); quantified versions vary by quantifier.
Quantifiers
- Universal Quantifier ∀xP(x) (“for all x”).
• False iff a counter-example exists.
• Conjunction view: ∀xP(x)≡P(x<em>1)∧…∧P(x</em>n) for finite domains.
• Provide domain every time! - Existential Quantifier ∃xP(x) (“there exists x”).
• True if at least one element satisfies P.
• Disjunction view: ∃xP(x)≡P(x<em>1)∨…∨P(x</em>n).
• Truth/falsehood reversed relative to universal. - Uniqueness Quantifier ∃!xP(x) (“exactly one x”).
- Restricted Domains
• Notation ∀x<0x2>0 means ∀x[(x<0)→(x2>0)].
• Existential restriction \exists z>0\; z^2=2 ≡ \exists z[(z>0)\land(z^2=2)].
Binding & Scope
- Bound variable: inside scope of a quantifier or assigned value.
- Free variable: not bound → expression not a proposition.
- Scope examples illustrated with nested quantifiers; ensure no free variables.
Translation Examples
- “Every student in this class has studied calculus” (domain = people): ∀x[S(x)→C(x)].
- Russian/C++ examples: ∃x(R(x)∧¬C(x)), ∀x(R(x)∨C(x)) etc.
Negating Quantified Statements
- De Morgan for quantifiers: ¬∀xP(x)≡∃x¬P(x); ¬∃xP(x)≡∀x¬P(x).
- Practical phrasing: negate universal by claiming “some counterexample,” negate existential by asserting “none.”
Rules of Inference (Propositional)
- Modus Ponens (p∧(p→q))→q.
- Modus Tollens (¬q∧(p→q))→¬p.
- Addition, Simplification, Conjunction, Disjunctive Syllogism, Hypothetical Syllogism, Resolution — each supplied with tautology form.
- Arguments = premises + conclusion; validity when (p<em>1∧…∧p</em>n)→q is tautology.
Quantified Inference Rules
- Universal / Existential Instantiation & Generalisation.
- Universal Modus Ponens: ∀x(P→Q),P(a)⇒Q(a).
- Universal Modus Tollens: ∀x(P→Q),¬Q(a)⇒¬P(a).
Set Theory Essentials
- Set, Element (a∈A), empty set ∅, singleton, power set P(S) with ∣P(S)∣=2∣S∣.
- Subset A⊆B⟺∀x(x∈A→x∈B); proper subset A⊂B requires inequality.
- Cardinality; finite vs infinite; examples.
- Cartesian Product A×B (order matters); ∣A×B∣=∣A∣∣B∣.
- Operations: union, intersection, difference, complement with identities & De Morgan.
- Inclusion–Exclusion (2 sets) ∣A∪B∣=∣A∣+∣B∣−∣A∩B∣; general forms listed.
- Quantifiers w/ Sets notation ∀x∈SP(x), truth sets.
Functions
- Definition: assignment f:A→B, domain, codomain, range (image set).
- One-to-one (injective): f(a)=f(b)⇒a=b.
- Onto (surjective): ∀b∈B∃a∈Af(a)=b.
- Bijective: both above ⇒ invertible; inverse f−1 satisfies f−1(f(a))=a.
- Arithmetic on functions: (f!+!g)(x)=f(x)+g(x) etc.
- Composition (f∘g)(x)=f(g(x)), generally non-commutative.
- Special functions: floor ⌊x⌋, ceiling ⌈x⌉, factorial n!, identity.
Relations
- Binary relation R⊆A×B; on one set ⇒ relation on A.
- Properties:
• Reflexive, Irreflexive
• Symmetric, Anti-symmetric
• Transitive. - Equivalence relation = reflexive + symmetric + transitive.
- Partial order = reflexive + anti-symmetric + transitive (implied).
- Representations: ordered-pair lists, adjacency matrices, directed graphs, incidence matrices.
- Operations on relations (union, intersection, complement, composition S∘R).
- Powers R2=R∘R etc.
Counting Principles
- Product Rule: procedure with consecutive tasks ⇒ n<em>1n</em>2…nk ways.
- Sum Rule: mutually exclusive options ⇒ n<em>1+n</em>2+… ways.
- Inclusion–Exclusion handles overlap.
- Examples: telephone numbering, license plates, 3-digit numbers divisible by 5.
Recursion
- Recursive definitions require (1) basis step (2) recursive step.
• Factorial: f(0)=1,f(n)=nf(n−1).
• Fibonacci: F(0)=0,F(1)=1,F(n)=F(n−1)+F(n−2). - Recursive algorithms: factorial, Euclidean GCD, etc.
Sequences & Series
- Sequence = function an from N.
- Arithmetic progression a,a+d,a+2d,… general term an=a+(n−1)d.
- Geometric progression a,ar,ar2,… general an=arn−1.
- Summation notation ∑<em>k=mna</em>k; properties, index shifts, double sums.
- Useful identities: ∑k=1nk=2n(n+1), ∑k2=6n(n+1)(2n+1), ∑k3=[2n(n+1)]2.
Graph Theory
- Graphs G=(V,E): simple, multigraph, pseudograph, directed, weighted.
- Special graphs: complete K<em>n, cycle C</em>n, wheel W<em>n, bipartite & complete bipartite K</em>m,n.
- Degree: deg(v) (loops count twice); Handshaking Lemma ∑deg(v)=2∣E∣ ⇒ even number of odd-degree vertices.
- Directed graphs: in-degree deg−(v), out-degree deg+(v), totals equal ∣E∣.
- Paths / Circuits / Walks distinctions; connectivity; distance matrix, eccentricity, radius, diameter.
- Representations: adjacency list, adjacency matrix A, incidence matrix.
- Subgraphs & unions; graph models (social networks, influence, tournaments, intersection graphs).
Trees
- Tree: connected acyclic simple undirected graph.
• ∣E∣=∣V∣−1 (implicit). - Forest: acyclic, possibly disconnected.
- Rooted tree: designate root, direct edges away.
• Parent, child, siblings, ancestors, descendants.
• Internal vertex vs leaf.
• Subtree rooted at v. - m-ary & binary trees; full m-ary (all internal vertices have exactly m children); balanced if leaves at heights h or h−1.
- Levels & Height: root level 0; height = max level.
- Ordered rooted tree: children ordered L→R; enables traversals.
- Traversals (recursive):
• Preorder (Root-Left-Right).
• Inorder (Left-Root-Right) — yields infix expressions for binary trees.
• Postorder (Left-Right-Root). - Binary Search Tree (BST): in-order traversal gives sorted order; each node key > all in left subtree & < all in right.
- Expression Trees: internal vertices = operators, leaves = operands; prefix/pre-order (Polish), inorder (infix), postfix/post-order (Reverse Polish).