Foundations of Computer Science: Logic, Sets, Functions, Induction, and Recursion - Prof. , Exams of Computer Science

This document from the university of california, santa barbara covers the foundations of computer science, focusing on logic, sets, functions, induction, and recursion. Topics include propositional logic, sets and functions, mathematical induction, and recursion. Key concepts include logical operators, sets and their identities, functions and their properties, and mathematical induction and recursion. Students will learn about propositions, logical equivalences, sets and their identities, functions and their properties, and mathematical induction and recursion.

Typology: Exams

Pre 2010

Uploaded on 08/30/2009

koofers-user-yig-2
koofers-user-yig-2 🇺🇸

10 documents

1 / 15

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CMPSC 40: Foundations of Computer Science
Key Terms & Results
Peter Cappello
Department of Computer Science
University of California, Santa Barbara
1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download Foundations of Computer Science: Logic, Sets, Functions, Induction, and Recursion - Prof. and more Exams Computer Science in PDF only on Docsity!

CMPSC 40: Foundations of Computer Science

Key Terms & Results

Peter Cappello

Department of Computer Science

University of California, Santa Barbara

THE FOUNDATIONS: LOGIC & PROOFS

TERMS

proposition: a declarative statement that is true or false, but not both

propositional variable: a variable that represents a proposition

¬p (negation of p): the proposition with truth value opposite to the truth value of p

logical operators: operators used to combine propositions

compound proposition: a proposition constructed by combining propositions using logical operators

p ∨ q (disjunction of p and q): the proposition “p or q,” which is true if and only if at least 1 of p and q is true

p ∧ q (conjunction of p and q): the proposition “p and q,” which is true if and only if both p and q are true

p → q (p implies q): the proposition “if p then q,” which is false if and only if p is true and q is false

p ↔ q (biconditional): the proposition “p if and only if q,” which is true if and only if p and q have the same truth value

p ⊕ q (exclusive or of p and q): the proposition “p XOR q,” which is true when exactly 1 of p and q are true

converse of p → q: q → p

inverse of p → q: ¬p → ¬q

contrapositive of p → q: ¬q → ¬p

tautology: a compound proposition that always is true

contradiction: a compound proposition that always is false

predicate: the part of a sentence that attributes a property to the subject

propositional function: a statement containing 1 or more variables that becomes a proposition when each of its variables is assigned a value or is bound by a quantifier

domain (or universe) of discourse: the set of values a variable in a propositional function may take

∃xP (x) (existential quantification of P (x)): the proposition that is true if and only if there exists an x in the domain such that P (x) is true

∀xP (x) (universal quantification of P (x)): the proposition that is true if and only P (x) is true for every x in the domain

free variable: a variable not bound in a proposition function

bound variable: a variable that is quantified

RESULTS

  • The following logical equivalences from Table 6: Double negation: ¬(¬p) ≡ p Commutative: p ∨ q ≡ q ∨ p p ∧ q ≡ q ∧ p Associative: (p ∨ q) ∨ r ≡ p ∨ (q ∨ r) (p ∧ q) ∧ r ≡ p ∧ (q ∧ r) Distributive: p ∨ (q ∧ r) ≡ (p ∨ q) ∧ (p ∨ r) p ∧ (q ∨ r) ≡ (p ∧ q) ∨ (p ∧ r) DeMorgan’s: ¬(p ∨ q) ≡ ¬p ∧ ¬q ¬(p ∧ q) ≡ ¬p ∨ ¬q
  • The following equivalences of implication: p → q ≡ ¬p ∨ q p → q ≡ ¬q → ¬p
  • The following equivalences of biconditional: p ↔ q ≡ (p → q) ∧ (q → p) p ↔ q ≡ (p → q) ∧ (¬p → ¬q) p ↔ q ≡ ¬(p ⊕ q)
  • DeMorgan’s laws for quantifiers ¬∃P (x) ≡ ∀x¬P (x) ¬∀P (x) ≡ ∃x¬P (x)
  • The following rules of inference for propositional logic:

Modus ponens: [p ∧ (p → q)] → q Hypothetical syllogism: [(p → q) ∧ (q → r)] → (p → r) Resolution: [(p ∨ q) ∧ (¬p ∨ r)] → (q ∨ r)

  • The rules of inference for quantified statements: Universal instantiation: If ∀xP (x), then P (c) for any c in the domain. Universal generalization: If P (c) for arbitrary c, then ∀xP (x) Existential instantiation: If ∃xP (x), then P (c) for some c in the domain. We however do not know which element in the domain c is. Existential generalization: If P (c) for some c, then ∃xP (x)

SET & FUNCTIONS

TERMS

set: a collection of distinct objects

paradox: a logical inconsistency

element, member of a set: an object in a set

∅ (empty set, null set): the set with no members

universal set: the set containing all objects under consideration

Venn diagram: a graphical representation of a set or sets

S = T (set equality): ∀x(x ∈ S ↔ x ∈ T )

S ⊆ T (S is a subset of T ): ∀x(x ∈ S → x ∈ T )

S ⊂ T (S is a proper subset of T ): S ⊆ T ∧ S 6 = T

finite set: a set with n elements, where n is a natural number

infinite set: a set that is not finite

|S| (the cardinality of S): the number of elements in S

P (S) (the power set of S): {s | s ⊆ S}

A ∪ B (A union B): x ∈ A ∪ B ↔ (x ∈ A ∨ x ∈ B)

A ∩ B (A intersection B): x ∈ A ∩ B ↔ (x ∈ A ∧ x ∈ B)

A − B (A minus B): x ∈ A − B ↔ (x ∈ A ∧ x /∈ B)

