Download Lec2Logic

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Big O notation wikipedia , lookup

Infinity wikipedia , lookup

List of first-order theories wikipedia , lookup

Addition wikipedia , lookup

Elementary mathematics wikipedia , lookup

Computability theory wikipedia , lookup

Set theory wikipedia , lookup

Hyperreal number wikipedia , lookup

Birkhoff's representation theorem wikipedia , lookup

Order theory wikipedia , lookup

Naive set theory wikipedia , lookup

Transcript
Discrete Math 6A
Max Welling
Recap
1. Proposition: statement that is true or false.
2. Logical operators: NOT, AND, OR, XOR, , 
3. Compound proposition: a new proposition by combining old ones using operators.
4. Logical equivalences: pq always true.
5. Predicate: property of a statement with variables (>3).
6. Quantifier: “there is” , “for all”. These turn statements
with variables into propositions.
1.4 Nested Quantifiers
Nested Quantifier: Quantifier that appears within the scope of another quantifier.
Examples: x y ( x  y  0)
x,y real numbers.
xyz ( x  ( y  z )  ( x  y )  z ) x,y,z real. (associative law for addition).
xy ( x  0)  ( y  0)  ( xy  0)
x,y real.
-For all x and for all y if x is positive and y is negative then their product
must be negative.
-The product of a positive and a negative real number is negative.
Translate this sentence into a logical expressions.
“If a person is female and is a parent, then she is someone’s mother.”
F(x) is “x is female”, P(x) is “x is someone’s parent”, M(x,y), “x is the mother of y”
xy (( F ( x)  P( x))  M ( x, y )
1.4 Order of Quantifiers
Important: The order in which quantifiers occur can be very important!
i.e yx P( x, y )  xy P( x, y )
not always true.
Example:
yx ( x  y  0)  xy ( x  y  0)
x,y real.
Is this proposition true?
left: There is a y such that for all x (x+y=0). (F)
right: For all x there is a y such that x+y=0 (T)
Proposition is therefore False.
What do we learn? The order is important!
However the following compound propositions are always true.
Left and right are equivalent.
xyP( x, y )  yxP( x, y )
xy P( x, y )  yx P( x, y )
1.4 Nested Quantifiers
Tip: You can think of expression with quantifiers as executing “loops” in
a computer program:
Example:
yx P ( x, y )
First loop over y and and for every y loop over x.
For every value of y, check if P(x,y) is true for all x.
If you found one, the proposition must be true.
Examples on white board
1.6 Sets
Sets are the most fundamental discrete structure in mathematics.
A lot is based on it!
We now develop the formal theory of sets.
This basically boils down to a lot of definitions.
Set: Unordered collection of “objects”
We denote sets with capitals. The objects are also called “members”
or elements. Thus set A is said to contain its elements.
Example: V={a,e,i,o,u} (vowels in English)
brackets are used to define the set. {.}
C = all students subscribed to Math6A in spring 2003.
1.6 Sets
Well-known sets in math: N = {0,1,2,3,...}
Z = {...,-2,-1,0,1,2,...}
Z+ = {1,2,3,...}
Q = {p/q | p in Z, q in Z, q is not 0}
R = {x | x is a real number}.
{,...} is used to indicate the the rest of the sequence once it’s clear how to
proceed {1,2,3,...}
set builder notation: {x | conditions(x) }.
This could be read as “all x such that the conditions hold true”.
Definition: Two sets are equal iff they contain the same elements.
( A  B) iff x( x  A  x  B)
Example: {1 2 2 3 3 3 3 4 6 } = {1 2 3 4 6} = {6 4 1 3 2}
notation for “x is an
element of B”.
1.6 Sets
Subset: A is a subset of B iff every element of A is an element of B.
A  B iff x( x  A  x  B )
notation for:
“A is a subset
of B”
Example: all even integers are a subset of all integers.
all Math6A students are a subset of all students.
1.6 Sets
Venn diagrams
U
B
A
a
U: universal set: set of all objects under consideration.
1.6 Sets
Empty set: Set that contains no elements.
Attention:
  {}
  {}
Proposition: For any nonempty set S : (i )   S (ii ) S  S
Is this true?
(i)
  S iff x( x   x  S )
The premises:
(ii)
x
is false, and thus the implication is true.
S  S iff x( x  S  x  S )
Clearly the right is true, so the left must be true.
1.6 Sets.
Proper Subset: A is a proper subset of B iff A is a subset of B and A is not equal to B
A  B iff ( A  B)  ( A  B)
Sets may contain other sets as members!
Example: {0, {a},{b}, {a,b}} = {x|x is a subset of {a,b}}
Note “a” is not “{a}”.
Cardinality: The cardinality of A is the number of distinct elements in A: |A|.
Also: S is finite in this case.
Infinite set: a set that is not finite. (e.g. all integers, real numbers).
countable
uncountable
1.6 Sets
n
Power set: The power set P(A) of A is the set of all subsets of A. | P ({x1 ,..., xn }) | 2
Example: P({1,2,3}) = {O, {1},{2},{3},{1,2},{1,3},{2,3},{1,2,3}}
P(O) ={O}
Ordered n-Tuple: (a1,a2,...,an) is an ordered collection that has a1 is its
first element , a2 as its second etc.
Note: where sets are unordered this structure has ordered elements.
(a,b) and (b,a) are not the same unless a=b.
In general (a1,a2,a3,...an) = (b1,b2,b3,...bn) iff a1=b1, a2=b2, ...
1.6 sets
Cartesian product: The set of all ordered pairs (a,b) where a in A and b in B.
A  B  {(a, b) | a  A  b  B}
Note: we have mapped two sets to a new set.
Example: A={1,2,3} B={a,b}
AXB = {(1,a),(1,b),(2,a),(2,b),(3,a),(3,b)}.
Note that order in (.) is important, but order in {.} is not important.
AXB is not the same as BXA ! (unless A=B).
Examples on white board.