SlideShare a Scribd company logo
1 of 106
Download to read offline
Theory of Automata
Formal Languages
Why
Quite often, we've found, teaching theory,      Formal methods are meant to elide
Undergrads are bored, puzzled and weary.        Ideas we aspire to confide.
``Sterile proofs are from Hell--                So to ``lemma,'' ``parameter,''
Teach us HTML!''                                Add ``iambic pentameter.''
They don't get it--in turn, we're left teary.   This should help students' ennui subside.

But good theorems don't formally hide           Pedagogy's best shown by example.
The human emotion supplied                      Ensuite, you are offered a sample
In their proofs' demonstration.                 In the hope you're not wincing.
Scientific elation                              Find our thesis convincing--
Belongs not in formaldehyde.                    We expect explanations are ample.

Rigor without mortis, our goal,
Is for sure a negotiable shoal--
We need not run aground.
                                                Martin Cohn
In our teaching, we've found                    Harry Mairson
A proof's spirit, in verse, is made whole.      Computer Science Department
                                                Brandeis University
Overview
•   Theory of computation:
     –   Intensively studied in first half of 20th century.
     –   Started by mathematicians and logicians.
     –   Later, became an independent academic discipline and was separated from mathematics.
     –   Some pioneers:
           •   Alonzo Church: Lambda calculus
           •   Kurt Godel (1906-1978): Incompleteness theorems, Godel prize (5000)
           •   Alan Turing (1912-1954): Turing machine
           •   Stephen Kleene (1909-1994): Kleene star, regular expression
           •   John von Neumann (1903-1957): game theory
           •   Claude Shannon (1916-2001): father of information theory
           •   Noam Chomsky (1928-): CNF, Chomsky hierarchy

•   Central areas: Automata, Computability, Complexity
•   Computability: What are the fundamental capabilities and limitations of
    computers?
     –   Classify problems as solvable and unsolvable
•   Complexity: What makes some problems computationally hard and others
    easy?
     –   Classify solvable problems as easy ones and hard ones
•   Both deal with formal models of computation: Turing machines, recursive
    functions, lambda calculus, and production systems
Overview
•   Automata theory: study of abstract machines and problems they are
    able to solve.
    – closely related to formal language theory as the automata are often classified by the
      class of formal languages they are able to recognize.
    – An abstract machine, also called an abstract computer, is a theoretical model of a
      computer hardware or software system used in automata theory.
    – A typical abstract machine consists of a definition in terms of input, output, and the set
      of allowable operations used to turn the former into the latter. E.g., FSM, PDA, Turing
      machine.
•   Formal languages: A set of strings over a given alphabet.
    – In contrast to natural language
    – Often defined by formal grammar, which is a set of formation rules that describe which
      strings formed from the alphabet of a formal language are syntactically valid.
    – Used for the precise definition of data formats and the syntax of program. languages.
    – Play a crucial role in the development of compilers.
    – Used in logic / foundations of mathematics to represent the syntax of formal theories
    – Regular languages, context-free languages, context-sensitive languages, recursive
      languages (decidable), recursively enumerable languages (semi-decidable)
    – Formal language theory uses separate formalisms, automata, to describe their
      recognizers.
Grammars, Languages, and Machines

        Generates    Language




   Grammar            Recognizes
                      or
                      Accepts




                    Machine
Languages and Machines
The Chomsky Hierarchy

  (Recursively enumerable)
                             Recursive languages
                             (decidable) are not
                             included
The Chomsky Hierarchy
                                                                      Production rules
Grammar       Languages                Automaton
                                                                      (constraints)


Type-0        Recursively enumerable   Turing machine                            (no restrictions)



                                       Linear-bounded non-
Type-1        Context-sensitive
                                       deterministic Turing machine



                                       Non-deterministic pushdown
Type-2        Context-free
                                       automaton


Type-3        Regular                  Finite state automaton



 • Summarizes each of Chomsky's four types of grammars, the class of
 language it generates, the type of automaton that recognizes it, and the form
 its rules must have.
 • There are other categories of formal languages not included, e.g., recursive
Noam Chomsky

• 1928   –
• Professor emeritus at MIT
• Father of modern linguistics
• Still holds office
• Chomsky normal form (CNF)
    • context-free grammar




• Controversial political critic
• Often receives undercover police protection
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.

 • If P is a wff, then (P) is a wff.
Truth Tables Define Operators

P        Q       ¬P      P∨ Q    P∧ Q    P→ Q    P↔ Q
True     True    False   True    True    True    True

True     False   False   True    False   False   False

False    True    True    True    False   True    False

False    False   True    False   False   True    True
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.
Using Truth Tables

P ∨ ¬P is a tautology:


        P       ¬P       P ∨ ¬P
        True    False    True
        False   True     True
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).
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).
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
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.
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.
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.
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.
Truth
 •   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)).


Which of these are true in the everyday world?
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.
Examples
∀ ∀x ((P(x) ∧ Q(Smoky)) → P(x)).




∀ ¬(∀x (P(x) ∨ ¬(P(x))).




∀ ∀x (P(x, x)).
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)).
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].)
Theory
• A first order theory is a set of axioms and the set of all
  theorems that can be proved, using a set of sound and
  complete inference rules, from those axioms.
• A theory is consistent iff there is no sentence P such that
  both P and ¬ P are theorems.
   • inconsistent: contains such a contradiction.
• Let w be a world plus an interpretation (that maps logical
  objects to objects in the world). We say a theory is sound
  w.r.t. w iff every theorem in the theory corresponds to a
  fact that is true in w.
  We say a theory is complete w.r.t. w iff every fact that is
  true in w corresponds to a theorem in the theory.
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.
Kurt Gödel
•   1906 – 1978. One of the greatest logicians of all time
•   Gödel and Einstein … were known to take long walks
    together to and from the Institute for Advanced Study. …
    toward the end of his life Einstein confided that his "own
    work no longer meant much, that he came to the Institute
    merely…to have the privilege of walking home with Gödel. "
•   1947, Einstein … accompanied Gödel to his U.S.
    citizenship exam, where they acted as witnesses. Gödel
    had confided in them that he had discovered an
    inconsistency in the U.S. Constitution, one that would
    allow the U.S. to become a dictatorship
•   In later life, suffered periods of mental instability… fear of
    being poisoned; wouldn't eat unless his wife tasted his food
    for him. Late in 1977, wife was hospitalized for six months.
    In her absence, he refused to eat, eventually starving
    himself to death. He weighed 65 pounds when he died.
Extensions
• Propositional logic
• First order logic: use variables
   – Range over individuals

• Second order logic
   – Additional variables that range over sets of individuals

   – E.g., ∀P∀x(x ∈ P ∨ x ∉ P).

• Higher order logic
   – A predicate can take one or more other predicates as arguments
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}.
Sets
• ℕ = the nonnegative integers (also called the natural
  numbers).



• Z = the integers ( … -3, -2, -1, 0, 1, 2, 3, …).
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}.
Defining a Set Using Programs

• Write a program that enumerates the elements of S.


• Write a program that decides S 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.
   – A characteristic function can be used to determine whether
     or not a given element is in S.

• Formally, a function f with domain Domain is a
  characteristic function of a set S iff f(x) = True if x is
  an element of S and False otherwise.
   – Note, f must be total
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).

• Empty set φ
   – so | φ | = 0.
   – |{φ}| = ?
Relating Sets to Each Other
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}}.
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).
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|.
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)}.
Binary Relations
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)}

Binary relations are particularly useful and are often
written as x R y.
Relations
3-ary (ternary) relation: A × A × A
{(Sara, Dave, Billy), (Beth, Mark, Cathy), (Cathy, Billy,
Pete)}


An n-ary relation over sets A1, A2, … An is a subset of:
       A1 × A2 × … × An.


• A relation may be equal to {}
   • Dave, Sue, and Billy all hate dessert
