Mathematic for Computer Science Lecture 1

来源:互联网 发布:淘宝返现规定 编辑:程序博客网 时间:2024/06/05 00:36

Mathematic for Computer Science Lecture 1


Introduction & Proof

A Proof is a method for ascertaing the truth.

Amathematical proof is a verification of a proposition by chain oflogical deductions from a set of axiom.
Def: A proposition is a statement that is either True or False.

Ex: 2 + 3 = 5.
Ex: 1 + 1 = 3.


Compound Proposition

truth table of NOT(P)

PNOT(P)TFFT

Def: the proposition "P AND Q" is true only when P and Q are both true.

PQP AND QTTTTFFFTFFFF 
Def: the proposition "P OR Q" is true when either P or Q is true.

PQP OR QTTTTFTFTTFFF

truth table of "exclusive-or"(XOR)

PQP XOR QTTFTFTFTTFFF
Def: An implication is true exactly when the if-part is false or the then-part is true.

PQP IMPLIES QTTTTFFFTFFFT

Def: The proposition "P if and only if Q" asserts that P and Q are logically equivalent, either both are true or both are false.

PQP IFF QTTTTFFFTFFFT


Logically Equivalent Implications

PQP IMPLIES QNOT(Q) IMPLIES NOT(P)TTTTTFFFFTTTFFTT
In general, "NOT(Q) IMPLIES NOT(P)" is called the contrapositive of the implication "P IMPLIES Q".
An implication and its converse together are equivalent to an iff statement.

Propositional Logic in Computer Programs

if ( x > 0  || (x <= 0 && y > 100))    ...    further instruction    ...

Let A be the proposition that x > 0, and let B be the proposition that y > 100. Then we can rewrite the condition "A or (NOT(A) AND B)". A truth table reveals that this complicated expression is logically equivalent to "A OR B".

ABA OR (NOT(A) AND B)A OR BTTTTTFTTFTTTFFFF
if (x > 0 || y > 100)    ...    further instruction    ...

Simplifying expressions in software can increase the speed of your program. Chip designers try to minimize the number of analogous physical devices on a chip. A chip with fewer devices is smaller, consumes less power, has a lower defect rate, and is cheaper to manufacture.

Predicates & Quantifiers

Def: Apredicate is a proposition whose truth depends on the value of variable.
Def: An assertion that a predicate is always true, is called a universally quantified statement
Def: An assertion that a predicate is sometimes true, is called an existentially quantified statement.

For all n in nature number N, n^2 + n + 41 is a prime

nn^2 + n +41prime041True143True247 True353True.........20461True.........391601True

40^2 + 40 + 41 = 1681 = 41^2


Ex: a^4 + b^4 + c^4 = d^4 has no positive integers solutions

a = 95800      b = 217519      c = 414560      d = 42248

There exists a, b, c, d in positive integers N*, s.t. a^4 + b^4 + c^4 = d^4.
    
Ex: 313(x^3 + y^3) = z^3 has no positive integer solutions

Ex: (Four-Color-Theorem) Every map can be colored with 4 colors so that adjacent regions have different colors.

Ex:(Goldbach's Conjecture) Every even integer n greater than 2 is the sum of two primes.

For every even integer n greater than 2, there exists primes p and q such that  n = p + q.
Let Evens be the set of even integer greater than 2, let Primes be the set of prime.
For all n belong to Evens, there exists p, q in Primes, s.t p + q = n.


Order of Quantifiers

Ex: Every American has a dream.
Let A be the set of American.
Let D be the set of dreams.
Define the predicate H(a, d) to be "American a has dream d".

The sentence could mean that there is a single dream that every American shares:

There exists d belong in D, for all a belong to A, s.t. H(a, d).

Or it could mean that every American has a personal dream:

For all a in A, there exists d in D, s.t. H(a, d).


Negating Quantifiers


Not(for all x. P(x)) <==> there exists x. Not(P(x))
Not(there exists x. P(x)) <==> for all x. Not(P(x))

The general principle is that moving a "not" across a quantifier changes the kind of quantifier.


Validity & Satisfiability 

Def: A propositional formula is called valid when it evaluates to T no matter what truth values are assigned to the individual propositional variable.

Ex: [P AND (Q OR R)] iff [(P AND Q) OR (P AND R)]

Def: A predicate formula is called valid when it evaluates to T no matter what values its variables may take over unspecified domain, and no matter what interpretation a predicate variable may be given.

Ex: There exits x for all y. P(x, y) ==> For all y there exists x. P(x, y)

Def: A proposition is satisfiable if some setting of the variables makes the proposition true.

Def: An axiom is a proposition that is "assumed" to be true.

Ex: if a = b and b =c , then a = c.

Euclidean Geometry:
Given a line L and point P not on L, there is exactly one line thu P parallel to L.

Spherical Geometry:
Given a line L and point P not on L, there is no line thu P parallel to L.

Hyperbolic Geometry:
Given a line L and point P not on L, there are infinitely many lines thu P parallel to L.

Axioms should be 
  1. consistent
  2. complete

Def: A set of axioms is consistent if no proposition can be proved T & F.
Def: A set of axioms is complete if it can be used to prove every proposition is  T or F. 


Reference:

https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-042j-mathematics-for-computer-science-fall-2010/