1 / 116

Mathematical Background

Mathematical Background. Appendix A. Boolean Logic Wffs. A wff is any string that is formed according to the following rules:. A propositional symbol (or variable) is a wff. If P is a wff, then  P is a wff. If P and Q are wffs, then so are: P  Q , P  Q , P  Q , and P  Q .

stokesr
Download Presentation

Mathematical Background

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Mathematical Background Appendix A

  2. Boolean Logic Wffs A wff is any string that is formed according to the following rules: • A propositional symbol (or variable) is a wff. • If P is a wff, then P is a wff. • If P and Q are wffs, then so are: PQ, PQ, PQ, and PQ. • If P is a wff, then (P) is a wff.

  3. Truth Tables Define Operators

  4. When Wffs are True • A Boolean wff is valid or is a tautology iff it is true for all assignments of truth values to the variables it contains. • A Boolean wff is satisfiable iff it is true for at least one assignment of truth values to the variables it contains. • A Boolean wff is unsatisfiable iff it is false for all assignments of truth values to the variables it contains. • Two wffs P and Q are equivalent, written PQ, iff they have the same truth values regardless of the truth values of the variables they contain.

  5. Using Truth Tables PP is a tautology:

  6. Properties of Boolean Operators •  and  are commutative and associative. •  is commutative but not associative. •  and  are idempotent: (e.g., (PP) P). •  and  distribute over each other: • P (QR)  (PQ)  (PR). • P (QR)  (PQ)  (PR).

  7. More Properties • Absorption laws: • P (PQ) P. • P (PQ) P. • Double negation: P P. • de Morgan’s Laws: • (PQ)  (P Q). • (PQ)  (P Q).

  8. Entailment A set A of wffs logically implies or entails a conclusion Q iff, whenever all of the wffs in A are true, Q is also true. Example: A B  C entail A  D D

  9. Inference Rules • An inference rule is sound iff, whenever it is applied to a set A of axioms, any conclusion that it produces is entailed by A. An entire proof is sound iff it consists of a sequence of inference steps each of which was constructed using a sound inference rule. • A set of inference rules R is complete iff, given any set A of axioms, all statements that are entailed by A can be proved by applying the rules in R.

  10. Some Sound Inference Rules • Modus ponens: From (PQ) and P, conclude Q. • Modus tollens: From (PQ) and Q, conclude P. • Or introduction: From P, conclude (PQ). • And introduction: From P and Q, conclude (PQ). • And elimination: From (PQ), conclude P or conclude Q.

  11. First-Order Logic A well-formed formula (wff) in first-order logic is an expression that can be formed by: • If P is an n-ary predicate and each of the expressions x1, x2, … , xn is a term, then an expression of the form P(x1, x2, … , xn) is a wff. If any variable occurs in such a wff, then that variable is free. • If P is a wff, then P is a wff. • If P and Q are wffs, then so are PQ, PQ, PQ, and PQ. • If P is a wff, then (P) is a wff. • If P is a wff, then x (P) and x (P) are wffs. Any free instance of x in P is bound by the quantifier and is then no longer free.

  12. Sentences A wff with no free variables is called a sentence or a statement. • Bear(Smoky). • x (Bear(x) Animal(x)). • x (Animal(x) Bear(x)). • x (Animal(x) y (Mother-of(y, x))). • x ((Animal(x) Dead(x)) Alive(x)). A ground instance is a sentence that contains no variables.

  13. Truth • Bear(Smokey). • x (Bear(x) Animal(x)). • x (Animal(x) Bear(x)). • x (Animal(x) y (Mother-of(y, x))). • x ((Animal(x) Dead(x)) Alive(x)). Which of these are true in the everyday world?

  14. Interpretations and Models • An interpretation for a sentence w is a pair (D, I), where D is a universe of objects. I assigns meaning to the symbols of w: it assigns values, drawn from D, to the constants in w and it assigns functions and predicates (whose domains and ranges are subsets of D) to the function and predicate symbols of w. • A model of a sentence w is an interpretation that makes w true. For example, let w be the sentence: x (y (y < x)). • A sentence w is valid iff it is true in all interpretations. • A sentence w is satisfiable iff there exists some interpretation in which w is true. • A sentence w is unsatisfiable iff w is valid.

  15. Examples • x ((P(x) Q(Smoky)) P(x)). • (x (P(x) (P(x))). • x (P(x, x)).

  16. Additional Sound Inference Rules • Quantifier exchange: • From x (P), conclude x (P). • From x (P), conclude x (P). • From x (P), conclude x (P). • From x (P), conclude x (P) . • Universal instantiation: For any constant C, from x (P(x)), conclude P(C). • Existential generalization: For any constant C, from P(C) conclude x (P(x)).

  17. A Simple Proof Assume the following three axioms: [1] x (P(x) Q(x) R(x)). [2] P(X1). [3] Q(X1). We prove R(X1) as follows: [4] P(X1) Q(X1) R(X1). (Universal instantiation, [1].) [5] P(X1) Q(X1). (And introduction, [2], [3].) [6] R(X1). (Modus ponens, [5], [4].)

  18. Gödel’s Theorems • Completeness Theorem: there exists some set of inference rules R such that, given any set of axioms A and a sentence c, there is a proof of c, starting with A and applying the rules in R, iff c is entailed by A. • Incompleteness Theorem: any theory that is derived from a decidable set of axioms and that characterizes the standard behavior of the constants 0 and 1, plus the functions plus and times on the natural numbers, cannot be both consistent and complete.

  19. Sets • S1 = {13, 11, 8, 23}. • S2 = {8, 23, 11, 13}. • S3 = {8, 8, 23, 23, 11, 11, 13, 13}. • S4 = {apple, pear, banana, grape}. • S5 = {January, February, March, April, May, June, July, August, September, October, November, December}. • S6 = {x : xS5 and x has 31 days}. • S7 = {January, March, May, July, August, October, December}.

  20. Sets • ℕ = the nonnegative integers (also called the natural numbers). • Z = the integers ( … -3, -2, -1, 0, 1, 2, 3, …).

  21. Sets • S8 = {i : x ℕ (i = 2x)}. • S9 = {0, 2, 4, 6, 8, …}. • S10 = the even natural numbers. • S11 = the syntactically valid C programs. • S12 = {x : xS11 and x never gets into an infinite loop}. • S13 = {finite length strings of a’s and b’s}.

  22. Defining a Set • Write a program that enumerates the elements of S. • Write a program that decidesS by implementing the characteristic function of S. Such a program returns True if run on some element that is in S and False if run on an element that is not in S.

  23. Cardinality The cardinality of every set we will consider is: • a natural number (if S is finite), • “countably infinite” (if S has the same number of elements as there are integers), or • “uncountably infinite” (if S has more elements than there are integers).

  24. Relating Sets to Each Other

  25. Sets of Sets • The power set of A is the set of all subsets of A. Let A = {1, 2, 3}. Then: P(A) = {, {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3}}. •  P(A) is a partition of a set A iff: • no element of  is empty, • all pairs of elements of  are disjoint , and • the union of all the elements of  equals A. Partitions of A: {{1}, {2, 3}} or {{1, 3}, {2}} or {{1, 2, 3}}.

  26. What is a Relation? An ordered pair is a sequence of two objects, written: (x, y). Order matters. So (unless x and y are equal): (x, y)  (y, x).

  27. Cartesian Products The Cartesian product of two sets A and B is the set of all ordered pairs (a, b) such that aA and b B. We write it as: AB If A and B are finite, the cardinality of their Cartesian product is: |AB| = |A||B|.

  28. Cartesian Products Let A be: {Dave, Sara, Billy} Let B be: {cake, pie, ice cream} AB = { (Dave, cake), (Dave, pie), (Dave, ice cream), (Sara, cake), (Sara, pie), (Sara, ice cream), (Billy, cake), (Billy, pie), (Billy, ice cream)}. B A = { (cake, Dave), (pie, Dave), (ice cream, Dave), (cake, Sara), (pie, Sara), (ice cream, Sara), (cake, Billy), (pie, Billy), (ice cream, Billy)}.

  29. Relations An n-ary relation over sets A1, A2, … An is a subset of: A1A2 … An. A binary relation over two sets A and B is a subset of: AB. Example: Dessert = { (Dave, cake), (Dave, ice cream), (Sara, pie), (Sara, ice cream)} Dessert -1 = { (cake, Dave), (ice cream, Dave), (pie, Sara), (ice cream, Sara)}

  30. Composing Relations The composition of R1AB and R2B , written R2R1, is: R2R1 = {(a, c) : b ((a, b) R1 ((b, c) R2)} Example: Dessert = {(Dave, cake), (Dave, ice cream), (Sara, pie), (Sara, ice cream)} Fatgrams = {(cake, 30), (pie, 25), (ice cream, 15)} Dessert  Fatgrams = {(Dave, 30), (Dave, 15), (Sara, 25), (Sara, 15)}

  31. Representing Relations Ways to represent a binary relation R: • List the elements of R. • Write a procedure that defines R either by: • Enumerating it. • Deciding it. • Encode R as an adjacency matrix. • Encode R as a directed graph.

  32. Representing a Binary Relation as an Adjacency Matrix

  33. Representing Binary Relations as Graphs

  34. Properties of Relations • RAA is reflexive iff, x A ((x, x) R). • Examples: • Address defined as “lives at same address as”. •  defined on the integers. For every integer x, xx.

  35. Properties of Relations • RAA is symmetric iff x, y ((x, y) R (y, x) R). • Examples: • Address is symmetric. •  is not symmetric.

  36. Equivalence Relations • A relation RAA is an equivalence relation iff it is: • reflexive, • symmetric, and • transitive. • Examples: • Equality • Lives-at-Same-Address-As • Same-Length-As

  37. Equivalence Classes Make it reflexive:

  38. Equivalence Classes Add (1, 2):

  39. Equivalence Classes Add (2, 3):

  40. Equivalence Classes

  41. Equivalence Classes An equivalence relation R on a set S carves S up into a set of clusters or islands, which we’ll call equivalence classes. This set of equivalence classes has the following key property: s, tS ((sclassi (s, t) R) tclassi). If R is an equivalence relation on a nonempty set A, then the set of equivalence classes of R is a partition  of A. Because  is a partition: (a) no element of  is empty; (b) all members of  are disjoint; and (c) the union of all the elements of  equals A.

  42. Partial Orders • A partial order is a relation that is: • reflexive, • antisymmetric, and • transitive. • Let R be a partial order defined on a set A. Then the pair (A, R) is a partially ordered set.

  43. Subset-of

  44. A Concept Hierarchy

  45. A Subsumption Lattice

  46. Total Orders A total orderRAA is a partial order that has the additional property that: x, y A ((x, y) R (y, x) R). Example:  If R is a total order defined on a set A, then the pair (A, R) is a totally ordered set. 6 5 4 3

  47. Well-Founded and Well-Ordered Sets • Given a partially ordered set (A, R), an infinite descending chain is a totally ordered, with respect to R, subset B of A that has no minimal element. • If (A, R) contains no infinite descending chains then it is called a well-founded set. • Used for halting proofs. • If (A, R) is a well-founded set and R is a total order, then (A, R) is called a well-ordered set. • Used in induction proofs.

  48. Well-Founded and Well-Ordered Sets

  49. Functions A functionf from a set A to a set B is a binary relation, subset of AB, such that: xA ((((x, y) f (x, z) f) y = z) yB ((x, y) f )). Dessert = { (Dave, cake), (Dave, ice cream), (Sara, pie), (Sara, ice cream)} is not a function. succ(n) = n + 1 is a function.

  50. Properties of Functions • f : AB is a total function on A iff it is a function that is defined on all elements of A. • f : AB is a partial function on A iff f is a subset of AB and every element of A is related to no more than one element of B. • f : AB is one-to-one iff no two elements of A map to the same element of B. • f : AB is onto iff every element of B is the value of some element of A.

More Related