• no constraints on how many times a particular element
may occur in a relation
Composing Relations
The composition of R1 ⊆ A × B and R2 ⊆ B × C,
      written R2 ° R1, is:

       R2 ° R1 = {(a, c) : ∃b ((a, b) ∈ R1 ∧ ((b, c) ∈ R2)}

• R2 ° R1 ⊆ A × C
• R1 ° R2 is fine, as long as consistent

Dessert = {(Dave, cake), (Dave, ice cream), (Sara, pie),
           (Sara, ice cream)}

Fatgrams = {(cake, 30), (pie, 25), (ice cream, 15)}

Fatgrams ° Dessert = {(Dave, 30), (Dave, 15),
Representing Relations
Ways to represent a binary relation R:

  • List the elements of R.

  Mother-of = {(Doreen, Ann), (Ann, Catherine), (Catherine, Allison)}

  • Write a procedure that defines R either by:
    • Enumerating it.
    • Deciding it.

  • Encode R as an adjacency matrix.

  • Encode R as a directed graph.
Representing a Binary Relation as
      an Adjacency Matrix

             Doreen   Ann   Catherine   Allison
 Doreen               1
 Ann                        1
 Catherine                              1
 Allison
Representing Binary Relations as
            Graphs
Properties of Relations
R ⊆ A × A is reflexive iff, ∀x ∈ A ((x, x) ∈ R).


Examples:
• ≤ defined on the integers. For every integer x, x ≤ x.
Properties of Relations
R ⊆ A × A is symmetric iff ∀x, y ((x, y) ∈ R → (y, x) ∈ R).

Examples:
• = is symmetric.
• ≤ is not symmetric.
Properties of Relations
R ⊆ A × A is antisymmetric iff
       ∀x, y ((x, y) ∈ R ∧ x ≠ y → (y, x) ∉ R)

Examples?


R ⊆ A × A is transitive iff
       ∀x, y, z (((x, y) ∈ R ∧ (y, z) ∈ R → (x, z) ∈ R)

Examples?
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
Equivalence Classes




Make it reflexive:
Equivalence Classes




Add (1, 2):
Equivalence Classes




Add (2, 3):
Equivalence Classes
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 iff:

(a) no element of Π is empty;
(b) all members of Π are disjoint; and
(c) the union of all the elements of Π equals A.
Equivalence Classes
To describe equivalence classes, we’ll use the notation
[x] to mean the equivalence class to which x belongs.

In general, there are maybe lots of different ways to
describe the same equivalence class.

For example, [1], [2], [3] all describe the same
equivalence class S that contains 1, 2, and 3
Partial Orders
A partial order is a relation that is:

   • reflexive

   • antisymmetric

   • transitive


Let R be a partial order defined on a set A. Then the pair
(A, R) is a partially ordered set.
• Subset-of is a partial order defined on the set of all sets
• Proper-Subset-of?
Subset-of is a Partial Order




• To make the graph relatively easy to read, we follow the convention that
we do not write in the links that are required by reflexivity and transitivity.
A Concept Hierarchy




• A concept is a set of entities in the world.
• Some concepts are more general than others.
• We say a concept x is subsumed by a concept y (x ≤ y) iff every instance of
x is also an instance of y.
• Concept subsumption is a partial order.
A Subsumption Lattice
Total Orders
A total order R ⊆ A × A is a partial
order that has the additional property
                                                6
that:
  ∀x, y ∈ A ((x, y) ∈ R ∨ (y, x) ∈ R).
                                            5


Example: ≤
                                            4


If R is a total order defined on a set A,
then the pair (A, R) is a totally               3
ordered set.
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.
Well-Founded and Well-Ordered Sets

                     (A, R)                            Well-       Well-
                                                       founded     ordered
The set of sets with respect to the subset-of Yes                No
   relation
The set of concepts with respect to subsumption   Yes            No

The set of natural numbers under ≤                Yes            Yes

The set of integers under ≤                       No             No
Functions
A function f 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 )).


• i.e., each element in A relates to exactly one element in B.
• one to one is ok, many to one is ok, but not one to many

Dessert =
    { (Dave, cake),
      (Dave, ice cream),
      (Sara, pie),
      (Sara, ice cream)}                   is not a function.
Notations of Functions
• f:A→B
   – A: domain
   – B: codomain or range
   – f is a function from A to B

• Can define a function in two parts
   – the first specifies the domain and range
   – the second defines how elements are related

   succ: Z -> Z,
   succ(n) = n + 1.

• succ is a unary function
• +: (Z x Z) -> Z is a binary function
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 it is a function
  that is defined on a subset of A.
• Partial functions generalizes total functions
• Partial functions are often used when the “defined
  domain”, is not known (e.g. many functions
  in computability theory)
Properties of Functions
• f : A → B is one-to-one iff no two elements of A map to
  the same element of B.
   – injective
   – f is a injection
• f : A → B is onto iff every element of B is the value of
  some element of A.
   – surjective
   – f is a surjection
   – the elements of B are covered

• f : A → B is bijective if it is both injective and surjective
   – f is a bijection

• the inverse of a bijection is also a function
• if f ⊆ A × B, then f-1 ⊆ B × A = {(b, a): (a,b) ∈ f}
Properties of Functions
Properties of Binary Functions
A binary function # is commutative iff:
              ∀x, y ∈ A (x # y = y # x).

       i + j = j + i.                   (integer addition)
       A ∩ B = B ∩ A.                   (set intersection)
       P ∧ Q ≡ Q ∧ P.                   (Boolean and)

A binary function # is associative iff:
              ∀x, y, z ∈ A ((x # y) # z = x # (y # z)).

       (i + j) + k = i + (j + k).       (integer addition)
       (A ∩ B) ∩ C = A ∩ (B ∩ C).        (set intersection)
       (P ∧ Q) ∧ R ≡ P ∧ (Q ∧ R).       (Boolean and)
       (s || t) || w = s || (t || w).   (string concatenation)
Properties of Binary Functions
A binary function # is idempotent iff ∀x ∈ A (x # x = x).

         min(i, i) = i.           (integer minimum)
         A ∩ A = A.               (set intersection)
         P∧P≡                     (Boolean and)

The distributivity property: A function # distributes over
another function % iff:
      ∀x, y, z ∈ A (x # (y % z) = (x # y) % (x # z)).

i⋅(j + k) = (i⋅j) + (i⋅k).       (integer multiplication
                                        over addition)
A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C). (set union over
                                        intersection)
P ∧ (Q ∨ R) ≡ (P ∧ Q) ∨ (P ∧ Q). (Boolean and over or)
Properties of Binary Functions
Absorption laws also relate two binary functions to each
other:

A function # absorbs another function % iff:

      ∀x, y ∈ A (x # (x % y) = x)).


      A ∩ (A ∪ B) = A.     (Set intersection absorbs
                                  union.)
      P ∨ (P ∧ Q) ≡ P.     (Boolean or absorbs and.)
      P ∧ (P ∨ Q) ≡ P.     (Boolean and absorbs or.)
Identities
An element a is an identity for the function # iff:

       ∀x ∈ A ((x # a = x) ∧ (a # x = x)).


       i⋅1 = i.             (1 is an identity for integer
                                    multiplication.)
       i + 0 = i.           (0 is an identity for integer
                                    addition.)
       A ∪ ∅ = A.           (∅ is an identity for set union.)
       P ∨ False ≡ P.       (False is an identity for Boolean
                                     or.)
       s || "" = s.         ("" is an identity for string
                                     concatenation.)
Zeros
An element a is a zero for the function # iff:

       ∀x ∈ A ((x # a = a) ∧ (a # x = a)).


       i⋅0 = 0.           (0 is a zero for integer
                                  multiplication.)
       A ∩ ∅ = ∅.         (∅ is a zero for set
                                  intersection.)
       P ∧ False ≡ False. (False is a zero for Boolean
                                  and.)
Self Inverses
A unary function $ is a self inverse iff:

       ∀x ($($(x)) = x).


       -(-(i)) = i.            (Multiplying by -1 is a self
                                      inverse for integers.)
       1/(1/i) = i if i ≠ 0.   (Dividing into 1 is a self inverse
                                      for integers.)
       ¬¬A = A.                (Complement is a self inverse
                                      for sets.)
       ¬(¬ P) = P.             (Negation is a self inverse for
                                      Booleans.)
       (sR)R = s.              (Reversal is a self inverse for
                                      strings.)
Properties of Functions on Sets
Commutativity:    A ∪ B = B ∪ A.
                  A ∩ B = B ∩ A.
Associativity:    (A ∪ B) ∪ C = A ∪ (B ∪ C).
                  (A ∩ B) ∩ C = A ∩ (B ∩ C).
Idempotency:      A ∪ A = A.
                  A ∩ A = A.
Distributivity:   A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C).
                  A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C).
Absorption:       (A ∪ B) ∩ A = A.
                  (A ∩ B) ∪ A = A.
Identity:         A ∪ ∅ = A.

Zero:             A ∩ ∅ = ∅.

Self Inverse:     ¬¬A = A.
Closures
A binary relation R on a set A is closed under property P
iff R possesses P.

• ≤ on the integers, P = transitivity

Sometimes, if R is not closed under P, we may want to
ask what elements would have to be added to R to make
it closed under P.

The closure of R under P is a smallest set that includes
R and that is closed under P.
Closures
Let R = {(1, 2), (2, 3), (3, 4)}.

The transitive closure of R is:




The reflexive closure of R is:
Closures
Let R = {(1, 2), (2, 3), (3, 4)}.

The transitive closure of R is:

       {(1, 2), (2, 3), (3, 4), (1, 3), (1, 4), (2, 4)}



The reflexive closure of R is:

       {(1, 2), (2, 3), (3, 4), (1, 1), (2, 2), (3, 3), (4, 4)}
Proof Techniques
• Proof by construction
• Proof by contradiction
• Proof by counterexample
• Proof by case enumeration
• Mathematical induction
• The pigeonhole principle
• Proving cardinality
• Diagonalization
• Reasoning about programs
Proof by Construction

∀ ∃x(Q(x))
∀ ∀x(∃y(P(x,y)))

• On way to prove the assertion is to show
  an algorithm that finds the value that we
  claim must exist.
• Example: There is an infinite number of
  primes.
An Infinite Number of Primes
Assume that the set P of prime numbers is finite. So there exists some
value of n such that P = {p1, p2, p3, … pn}. Let:
         q = (p1p2p3 … pn) + 1.

Since q is greater than each pi, it is not on the list of primes. So it must be
composite and have at least one prime factor pk ∈ P. Then q must have at
least one other factor, some integer i such that:
                   q           = ipk.
         (p1p2p3 … pn) + 1 = ipk.
          (p1p2p3 … pn) - ipk = -1.

Since pk is prime, it divides both terms on the left. Factoring it out, we get:
         pk(p1p2pk-1pk+1 … pn - i)     = -1.
                 pk                    = -1/(p1p2pk-1pk+1 … pn - i).

But, since (p1p2pk-1pk+1 … pn - i) is an integer, this means that |pk| < 1. But
that cannot be true since pk is prime and thus greater than 1. So q is not
composite. Since q is greater than 1 and not composite, it must be prime,
contradicting the assumption that all primes are in the set {p1, p2, p3, … pn}.
Prove by Counterexample
• One is enough

Consider the following claim:

Let A, B, and C be any sets. If A - C = A - B then B = C.

We show that this claim is false with a counterexample:

Let A = ∅, B = {1}, and C = {2}.

A - C = A - B = ∅.

But B ≠ C.
Proof by Case Enumeration
Suppose that the postage required to mail a letter is
always at least 6¢. Prove that it is possible to apply any
required postage to a letter given only 2¢ and 7¢ stamps.
We prove this general claim by dividing it into two cases,
based on the value of n, the required postage:
•   If n is even (and 6¢ or more), apply n/2 2¢ stamps.
•   If n is odd (and 6¢ or more), then n ≥ 7 and n-7 ≥ 0
    and is even. 7¢ can be applied with one 7¢ stamp.
    Apply one 7¢ stamp and (n-7)/2 2¢ stamps.
Mathematical Induction
The principle of mathematical induction:
If:   P(b) is true for some integer base case b, and
      For all integers n ≥ b, P(n) → P(n+1)
Then: For all integers n ≥ b, P(n)

An induction proof has three parts:
•    A clear statement of the assertion P.
•    A proof that that P holds for some base case b, the
     smallest value with which we are concerned.
•    A proof that, for all integers n ≥ b, if P(n) then it is
     also true that P(n+1). We’ll call the claim P(n) the
     induction hypothesis.
Sum of First n Positive Integers
The sum of the first n odd positive integers is n2. We
first check for plausibility:

      (n = 1) 1             = 1 = 1 2.
      (n = 2) 1 + 3         = 4 = 2 2.
      (n = 3) 1 + 3 + 5     = 9 = 3 2.
      (n = 4) 1 + 3 + 5 + 7 = 16 = 42, and so forth.

The claim appears to be true, so we should prove it.
Sum of First n Positive Integers
Let Oddi = 2(i – 1) + 1 denote the ith odd positive integer. Then we
can rewrite the claim as:
                                                n

                              ∀n ≥ 1 (∑ Odd i = n )
                                                 2

                                               i =1

The proof of the claim is by induction on n:
Base case: take 1 as the base case. 1 = 12.
                               n                        n +1
Prove:           ∀n ≥ 1((∑ Odd i = n ) → (∑ Odd i = (n + 1) 2 ))
                                                    2

                              i =1                      i =1

     n +1               n

     ∑ Odd   i
                  =   ∑ Odd
                       i =1
                                     i   + Odd n +1
      i =1


                  = n2+ Oddn+1.                                (Induction hypothesis.)
                  = n2 + 2n + 1.                               (Oddn+1 = 2(n+1–1) + 1 = 2n + 1.)
                  = (n + 1)2.
Pigeonhole Principle
Suppose that we have n pigeons and k holes. Each
pigeon must fly into a hole. If n > k, then there must be
at least one hole that contains more than one pigeon.


More formally,

Consider any function f: A → B.

The pigeonhole principle says:

       If |A| > |B| then f is not one-to-one.
Cardinality
We will be concerned with three cases:
  • finite sets,
  • countably infinite sets, and
  • uncountably infinite sets.


   A set A is finite and has cardinality n ∈ ℕ iff either:

               • A = ∅, or
               • there is a bijection from {1, 2, … n} to A,
                      for some n.


   A set is infinite iff it is not finite.
Countably Infinite Sets
ℕ is countably infinite. Call its cardinality ℵ0.


A is countably infinite and also has cardinality ℵ0 iff
there exists some bijection f : ℕ → A.

A set is countable iff it is either finite or countably infinite.

To prove that a set A is countably infinite, it suffices to
find a bijection from ℕ to it.
Even Numbers
The set E of even natural numbers is countably infinite.

To prove this, we offer the bijection:
              Even : ℕ → E,
              Even(x) = 2x.

                ℕ                   E
       0                    0
       1                    2
       2                    4
       3                    6
       …                    …
Enumerations
Sometimes, bijection is not as obvious. Then a good way
to think about the problem of finding a bijection from ℕ to
some set A, is to turn it into the problem of finding an
enumeration of A.


An enumeration of a set A is simply a list of the elements
of A in some order. Each element of A must occur in the
enumeration exactly once.
Enumerating Countably Infinite Sets
Theorem: A set A is countably infinite iff there exists an
infinite enumeration of it.

Proof: We prove the if and only-if parts separately.
If A is countably infinite, then there exists an infinite enumeration
of it: Since A is countably infinite, there exists a bijection f from ℕ to it.
We construct an infinite enumeration of A as follows: For all i ≥ 1, the ith
element of the enumeration of A will be f(i - 1).

If there exists an infinite enumeration E of A, then A is countably
infinite: Define f: ℕ → A, where f(i) is the (i+1)st element of the list E.
The function f is a bijection from ℕ to A, so A is countably infinite.

Note: used to show “countably infinite”, as well as “not countably infinite”
Finite Union
Theorem: The union U of a finite number of countably
infinite sets is countably infinite.

Proof: by enumeration of the elements of U:

S1[1], S2[1], … Sn[1],
S1[2], S2[2], … Sn[2],
…

checking before inserting each element to make sure
that it is not already there.

Can we do this? Enumerating all the elements of the 1st
set, then the 2nd …
Countably Infinite Union
Theorem: The union U of a countably infinite number of
countably infinite sets is countably infinite.

Proof: by enumeration of the elements of U.




• Note: use the previous simple enumeration technique,
we’d never et to the 2nd element of any sets …
• check make sure the element not already there
Diagonalization
• Cantor's diagonal argument
• 1891 by Georg Cantor, there are infinite sets that are more numerous
than natural numbers
    • His first proof about “real numbers are more numerous than natural
    numbers” appeared in 1874
    • but this is a more powerful and general technique
• Used in a wide range of proofs: chain of influence
    • Russell’s paradox
    • Godel’s incompleteness theorems
    • Turing's answer to the Entscheidungsproblem
    • Turing’s undecidability of the Halting problem

         Georg Cantor (1845 – 1918 )
         • German mathematician
         • Creator of modern set theory, introduced
         infinity in set theory
         • Diagonal argument
Russell’s Paradox
• By Bertrand Russell in 1901
• Showed that the naive set theory leads to a contradiction.
• A set exists whose members are those objects (and only those objects) that
satisfy the criterion; but this assumption is disproved by:

A set containing exactly the sets that are not members of themselves

• Applied version: there are some versions of this paradox that are closer to
real-life situations and may be easier to understand for non-logicians.
• Barber paradox: A barber shaves all and only those men in town who do not
shave themselves.
     • When one thinks about whether the barber should shave himself or not,
     the paradox begins to emerge.

• Applications:
    • By Kurt Gödel, in incompleteness theorem by formalizing the paradox
    • By Turing, in undecidability of the Halting problem (and with that the
    Entscheidungsproblem) by using the same trick
Russell’s Paradox
In the middle of the night I got such a fright that woke me with a start,
For I dreamed of a set that contained itself, in toto, not in part.
If sets can thus contain themselves, then they might also fail
To hold themselves as members, and this leads me to my tale.

Now Frege thought he finally had the world inside a box,
So he wrote a lengthy tome, but up popped paradox.
Russell asked, ``You know that Epimenides said oft
A Cretan who tells a lie does tell the truth, nicht war, dumkopf?

And here's a poser you must face if continue thus you do,
What make you of the following thought, tell me, do tell true.
The set of all sets that contain themselves might cause a soul to frown,
But the set of all sets that don't contain themselves will bring you down!''

Now Gottlob Frege was no fool, he knew his proof was fried.
He published his tome, but in defeat, while in his beer he cried.
And Bertrand Russell told about, in books upon our shelves,
The barber in town who shaves all those who do not shave themselves.
Bertrand Russell
Bertrand Russell (1872 – 1970)
• English philosopher, logician, mathematician …
• In 1950, awarded Nobel in literature
• Russell’s family, one of the most influential in England,
politically, land-owning, Earl, Duke, Baron, prime minister
• Has a (even more) famous student, Ludwig Wittgenstein
• The two are widely referred to as the greatest
philosophers of last century

Ludwig Wittgenstein (1889 – 1951)
• Wittgenstein family, Jewish, one of the richest in the
world
• 3 of 4 brothers suicide
• Famous schoolmate: Adolf Hitler (6 days older, 2 grades
below), were 14 or 15 years old.
• Some say they never knew each other. Some say the
interaction/competition/conflict/jealousy generated hatred
toward Jews, thus changed the history
• Alan Turing attended his lectures at Cambridge after
coming back from Princeton (with Alonzo Church)
Diagonalization
• ℕ is countably infinite. Call its cardinality ℵ0.
• There are sets with more than ℵ0 elements (not countably infinite)
     • e.g., set of real numbers
• The power set of the integers is not countable.
• S is a countably infinite set, P(S) is not countable.

• To prove it, use diagnonalization.
• Proof by contradiction.
• To show a set A is not countably infinite, we assume that it is, in which
case there would be some enumeration of it. Every element of A would
have to be on that list somewhere.
• But we show how to construct an element of A that cannot be on the
list, no matter how the list was constructed.
• Thus, there exists no enumeration of A, so A is not countably infinite.
Diagonalization
S is a countably infinite set, P(S) is not countable.

                 Elem 1 of S Elem 2 of S Elem 3 of S Elem 4 of S      Elem 5 of S …….

Elem 1 of P(S)   1       (1)                                                       …..
Elem 2 of P(S)                 1      (2)                                          …..
Elem 3 of P(S)   1             1                   (3)                             …..
Elem 4 of P(S)                              1                   (4)                …..
Elem 5 of P(S)   1                          1                                (5)   …..
    …                                                                              …..


A set that is not in the table:

                  ¬(1)         ¬(2)         ¬(3)         ¬(4)         ¬(5)         …..
Reasoning About Programs

• Correctness properties, including:
   • The program eventually halts.
   • When it halts, it has produced the desired output.

• Performance properties, including:
   • Time requirements, and
   • Space requirements.
Proving Halting
To prove termination of a program P with a loop, we will
generally rely on the existence of some well-founded set
(S, R) such that:
• There exists some bijection between each step of P
  and some element of the set S,
• The first step of P corresponds to a maximal (with
  respect to R) element of S,
• Each successive step of P corresponds to a smaller
  (with respect to R) element of S, and
• P halts on or before it executes a step that corresponds
  to a minimal (with respect to R) element of S.
Choosing a Well-Founded Set
    P(s: string) =
       While length(s) > 0 do:
               Remove the first character from s and call it c.
               if c = a return True.
       Return False.

Let S = {0, 1, 2, …, |s|}. (S, ≤) is a well-founded set whose
least element is 0. Associate each step of the loop with |s|
as the step is about to be executed. The first pass through
the loop is associated the initial length of s, which is the
maximum value of |s| throughout the computation. |s| is
decremented by one each time through the loop. P halts
when |s| is 0 or before (if it finds the character a). So the
maximum number of times the loop can be executed is the
initial value of |s|.
Proving a Program Computes
          Correct Result
• Loop Invariants: a predicate I that describes a
  property that does not change during the execution of
  an iterative process.

• Induction
Loop Invariants
To use a loop invariant I, we must prove:
• I is true on entry to the loop.

• The truth of I is maintained at each pass through the
  loop.

• I, together with the loop termination condition, imply
  whatever property we wish to prove is true on exit
  from the loop.
The Coffee Can Problem
Given a coffee can that contains some white beans and
some black beans, do:

Until no further beans can be removed do:
  1. Randomly choose two beans.
  2. If the two beans are the same color, throw both of
      them away and add a new black bean.
  3. If the two beans are different colors, throw away
      the black one and return the white one to the can.

•   This process must halt.
•   What color is the remaining bean?

More Related Content

What's hot

Theory of Computer Science - Post Correspondence Problem
Theory of Computer Science - Post Correspondence ProblemTheory of Computer Science - Post Correspondence Problem
Theory of Computer Science - Post Correspondence ProblemKaran Thakkar
 
Isolation Lemma for Directed Reachability and NL vs. L
Isolation Lemma for Directed Reachability and NL vs. LIsolation Lemma for Directed Reachability and NL vs. L
Isolation Lemma for Directed Reachability and NL vs. Lcseiitgn
 
Arguments and methods of proof
Arguments and methods of proofArguments and methods of proof
Arguments and methods of proofRobert Geofroy
 
Discrete Mathematics - Propositional Logic
Discrete Mathematics - Propositional LogicDiscrete Mathematics - Propositional Logic
Discrete Mathematics - Propositional LogicUniversity of Potsdam
 
Propositional logic
Propositional logicPropositional logic
Propositional logicRushdi Shams
 
Chaps 1-3-ai-prolog
Chaps 1-3-ai-prologChaps 1-3-ai-prolog
Chaps 1-3-ai-prologsaru40
 
Class 37: Computability in Theory and Practice
Class 37: Computability in Theory and PracticeClass 37: Computability in Theory and Practice
Class 37: Computability in Theory and PracticeDavid Evans
 
Thoery of Computaion and Chomsky's Classification
Thoery of Computaion and Chomsky's ClassificationThoery of Computaion and Chomsky's Classification
Thoery of Computaion and Chomsky's ClassificationPrafullMisra
 
Discrete Structures lecture 2
 Discrete Structures lecture 2 Discrete Structures lecture 2
Discrete Structures lecture 2Ali Usman
 
A new technique for proving non regularity based on the measure of a language
A new technique for proving non regularity based on the measure of a languageA new technique for proving non regularity based on the measure of a language
A new technique for proving non regularity based on the measure of a languageRyoma Sin'ya
 
Chomsky hierarchy
Chomsky hierarchyChomsky hierarchy
Chomsky hierarchySANUC2
 
Logic, contrapositive, converse, Discrete Mathematics, conjunction, negation
Logic, contrapositive, converse, Discrete Mathematics, conjunction, negationLogic, contrapositive, converse, Discrete Mathematics, conjunction, negation
Logic, contrapositive, converse, Discrete Mathematics, conjunction, negationZaidAly1
 

What's hot (20)

Unit ii
Unit iiUnit ii
Unit ii
 
Theory of Computer Science - Post Correspondence Problem
Theory of Computer Science - Post Correspondence ProblemTheory of Computer Science - Post Correspondence Problem
Theory of Computer Science - Post Correspondence Problem
 
Unit v
Unit vUnit v
Unit v
 
Isolation Lemma for Directed Reachability and NL vs. L
Isolation Lemma for Directed Reachability and NL vs. LIsolation Lemma for Directed Reachability and NL vs. L
Isolation Lemma for Directed Reachability and NL vs. L
 
Inteligencia artificial
Inteligencia artificialInteligencia artificial
Inteligencia artificial
 
Arguments and methods of proof
Arguments and methods of proofArguments and methods of proof
Arguments and methods of proof
 
Invariant-Free Clausal Temporal Resolution
Invariant-Free Clausal Temporal ResolutionInvariant-Free Clausal Temporal Resolution
Invariant-Free Clausal Temporal Resolution
 
Discrete Mathematics - Propositional Logic
Discrete Mathematics - Propositional LogicDiscrete Mathematics - Propositional Logic
Discrete Mathematics - Propositional Logic
 
Propositional logic
Propositional logicPropositional logic
Propositional logic
 
Chaps 1-3-ai-prolog
Chaps 1-3-ai-prologChaps 1-3-ai-prolog
Chaps 1-3-ai-prolog
 
Class 37: Computability in Theory and Practice
Class 37: Computability in Theory and PracticeClass 37: Computability in Theory and Practice
Class 37: Computability in Theory and Practice
 
artficial intelligence
artficial intelligenceartficial intelligence
artficial intelligence
 
Thoery of Computaion and Chomsky's Classification
Thoery of Computaion and Chomsky's ClassificationThoery of Computaion and Chomsky's Classification
Thoery of Computaion and Chomsky's Classification
 
First order logic
First order logicFirst order logic
First order logic
 
Discrete Structures lecture 2
 Discrete Structures lecture 2 Discrete Structures lecture 2
Discrete Structures lecture 2
 
A new technique for proving non regularity based on the measure of a language
A new technique for proving non regularity based on the measure of a languageA new technique for proving non regularity based on the measure of a language
A new technique for proving non regularity based on the measure of a language
 
Chomsky hierarchy
Chomsky hierarchyChomsky hierarchy
Chomsky hierarchy
 
Mathematical Logic
Mathematical LogicMathematical Logic
Mathematical Logic
 
Lambda hardcore
Lambda hardcoreLambda hardcore
Lambda hardcore
 
Logic, contrapositive, converse, Discrete Mathematics, conjunction, negation
Logic, contrapositive, converse, Discrete Mathematics, conjunction, negationLogic, contrapositive, converse, Discrete Mathematics, conjunction, negation
Logic, contrapositive, converse, Discrete Mathematics, conjunction, negation
 

Viewers also liked

Dynamic Programming Over Graphs of Bounded Treewidth
Dynamic Programming Over Graphs of Bounded TreewidthDynamic Programming Over Graphs of Bounded Treewidth
Dynamic Programming Over Graphs of Bounded TreewidthASPAK2014
 
Adapting to case management
Adapting to case managementAdapting to case management
Adapting to case managementTom Shepherd
 
Event Driven Architecture (EDA), November 2, 2006
Event Driven Architecture (EDA), November 2, 2006Event Driven Architecture (EDA), November 2, 2006
Event Driven Architecture (EDA), November 2, 2006Tim Bass
 
[263] s2graph large-scale-graph-database-with-hbase-2
[263] s2graph large-scale-graph-database-with-hbase-2[263] s2graph large-scale-graph-database-with-hbase-2
[263] s2graph large-scale-graph-database-with-hbase-2NAVER D2
 
Gladiator, GUI management tool of ROMA (NOSQL based ruby).
Gladiator, GUI management tool of ROMA (NOSQL based ruby).Gladiator, GUI management tool of ROMA (NOSQL based ruby).
Gladiator, GUI management tool of ROMA (NOSQL based ruby).Rakuten Group, Inc.
 
What every Enterprise Architect needs to know about BPM and Workflow
What every Enterprise Architect needs to know about BPM and WorkflowWhat every Enterprise Architect needs to know about BPM and Workflow
What every Enterprise Architect needs to know about BPM and WorkflowMichael zur Muehlen
 
Lecture 5 - Agent communication
Lecture 5 - Agent communicationLecture 5 - Agent communication
Lecture 5 - Agent communicationAntonio Moreno
 
Taming The Unpredictable: Real-World Adaptive Case Management
Taming The Unpredictable: Real-World Adaptive Case ManagementTaming The Unpredictable: Real-World Adaptive Case Management
Taming The Unpredictable: Real-World Adaptive Case ManagementKeith Swenson
 
Chapter 2: Relations
Chapter 2: RelationsChapter 2: Relations
Chapter 2: Relationsnszakir
 
Part 1 A Simple Introduction to Complex Event Processing
Part 1 A Simple Introduction to Complex Event ProcessingPart 1 A Simple Introduction to Complex Event Processing
Part 1 A Simple Introduction to Complex Event ProcessingWoojin Joe
 
Semantic Complex Event Processing
Semantic Complex Event ProcessingSemantic Complex Event Processing
Semantic Complex Event ProcessingAdrian Paschke
 
Titan: Big Graph Data with Cassandra
Titan: Big Graph Data with CassandraTitan: Big Graph Data with Cassandra
Titan: Big Graph Data with CassandraMatthias Broecheler
 

Viewers also liked (15)

Dynamic Programming Over Graphs of Bounded Treewidth
Dynamic Programming Over Graphs of Bounded TreewidthDynamic Programming Over Graphs of Bounded Treewidth
Dynamic Programming Over Graphs of Bounded Treewidth
 
Relations
RelationsRelations
Relations
 
Adapting to case management
Adapting to case managementAdapting to case management
Adapting to case management
 
Event Driven Architecture (EDA), November 2, 2006
Event Driven Architecture (EDA), November 2, 2006Event Driven Architecture (EDA), November 2, 2006
Event Driven Architecture (EDA), November 2, 2006
 
[263] s2graph large-scale-graph-database-with-hbase-2
[263] s2graph large-scale-graph-database-with-hbase-2[263] s2graph large-scale-graph-database-with-hbase-2
[263] s2graph large-scale-graph-database-with-hbase-2
 
Montali - DB-Nets: On The Marriage of Colored Petri Nets 
and Relational Data...
Montali - DB-Nets: On The Marriage of Colored Petri Nets 
and Relational Data...Montali - DB-Nets: On The Marriage of Colored Petri Nets 
and Relational Data...
Montali - DB-Nets: On The Marriage of Colored Petri Nets 
and Relational Data...
 
Gladiator, GUI management tool of ROMA (NOSQL based ruby).
Gladiator, GUI management tool of ROMA (NOSQL based ruby).Gladiator, GUI management tool of ROMA (NOSQL based ruby).
Gladiator, GUI management tool of ROMA (NOSQL based ruby).
 
What every Enterprise Architect needs to know about BPM and Workflow
What every Enterprise Architect needs to know about BPM and WorkflowWhat every Enterprise Architect needs to know about BPM and Workflow
What every Enterprise Architect needs to know about BPM and Workflow
 
Agent architectures
Agent architecturesAgent architectures
Agent architectures
 
Lecture 5 - Agent communication
Lecture 5 - Agent communicationLecture 5 - Agent communication
Lecture 5 - Agent communication
 
Taming The Unpredictable: Real-World Adaptive Case Management
Taming The Unpredictable: Real-World Adaptive Case ManagementTaming The Unpredictable: Real-World Adaptive Case Management
Taming The Unpredictable: Real-World Adaptive Case Management
 
Chapter 2: Relations
Chapter 2: RelationsChapter 2: Relations
Chapter 2: Relations
 
Part 1 A Simple Introduction to Complex Event Processing
Part 1 A Simple Introduction to Complex Event ProcessingPart 1 A Simple Introduction to Complex Event Processing
Part 1 A Simple Introduction to Complex Event Processing
 
Semantic Complex Event Processing
Semantic Complex Event ProcessingSemantic Complex Event Processing
Semantic Complex Event Processing
 
Titan: Big Graph Data with Cassandra
Titan: Big Graph Data with CassandraTitan: Big Graph Data with Cassandra
Titan: Big Graph Data with Cassandra
 

Similar to App a

Propositional logic(part 2)
Propositional logic(part 2)Propositional logic(part 2)
Propositional logic(part 2)SURBHI SAROHA
 
Introduction to the theory of computation
Introduction to the theory of computationIntroduction to the theory of computation
Introduction to the theory of computationprasadmvreddy
 
Theory of Computation Lecture Notes
Theory of Computation Lecture NotesTheory of Computation Lecture Notes
Theory of Computation Lecture NotesFellowBuddy.com
 
Predicates and quantifiers presentation topics
Predicates  and quantifiers  presentation topicsPredicates  and quantifiers  presentation topics
Predicates and quantifiers presentation topicsR.h. Himel
 
Formal methods 1 - introduction
Formal methods   1 - introductionFormal methods   1 - introduction
Formal methods 1 - introductionVlad Patryshev
 
INFO-2950-Languages-and-Grammars.ppt
INFO-2950-Languages-and-Grammars.pptINFO-2950-Languages-and-Grammars.ppt
INFO-2950-Languages-and-Grammars.pptLamhotNaibaho3
 
Logic in Predicate and Propositional Logic
Logic in Predicate and Propositional LogicLogic in Predicate and Propositional Logic
Logic in Predicate and Propositional LogicArchanaT32
 
practice-final-soln.pdf
practice-final-soln.pdfpractice-final-soln.pdf
practice-final-soln.pdfT17Rockstar
 
Predicate logic_2(Artificial Intelligence)
Predicate logic_2(Artificial Intelligence)Predicate logic_2(Artificial Intelligence)
Predicate logic_2(Artificial Intelligence)SHUBHAM KUMAR GUPTA
 
Mc0082 theory of computer science
Mc0082  theory of computer scienceMc0082  theory of computer science
Mc0082 theory of computer sciencesmumbahelp
 
Chomsky classification for types of grammars
Chomsky classification for types of grammarsChomsky classification for types of grammars
Chomsky classification for types of grammarsVikrantSharma506366
 
Du Calcul des prédicats vers Prolog
Du Calcul des prédicats vers PrologDu Calcul des prédicats vers Prolog
Du Calcul des prédicats vers PrologSerge Garlatti
 
Pwl rewal-slideshare
Pwl rewal-slidesharePwl rewal-slideshare
Pwl rewal-slidesharepalvaro
 

Similar to App a (20)

Propositional logic(part 2)
Propositional logic(part 2)Propositional logic(part 2)
Propositional logic(part 2)
 
Introduction to the theory of computation
Introduction to the theory of computationIntroduction to the theory of computation
Introduction to the theory of computation
 
Theory of Computation Lecture Notes
Theory of Computation Lecture NotesTheory of Computation Lecture Notes
Theory of Computation Lecture Notes
 
Logic agent
Logic agentLogic agent
Logic agent
 
Predicates and quantifiers presentation topics
Predicates  and quantifiers  presentation topicsPredicates  and quantifiers  presentation topics
Predicates and quantifiers presentation topics
 
Formal methods 1 - introduction
Formal methods   1 - introductionFormal methods   1 - introduction
Formal methods 1 - introduction
 
Geuvers slides
Geuvers slidesGeuvers slides
Geuvers slides
 
INFO-2950-Languages-and-Grammars.ppt
INFO-2950-Languages-and-Grammars.pptINFO-2950-Languages-and-Grammars.ppt
INFO-2950-Languages-and-Grammars.ppt
 
Logic in Predicate and Propositional Logic
Logic in Predicate and Propositional LogicLogic in Predicate and Propositional Logic
Logic in Predicate and Propositional Logic
 
practice-final-soln.pdf
practice-final-soln.pdfpractice-final-soln.pdf
practice-final-soln.pdf
 
1. Logic and Proofs.ppt
1. Logic and Proofs.ppt1. Logic and Proofs.ppt
1. Logic and Proofs.ppt
 
Predicate logic_2(Artificial Intelligence)
Predicate logic_2(Artificial Intelligence)Predicate logic_2(Artificial Intelligence)
Predicate logic_2(Artificial Intelligence)
 
Mc0082 theory of computer science
Mc0082  theory of computer scienceMc0082  theory of computer science
Mc0082 theory of computer science
 
R meetup lm
R meetup lmR meetup lm
R meetup lm
 
Truth table
Truth tableTruth table
Truth table
 
Chomsky classification for types of grammars
Chomsky classification for types of grammarsChomsky classification for types of grammars
Chomsky classification for types of grammars
 
Du Calcul des prédicats vers Prolog
Du Calcul des prédicats vers PrologDu Calcul des prédicats vers Prolog
Du Calcul des prédicats vers Prolog
 
Predicate Calculus
Predicate CalculusPredicate Calculus
Predicate Calculus
 
AI-09 Logic in AI
AI-09 Logic in AIAI-09 Logic in AI
AI-09 Logic in AI
 
Pwl rewal-slideshare
Pwl rewal-slidesharePwl rewal-slideshare
Pwl rewal-slideshare
 

Recently uploaded

MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesManik S Magar
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...itnewsafrica
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Nikki Chapple
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...itnewsafrica
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 

Recently uploaded (20)

MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 

App a

  • 2. Why Quite often, we've found, teaching theory, Formal methods are meant to elide Undergrads are bored, puzzled and weary. Ideas we aspire to confide. ``Sterile proofs are from Hell-- So to ``lemma,'' ``parameter,'' Teach us HTML!'' Add ``iambic pentameter.'' They don't get it--in turn, we're left teary. This should help students' ennui subside. But good theorems don't formally hide Pedagogy's best shown by example. The human emotion supplied Ensuite, you are offered a sample In their proofs' demonstration. In the hope you're not wincing. Scientific elation Find our thesis convincing-- Belongs not in formaldehyde. We expect explanations are ample. Rigor without mortis, our goal, Is for sure a negotiable shoal-- We need not run aground. Martin Cohn In our teaching, we've found Harry Mairson A proof's spirit, in verse, is made whole. Computer Science Department Brandeis University
  • 3. Overview • Theory of computation: – Intensively studied in first half of 20th century. – Started by mathematicians and logicians. – Later, became an independent academic discipline and was separated from mathematics. – Some pioneers: • Alonzo Church: Lambda calculus • Kurt Godel (1906-1978): Incompleteness theorems, Godel prize (5000) • Alan Turing (1912-1954): Turing machine • Stephen Kleene (1909-1994): Kleene star, regular expression • John von Neumann (1903-1957): game theory • Claude Shannon (1916-2001): father of information theory • Noam Chomsky (1928-): CNF, Chomsky hierarchy • Central areas: Automata, Computability, Complexity • Computability: What are the fundamental capabilities and limitations of computers? – Classify problems as solvable and unsolvable • Complexity: What makes some problems computationally hard and others easy? – Classify solvable problems as easy ones and hard ones • Both deal with formal models of computation: Turing machines, recursive functions, lambda calculus, and production systems
  • 4. Overview • Automata theory: study of abstract machines and problems they are able to solve. – closely related to formal language theory as the automata are often classified by the class of formal languages they are able to recognize. – An abstract machine, also called an abstract computer, is a theoretical model of a computer hardware or software system used in automata theory. – A typical abstract machine consists of a definition in terms of input, output, and the set of allowable operations used to turn the former into the latter. E.g., FSM, PDA, Turing machine. • Formal languages: A set of strings over a given alphabet. – In contrast to natural language – Often defined by formal grammar, which is a set of formation rules that describe which strings formed from the alphabet of a formal language are syntactically valid. – Used for the precise definition of data formats and the syntax of program. languages. – Play a crucial role in the development of compilers. – Used in logic / foundations of mathematics to represent the syntax of formal theories – Regular languages, context-free languages, context-sensitive languages, recursive languages (decidable), recursively enumerable languages (semi-decidable) – Formal language theory uses separate formalisms, automata, to describe their recognizers.
  • 5. Grammars, Languages, and Machines Generates Language Grammar Recognizes or Accepts Machine
  • 7. The Chomsky Hierarchy (Recursively enumerable) Recursive languages (decidable) are not included
  • 8. The Chomsky Hierarchy Production rules Grammar Languages Automaton (constraints) Type-0 Recursively enumerable Turing machine (no restrictions) Linear-bounded non- Type-1 Context-sensitive deterministic Turing machine Non-deterministic pushdown Type-2 Context-free automaton Type-3 Regular Finite state automaton • Summarizes each of Chomsky's four types of grammars, the class of language it generates, the type of automaton that recognizes it, and the form its rules must have. • There are other categories of formal languages not included, e.g., recursive
  • 9. Noam Chomsky • 1928 – • Professor emeritus at MIT • Father of modern linguistics • Still holds office • Chomsky normal form (CNF) • context-free grammar • Controversial political critic • Often receives undercover police protection
  • 11. 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.
  • 12. Truth Tables Define Operators P Q ¬P P∨ Q P∧ Q P→ Q P↔ Q True True False True True True True True False False True False False False False True True True False True False False False True False False True True
  • 13. 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.
  • 14. Using Truth Tables P ∨ ¬P is a tautology: P ¬P P ∨ ¬P True False True False True True
  • 15. 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).
  • 16. 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).
  • 17. 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
  • 18. 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.
  • 19. 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.
  • 20. 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.
  • 21. 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.
  • 22. Truth • 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)). Which of these are true in the everyday world?
  • 23. 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.
  • 24. Examples ∀ ∀x ((P(x) ∧ Q(Smoky)) → P(x)). ∀ ¬(∀x (P(x) ∨ ¬(P(x))). ∀ ∀x (P(x, x)).
  • 25. 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)).
  • 26. 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].)
  • 27. Theory • A first order theory is a set of axioms and the set of all theorems that can be proved, using a set of sound and complete inference rules, from those axioms. • A theory is consistent iff there is no sentence P such that both P and ¬ P are theorems. • inconsistent: contains such a contradiction. • Let w be a world plus an interpretation (that maps logical objects to objects in the world). We say a theory is sound w.r.t. w iff every theorem in the theory corresponds to a fact that is true in w. We say a theory is complete w.r.t. w iff every fact that is true in w corresponds to a theorem in the theory.
  • 28. 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.
  • 29. Kurt Gödel • 1906 – 1978. One of the greatest logicians of all time • Gödel and Einstein … were known to take long walks together to and from the Institute for Advanced Study. … toward the end of his life Einstein confided that his "own work no longer meant much, that he came to the Institute merely…to have the privilege of walking home with Gödel. " • 1947, Einstein … accompanied Gödel to his U.S. citizenship exam, where they acted as witnesses. Gödel had confided in them that he had discovered an inconsistency in the U.S. Constitution, one that would allow the U.S. to become a dictatorship • In later life, suffered periods of mental instability… fear of being poisoned; wouldn't eat unless his wife tasted his food for him. Late in 1977, wife was hospitalized for six months. In her absence, he refused to eat, eventually starving himself to death. He weighed 65 pounds when he died.
  • 30. Extensions • Propositional logic • First order logic: use variables – Range over individuals • Second order logic – Additional variables that range over sets of individuals – E.g., ∀P∀x(x ∈ P ∨ x ∉ P). • Higher order logic – A predicate can take one or more other predicates as arguments
  • 31. 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}.
  • 32. Sets • ℕ = the nonnegative integers (also called the natural numbers). • Z = the integers ( … -3, -2, -1, 0, 1, 2, 3, …).
  • 33. 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}.
  • 34. Defining a Set Using Programs • Write a program that enumerates the elements of S. • Write a program that decides S 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. – A characteristic function can be used to determine whether or not a given element is in S. • Formally, a function f with domain Domain is a characteristic function of a set S iff f(x) = True if x is an element of S and False otherwise. – Note, f must be total
  • 35. 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). • Empty set φ – so | φ | = 0. – |{φ}| = ?
  • 36. Relating Sets to Each Other
  • 37. 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}}.
  • 38. 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).
  • 39. 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|.
  • 40. 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)}.
  • 41. Binary Relations 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)} Binary relations are particularly useful and are often written as x R y.
  • 42. Relations 3-ary (ternary) relation: A × A × A {(Sara, Dave, Billy), (Beth, Mark, Cathy), (Cathy, Billy, Pete)} An n-ary relation over sets A1, A2, … An is a subset of: A1 × A2 × … × An. • A relation may be equal to {} • Dave, Sue, and Billy all hate dessert • no constraints on how many times a particular element may occur in a relation
  • 43. Composing Relations The composition of R1 ⊆ A × B and R2 ⊆ B × C, written R2 ° R1, is: R2 ° R1 = {(a, c) : ∃b ((a, b) ∈ R1 ∧ ((b, c) ∈ R2)} • R2 ° R1 ⊆ A × C • R1 ° R2 is fine, as long as consistent Dessert = {(Dave, cake), (Dave, ice cream), (Sara, pie), (Sara, ice cream)} Fatgrams = {(cake, 30), (pie, 25), (ice cream, 15)} Fatgrams ° Dessert = {(Dave, 30), (Dave, 15),
  • 44. Representing Relations Ways to represent a binary relation R: • List the elements of R. Mother-of = {(Doreen, Ann), (Ann, Catherine), (Catherine, Allison)} • Write a procedure that defines R either by: • Enumerating it. • Deciding it. • Encode R as an adjacency matrix. • Encode R as a directed graph.
  • 45. Representing a Binary Relation as an Adjacency Matrix Doreen Ann Catherine Allison Doreen 1 Ann 1 Catherine 1 Allison
  • 47. Properties of Relations R ⊆ A × A is reflexive iff, ∀x ∈ A ((x, x) ∈ R). Examples: • ≤ defined on the integers. For every integer x, x ≤ x.
  • 48. Properties of Relations R ⊆ A × A is symmetric iff ∀x, y ((x, y) ∈ R → (y, x) ∈ R). Examples: • = is symmetric. • ≤ is not symmetric.
  • 49. Properties of Relations R ⊆ A × A is antisymmetric iff ∀x, y ((x, y) ∈ R ∧ x ≠ y → (y, x) ∉ R) Examples? R ⊆ A × A is transitive iff ∀x, y, z (((x, y) ∈ R ∧ (y, z) ∈ R → (x, z) ∈ R) Examples?
  • 50. 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
  • 55. 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 iff: (a) no element of Π is empty; (b) all members of Π are disjoint; and (c) the union of all the elements of Π equals A.
  • 56. Equivalence Classes To describe equivalence classes, we’ll use the notation [x] to mean the equivalence class to which x belongs. In general, there are maybe lots of different ways to describe the same equivalence class. For example, [1], [2], [3] all describe the same equivalence class S that contains 1, 2, and 3
  • 57. Partial Orders A partial order is a relation that is: • reflexive • antisymmetric • transitive Let R be a partial order defined on a set A. Then the pair (A, R) is a partially ordered set. • Subset-of is a partial order defined on the set of all sets • Proper-Subset-of?
  • 58. Subset-of is a Partial Order • To make the graph relatively easy to read, we follow the convention that we do not write in the links that are required by reflexivity and transitivity.
  • 59. A Concept Hierarchy • A concept is a set of entities in the world. • Some concepts are more general than others. • We say a concept x is subsumed by a concept y (x ≤ y) iff every instance of x is also an instance of y. • Concept subsumption is a partial order.
  • 61. Total Orders A total order R ⊆ A × A is a partial order that has the additional property 6 that: ∀x, y ∈ A ((x, y) ∈ R ∨ (y, x) ∈ R). 5 Example: ≤ 4 If R is a total order defined on a set A, then the pair (A, R) is a totally 3 ordered set.
  • 62. 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.
  • 63. Well-Founded and Well-Ordered Sets (A, R) Well- Well- founded ordered The set of sets with respect to the subset-of Yes No relation The set of concepts with respect to subsumption Yes No The set of natural numbers under ≤ Yes Yes The set of integers under ≤ No No
  • 64. Functions A function f 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 )). • i.e., each element in A relates to exactly one element in B. • one to one is ok, many to one is ok, but not one to many Dessert = { (Dave, cake), (Dave, ice cream), (Sara, pie), (Sara, ice cream)} is not a function.
  • 65. Notations of Functions • f:A→B – A: domain – B: codomain or range – f is a function from A to B • Can define a function in two parts – the first specifies the domain and range – the second defines how elements are related succ: Z -> Z, succ(n) = n + 1. • succ is a unary function • +: (Z x Z) -> Z is a binary function
  • 66. 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 it is a function that is defined on a subset of A. • Partial functions generalizes total functions • Partial functions are often used when the “defined domain”, is not known (e.g. many functions in computability theory)
  • 67. Properties of Functions • f : A → B is one-to-one iff no two elements of A map to the same element of B. – injective – f is a injection • f : A → B is onto iff every element of B is the value of some element of A. – surjective – f is a surjection – the elements of B are covered • f : A → B is bijective if it is both injective and surjective – f is a bijection • the inverse of a bijection is also a function • if f ⊆ A × B, then f-1 ⊆ B × A = {(b, a): (a,b) ∈ f}
  • 69. Properties of Binary Functions A binary function # is commutative iff: ∀x, y ∈ A (x # y = y # x). i + j = j + i. (integer addition) A ∩ B = B ∩ A. (set intersection) P ∧ Q ≡ Q ∧ P. (Boolean and) A binary function # is associative iff: ∀x, y, z ∈ A ((x # y) # z = x # (y # z)). (i + j) + k = i + (j + k). (integer addition) (A ∩ B) ∩ C = A ∩ (B ∩ C). (set intersection) (P ∧ Q) ∧ R ≡ P ∧ (Q ∧ R). (Boolean and) (s || t) || w = s || (t || w). (string concatenation)
  • 70. Properties of Binary Functions A binary function # is idempotent iff ∀x ∈ A (x # x = x). min(i, i) = i. (integer minimum) A ∩ A = A. (set intersection) P∧P≡ (Boolean and) The distributivity property: A function # distributes over another function % iff: ∀x, y, z ∈ A (x # (y % z) = (x # y) % (x # z)). i⋅(j + k) = (i⋅j) + (i⋅k). (integer multiplication over addition) A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C). (set union over intersection) P ∧ (Q ∨ R) ≡ (P ∧ Q) ∨ (P ∧ Q). (Boolean and over or)
  • 71. Properties of Binary Functions Absorption laws also relate two binary functions to each other: A function # absorbs another function % iff: ∀x, y ∈ A (x # (x % y) = x)). A ∩ (A ∪ B) = A. (Set intersection absorbs union.) P ∨ (P ∧ Q) ≡ P. (Boolean or absorbs and.) P ∧ (P ∨ Q) ≡ P. (Boolean and absorbs or.)
  • 72. Identities An element a is an identity for the function # iff: ∀x ∈ A ((x # a = x) ∧ (a # x = x)). i⋅1 = i. (1 is an identity for integer multiplication.) i + 0 = i. (0 is an identity for integer addition.) A ∪ ∅ = A. (∅ is an identity for set union.) P ∨ False ≡ P. (False is an identity for Boolean or.) s || "" = s. ("" is an identity for string concatenation.)
  • 73. Zeros An element a is a zero for the function # iff: ∀x ∈ A ((x # a = a) ∧ (a # x = a)). i⋅0 = 0. (0 is a zero for integer multiplication.) A ∩ ∅ = ∅. (∅ is a zero for set intersection.) P ∧ False ≡ False. (False is a zero for Boolean and.)
  • 74. Self Inverses A unary function $ is a self inverse iff: ∀x ($($(x)) = x). -(-(i)) = i. (Multiplying by -1 is a self inverse for integers.) 1/(1/i) = i if i ≠ 0. (Dividing into 1 is a self inverse for integers.) ¬¬A = A. (Complement is a self inverse for sets.) ¬(¬ P) = P. (Negation is a self inverse for Booleans.) (sR)R = s. (Reversal is a self inverse for strings.)
  • 75. Properties of Functions on Sets Commutativity: A ∪ B = B ∪ A. A ∩ B = B ∩ A. Associativity: (A ∪ B) ∪ C = A ∪ (B ∪ C). (A ∩ B) ∩ C = A ∩ (B ∩ C). Idempotency: A ∪ A = A. A ∩ A = A. Distributivity: A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C). A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C). Absorption: (A ∪ B) ∩ A = A. (A ∩ B) ∪ A = A. Identity: A ∪ ∅ = A. Zero: A ∩ ∅ = ∅. Self Inverse: ¬¬A = A.
  • 76. Closures A binary relation R on a set A is closed under property P iff R possesses P. • ≤ on the integers, P = transitivity Sometimes, if R is not closed under P, we may want to ask what elements would have to be added to R to make it closed under P. The closure of R under P is a smallest set that includes R and that is closed under P.
  • 77. Closures Let R = {(1, 2), (2, 3), (3, 4)}. The transitive closure of R is: The reflexive closure of R is:
  • 78. Closures Let R = {(1, 2), (2, 3), (3, 4)}. The transitive closure of R is: {(1, 2), (2, 3), (3, 4), (1, 3), (1, 4), (2, 4)} The reflexive closure of R is: {(1, 2), (2, 3), (3, 4), (1, 1), (2, 2), (3, 3), (4, 4)}
  • 79. Proof Techniques • Proof by construction • Proof by contradiction • Proof by counterexample • Proof by case enumeration • Mathematical induction • The pigeonhole principle • Proving cardinality • Diagonalization • Reasoning about programs
  • 80. Proof by Construction ∀ ∃x(Q(x)) ∀ ∀x(∃y(P(x,y))) • On way to prove the assertion is to show an algorithm that finds the value that we claim must exist. • Example: There is an infinite number of primes.
  • 81. An Infinite Number of Primes Assume that the set P of prime numbers is finite. So there exists some value of n such that P = {p1, p2, p3, … pn}. Let: q = (p1p2p3 … pn) + 1. Since q is greater than each pi, it is not on the list of primes. So it must be composite and have at least one prime factor pk ∈ P. Then q must have at least one other factor, some integer i such that: q = ipk. (p1p2p3 … pn) + 1 = ipk. (p1p2p3 … pn) - ipk = -1. Since pk is prime, it divides both terms on the left. Factoring it out, we get: pk(p1p2pk-1pk+1 … pn - i) = -1. pk = -1/(p1p2pk-1pk+1 … pn - i). But, since (p1p2pk-1pk+1 … pn - i) is an integer, this means that |pk| < 1. But that cannot be true since pk is prime and thus greater than 1. So q is not composite. Since q is greater than 1 and not composite, it must be prime, contradicting the assumption that all primes are in the set {p1, p2, p3, … pn}.
  • 82. Prove by Counterexample • One is enough Consider the following claim: Let A, B, and C be any sets. If A - C = A - B then B = C. We show that this claim is false with a counterexample: Let A = ∅, B = {1}, and C = {2}. A - C = A - B = ∅. But B ≠ C.
  • 83. Proof by Case Enumeration Suppose that the postage required to mail a letter is always at least 6¢. Prove that it is possible to apply any required postage to a letter given only 2¢ and 7¢ stamps. We prove this general claim by dividing it into two cases, based on the value of n, the required postage: • If n is even (and 6¢ or more), apply n/2 2¢ stamps. • If n is odd (and 6¢ or more), then n ≥ 7 and n-7 ≥ 0 and is even. 7¢ can be applied with one 7¢ stamp. Apply one 7¢ stamp and (n-7)/2 2¢ stamps.
  • 84. Mathematical Induction The principle of mathematical induction: If: P(b) is true for some integer base case b, and For all integers n ≥ b, P(n) → P(n+1) Then: For all integers n ≥ b, P(n) An induction proof has three parts: • A clear statement of the assertion P. • A proof that that P holds for some base case b, the smallest value with which we are concerned. • A proof that, for all integers n ≥ b, if P(n) then it is also true that P(n+1). We’ll call the claim P(n) the induction hypothesis.
  • 85. Sum of First n Positive Integers The sum of the first n odd positive integers is n2. We first check for plausibility: (n = 1) 1 = 1 = 1 2. (n = 2) 1 + 3 = 4 = 2 2. (n = 3) 1 + 3 + 5 = 9 = 3 2. (n = 4) 1 + 3 + 5 + 7 = 16 = 42, and so forth. The claim appears to be true, so we should prove it.
  • 86. Sum of First n Positive Integers Let Oddi = 2(i – 1) + 1 denote the ith odd positive integer. Then we can rewrite the claim as: n ∀n ≥ 1 (∑ Odd i = n ) 2 i =1 The proof of the claim is by induction on n: Base case: take 1 as the base case. 1 = 12. n n +1 Prove: ∀n ≥ 1((∑ Odd i = n ) → (∑ Odd i = (n + 1) 2 )) 2 i =1 i =1 n +1 n ∑ Odd i = ∑ Odd i =1 i + Odd n +1 i =1 = n2+ Oddn+1. (Induction hypothesis.) = n2 + 2n + 1. (Oddn+1 = 2(n+1–1) + 1 = 2n + 1.) = (n + 1)2.
  • 87. Pigeonhole Principle Suppose that we have n pigeons and k holes. Each pigeon must fly into a hole. If n > k, then there must be at least one hole that contains more than one pigeon. More formally, Consider any function f: A → B. The pigeonhole principle says: If |A| > |B| then f is not one-to-one.
  • 88. Cardinality We will be concerned with three cases: • finite sets, • countably infinite sets, and • uncountably infinite sets. A set A is finite and has cardinality n ∈ ℕ iff either: • A = ∅, or • there is a bijection from {1, 2, … n} to A, for some n. A set is infinite iff it is not finite.
  • 89. Countably Infinite Sets ℕ is countably infinite. Call its cardinality ℵ0. A is countably infinite and also has cardinality ℵ0 iff there exists some bijection f : ℕ → A. A set is countable iff it is either finite or countably infinite. To prove that a set A is countably infinite, it suffices to find a bijection from ℕ to it.
  • 90. Even Numbers The set E of even natural numbers is countably infinite. To prove this, we offer the bijection: Even : ℕ → E, Even(x) = 2x. ℕ E 0 0 1 2 2 4 3 6 … …
  • 91. Enumerations Sometimes, bijection is not as obvious. Then a good way to think about the problem of finding a bijection from ℕ to some set A, is to turn it into the problem of finding an enumeration of A. An enumeration of a set A is simply a list of the elements of A in some order. Each element of A must occur in the enumeration exactly once.
  • 92. Enumerating Countably Infinite Sets Theorem: A set A is countably infinite iff there exists an infinite enumeration of it. Proof: We prove the if and only-if parts separately. If A is countably infinite, then there exists an infinite enumeration of it: Since A is countably infinite, there exists a bijection f from ℕ to it. We construct an infinite enumeration of A as follows: For all i ≥ 1, the ith element of the enumeration of A will be f(i - 1). If there exists an infinite enumeration E of A, then A is countably infinite: Define f: ℕ → A, where f(i) is the (i+1)st element of the list E. The function f is a bijection from ℕ to A, so A is countably infinite. Note: used to show “countably infinite”, as well as “not countably infinite”
  • 93. Finite Union Theorem: The union U of a finite number of countably infinite sets is countably infinite. Proof: by enumeration of the elements of U: S1[1], S2[1], … Sn[1], S1[2], S2[2], … Sn[2], … checking before inserting each element to make sure that it is not already there. Can we do this? Enumerating all the elements of the 1st set, then the 2nd …
  • 94. Countably Infinite Union Theorem: The union U of a countably infinite number of countably infinite sets is countably infinite. Proof: by enumeration of the elements of U. • Note: use the previous simple enumeration technique, we’d never et to the 2nd element of any sets … • check make sure the element not already there
  • 95. Diagonalization • Cantor's diagonal argument • 1891 by Georg Cantor, there are infinite sets that are more numerous than natural numbers • His first proof about “real numbers are more numerous than natural numbers” appeared in 1874 • but this is a more powerful and general technique • Used in a wide range of proofs: chain of influence • Russell’s paradox • Godel’s incompleteness theorems • Turing's answer to the Entscheidungsproblem • Turing’s undecidability of the Halting problem Georg Cantor (1845 – 1918 ) • German mathematician • Creator of modern set theory, introduced infinity in set theory • Diagonal argument
  • 96. Russell’s Paradox • By Bertrand Russell in 1901 • Showed that the naive set theory leads to a contradiction. • A set exists whose members are those objects (and only those objects) that satisfy the criterion; but this assumption is disproved by: A set containing exactly the sets that are not members of themselves • Applied version: there are some versions of this paradox that are closer to real-life situations and may be easier to understand for non-logicians. • Barber paradox: A barber shaves all and only those men in town who do not shave themselves. • When one thinks about whether the barber should shave himself or not, the paradox begins to emerge. • Applications: • By Kurt Gödel, in incompleteness theorem by formalizing the paradox • By Turing, in undecidability of the Halting problem (and with that the Entscheidungsproblem) by using the same trick
  • 97. Russell’s Paradox In the middle of the night I got such a fright that woke me with a start, For I dreamed of a set that contained itself, in toto, not in part. If sets can thus contain themselves, then they might also fail To hold themselves as members, and this leads me to my tale. Now Frege thought he finally had the world inside a box, So he wrote a lengthy tome, but up popped paradox. Russell asked, ``You know that Epimenides said oft A Cretan who tells a lie does tell the truth, nicht war, dumkopf? And here's a poser you must face if continue thus you do, What make you of the following thought, tell me, do tell true. The set of all sets that contain themselves might cause a soul to frown, But the set of all sets that don't contain themselves will bring you down!'' Now Gottlob Frege was no fool, he knew his proof was fried. He published his tome, but in defeat, while in his beer he cried. And Bertrand Russell told about, in books upon our shelves, The barber in town who shaves all those who do not shave themselves.
  • 98. Bertrand Russell Bertrand Russell (1872 – 1970) • English philosopher, logician, mathematician … • In 1950, awarded Nobel in literature • Russell’s family, one of the most influential in England, politically, land-owning, Earl, Duke, Baron, prime minister • Has a (even more) famous student, Ludwig Wittgenstein • The two are widely referred to as the greatest philosophers of last century Ludwig Wittgenstein (1889 – 1951) • Wittgenstein family, Jewish, one of the richest in the world • 3 of 4 brothers suicide • Famous schoolmate: Adolf Hitler (6 days older, 2 grades below), were 14 or 15 years old. • Some say they never knew each other. Some say the interaction/competition/conflict/jealousy generated hatred toward Jews, thus changed the history • Alan Turing attended his lectures at Cambridge after coming back from Princeton (with Alonzo Church)
  • 99. Diagonalization • ℕ is countably infinite. Call its cardinality ℵ0. • There are sets with more than ℵ0 elements (not countably infinite) • e.g., set of real numbers • The power set of the integers is not countable. • S is a countably infinite set, P(S) is not countable. • To prove it, use diagnonalization. • Proof by contradiction. • To show a set A is not countably infinite, we assume that it is, in which case there would be some enumeration of it. Every element of A would have to be on that list somewhere. • But we show how to construct an element of A that cannot be on the list, no matter how the list was constructed. • Thus, there exists no enumeration of A, so A is not countably infinite.
  • 100. Diagonalization S is a countably infinite set, P(S) is not countable. Elem 1 of S Elem 2 of S Elem 3 of S Elem 4 of S Elem 5 of S ……. Elem 1 of P(S) 1 (1) ….. Elem 2 of P(S) 1 (2) ….. Elem 3 of P(S) 1 1 (3) ….. Elem 4 of P(S) 1 (4) ….. Elem 5 of P(S) 1 1 (5) ….. … ….. A set that is not in the table: ¬(1) ¬(2) ¬(3) ¬(4) ¬(5) …..
  • 101. Reasoning About Programs • Correctness properties, including: • The program eventually halts. • When it halts, it has produced the desired output. • Performance properties, including: • Time requirements, and • Space requirements.
  • 102. Proving Halting To prove termination of a program P with a loop, we will generally rely on the existence of some well-founded set (S, R) such that: • There exists some bijection between each step of P and some element of the set S, • The first step of P corresponds to a maximal (with respect to R) element of S, • Each successive step of P corresponds to a smaller (with respect to R) element of S, and • P halts on or before it executes a step that corresponds to a minimal (with respect to R) element of S.
  • 103. Choosing a Well-Founded Set P(s: string) = While length(s) > 0 do: Remove the first character from s and call it c. if c = a return True. Return False. Let S = {0, 1, 2, …, |s|}. (S, ≤) is a well-founded set whose least element is 0. Associate each step of the loop with |s| as the step is about to be executed. The first pass through the loop is associated the initial length of s, which is the maximum value of |s| throughout the computation. |s| is decremented by one each time through the loop. P halts when |s| is 0 or before (if it finds the character a). So the maximum number of times the loop can be executed is the initial value of |s|.
  • 104. Proving a Program Computes Correct Result • Loop Invariants: a predicate I that describes a property that does not change during the execution of an iterative process. • Induction
  • 105. Loop Invariants To use a loop invariant I, we must prove: • I is true on entry to the loop. • The truth of I is maintained at each pass through the loop. • I, together with the loop termination condition, imply whatever property we wish to prove is true on exit from the loop.
  • 106. The Coffee Can Problem Given a coffee can that contains some white beans and some black beans, do: Until no further beans can be removed do: 1. Randomly choose two beans. 2. If the two beans are the same color, throw both of them away and add a new black bean. 3. If the two beans are different colors, throw away the black one and return the white one to the can. • This process must halt. • What color is the remaining bean?