A (the complement of A): U − A, where U is the universal set.

A ⊕ B (symmetric difference of A and B): x ∈ A ⊕ B ↔ (x ∈ A ⊕ x ∈ B)

membership table: a table displaying the membership of elements in sets

function from A to B: an assignment such that, ∀a ∈ A, a is assigned to exactly 1 element b ∈ B.

domain of f : the set A, where f is a function from A to B

codomain of f : the set B, where f is a function from A to B

b is the image of a under f: b = f (a)

a is the pre-image of b under f: f (a) = b

THE FUNDAMENTALS: ALGORITHMS & GROWTH OF FUNCTIONS

TERMS

algorithm: a finite sequence of precise instructions for performing a computation or solving a problem.

f (x) is O(g(x)): the fact that |f (x)| ≤ C|g(x)|, for all x > k, for some positive constants C and k.

f (x) is Ω(g(x)): the fact that |f (x)| ≥ C|g(x)|, for all x > k, for some positive constants C and k.

f (x) is Θ(g(x)): the fact that f (x) is O(g(x)) and f (x) is Ω(g(x)).

a | b (a divides b): there is an integer c such that b = ac.

a mod b: the remainder when the integer a is divided by integer b.

a ≡ b (mod m) (a is congruent to b modulo m): m | (a − b).

RESULTS

division algorithm: Let a ∈ Z and d ∈ Z+. Then there are unique q, r ∈ Z with 0 ≤ r < d such that a = dq + r.

INDUCTION & RECURSION

TERMS

the principle of mathematical induction: That the following statement is true:

(P (1) ∧ ∀k[P (k) → P (k + 1)]) → ∀nP (n).

basis step: The proof of P (1) in a proof by mathematical induction of ∀nP (n).

inductive step: The proof of ∀k[P (k) → P (k + 1)] in a proof by mathematical induction of ∀nP (n).

strong induction: That the following statement is true:

(P (1) ∧ ∀k[(P (1) ∧ · · · ∧ P (k)) → P (k + 1)]) → ∀nP (n).

well-ordering property: Every nonempty set of nonnegative integers has a least element.

recursive definition of a function: a definition of a function that specifies an initial set of values and a rule for obtaining values of this function at integers from its values at smaller integers.

recursive definition of a set: a definition of a set that specifies an initial set of elements in the set and a rule for obtaining other elements from those in the set.

structural induction: a technique for proving results about recursively defined sets.

recursive algorithm: an algorithm that proceeds by reducing a problem to the same problem with smaller input.

There are nr^ r-permutations of a set with n elements when repetition is allowed.

There are C(n + r − 1 , r) r-combinations of a set with n elements when repetition is allowed.

There are (^) n 1 !nn 2 !!···nk! permutations of n objects where there are ni indistinguishable objects of type i, for i = 1 , 2 ,... , k.

RECURRENCE RELATIONS

TERMS

recurrence relation: a formula expressing terms of a sequence, except for some initial terms, as a function of 1 or more previous terms of the sequence

initial conditions of a recurrence relation: the values of the terms of a sequence satisfying the recurrence relation before this relation takes effect

divide-and-conquer algorithm: an algorithm that solves a problem recursively by splitting it into a fixed number of smaller problems of the same type

RESULTS

|A ∪ B| = |A| + |B| − |A ∩ B|

RESULTS

  1. Let R be an equivalence relation. Then, the following 3 statements are equivalent:
    • aRb.
    • [a]R ∩ [b]R 6 = ∅.
    • [a]R = [b]R.
  2. The equivalence classes of an equivalence relation on a set A form a partition of A. Conversely, an equivalence relation can be constructed from any partition so that the equivalence classes are the subsets in the partition.

GRAPHS

TERMS

undirected edge: An edge associated with a set {u, v}, where u and v are vertices.

directed edge: An edge associated with an ordered pair (u, v), where u and v are vertices.

loop: An edge connecting a vertex with itself.

undirected graph: A set of vertices and a set of undirected edges each of which is associated with a set of 1 or 2 of these vertices.

simple graph: An undirected graph with no multiple edges and no loops.

multigraph: An undirected graph that may contain multiple edges but no loops.

directed graph: A set of vertices and a set of directed edges each of which is associated with an ordered pair of vertices.

adjacent: Two vertices are adjacent if there is an edge between them.

incident: An edge is incident to a vertex if the vertex is an endpoint of that edge.

deg(v) (the degree of the vertex v in an undirected graph): The number of edges incident to v with loops counted twice.

deg−(v) (the in-degree of the vertex v in a graph with directed edges): The number of edges with v as their ter- minal vertex.

deg+(v) (the out-degree of the vertex v in a graph with directed edges): The number of edges with v as their initial vertex.

Kn (Complete graph on n vertices): The undirected graph with n vertices where each pair of vertices is connected by an edge.

bipartite graph: A graph with a vertex set that can be partitioned into subsets V 1 and V 2 such that each edge connects a vertex in V 1 and a vertex in V 2.

Km,n (Complete bipartite graph: The graph with a vertex set partitioned into a subset of m vertices and a subset of n vertices such that 2 vertices are connected by an edge if and only if one vertex is in the first subset and the other is in the second subset.

Cn (cycle of size n), n ≥ 3 : The graph with n vertices v 1 , v 2 ,... , vn and edges {v 1 , v 2 }, {v 2 , v 3 },... , {vn− 1 , vn}.

adjacency matrix: A matrix representing a graph using the adjacency of vertices.

incidence matrix: A matrix representing a graph using the incidence of edges of vertices.

circuit: A path of length n ≥ 1 that begins and ends at the same vertex.