Editor's Notes

  1. the inside beauty enum.txt
  2. John Forbes Nash, a beautiful mind. Computational complexity theory: Neighboring fields of study inside theoretical computer science are analysis of algorithms and computability theory. A key distinction between computational complexity theory and analysis of algorithm is that the latter is devoted on analyzing the amount of resources needed by a particular algorithm to solve a concrete problem, whereas the former asks a more general question. Namely, it targets at classifying problems that can, or cannot, be solved with appropriately restricted resources. In turn, imposing restrictions on the available resources distinguishes computational complexity from computability theory: the latter asks what kind of problems can be solved at all (within a given computational model).
  3. A proposition is a statement that has a truth value.
  4. Iff
  5. ^: Conjunction (and) v: disjunction (or) Negation (not) -&gt; conditoinal (if … then) &lt;-&gt;: biconditional (iff) Idempotent: multiple applications of the operation do not change the result
  6. Double negation: also referred to as involution
  7. Primitives in boolean logic are predicates of no arguments FOL allows the use of variables
  8. In plain english?
  9. 3
  10. Determining whether or not a sentence is true requires appeal to the meanings of the constants, functions, and predicates that it contains. The integers (along with the usual meaning of &lt;) are a model of w since, for any integer, there exists some smaller integer. The positive integers, on the other hand, are an interpretation for w but not a model of it. The sentence w is false for the positive integers since there is no positive integer that is smaller than 1.
  11. Valid Unsatisfiable Satisfiable: suppose that the universe is the integers and P is the predicate LessThanOrEqualTo, then P is true for all values of x. Suppose P is LessThan, then P is false for all values of x.
  12. A theory is produced by a set of sound and complete inference rules. However, a theory may not be sound and complete. It depends on the interpretation. A theory is used to represent the world w. The theory is sound if every theorem in it makes sense, i.e., explains or reflects some fact in w. The theory is complete if every fact in w can be explained by some theorem in the theory.
  13. : such that S6 and S7 are the same Sets S1, S2, and S3 are equal
  14. Venn diagrams illustrating relations and functions on sets. Union, intersection, difference, complement, disjount
  15. Inverse of a binary relation
  16. b. If there are two elements x and y, and both (x, y) and (y, x) are in R, we will usually draw a graph as shown in b. note, it’s not a directed graph, to be precise. Also common, undirected graph. c. Directed graph technique also applies if R is a relation over two different sets A and B. see c for the Fatgrams relation. Usually, a bipartite graph. Then, how about A x B x C … hypergraphs …
  17. Representing a reflexive relation
  18. R: Same-gender is an equivalence relation, being reflexive, symmetric, and transitive. It carves S: all students into two equivalence classes, m students and f students, which form a partition.
  19. Not reflexive
  20. Alternative definition of domain: many recursive theorists refer to this “defined domain” (or domain of definition) as the domain of the function http://en.wikipedia.org/wiki/Partial_function That’s why in http://en.wikipedia.org/wiki/Computable_function : A set of natural numbers is called  computably enumerable  (synonyms:  recursively enumerable ,  semidecidable ) if there is a computable function  f  such that for each number  n ,  f(n)  is defined  if and only if   n  is in the set. (this is ok with both definitions) Thus a set is computably enumerable if and only if it is the domain of some computable function. (this is ok for the alternative definition of domain) ======================= If the “defined domain” is always known, then no need to distinguish partial and total. Just use the alternative definition
  21. 1: is a function but not total, now we only consider total functions, where all elements in the domain are covered. 2: not a function 3: function, but neither one to one nor onto 4: one to one but not onto 5: not one to one, but onto 6. bijection
  22. The 1 st set is infinite, we will never get around to consider any of the elements of the other sets …
  23. Entscheidungsproblem: german for decision problem. posed by David Hilbert in 1928. The Entscheidungsproblem asks for an algorithm that will take as input a description of a formal language and a mathematical statement in the language and produce as output either &amp;quot;True&amp;quot; or &amp;quot;False&amp;quot; according to whether the statement is true or false. 
  24. Entscheidungsproblem: german for decision problem. posed by David Hilbert in 1928. The Entscheidungsproblem asks for an algorithm that will take as input a description of a formal language and a mathematical statement in the language and produce as output either &amp;quot;True&amp;quot; or &amp;quot;False&amp;quot; according to whether the statement is true or false. 
  25. Martin Cohn Harry Mairson Computer Science Department Brandeis University
  26. Turing suicide too. Seems deep thinkers think too much Don’t refuse eating (like Godel), don’t kill yourself, more importantly, don’t kill your instructor 
  27. white bean parity is preserved If originally odd white beans, white Otherwise, black