Documentos de Académico
Documentos de Profesional
Documentos de Cultura
2-2
What is Logic?
Computer science is continuation of logic by other means Georg Gottlob
Contrariwise, continued weedledee, if it was so, it might be! and if it were so, it would be! but as it isn"t, it ain"t# hat"s logic $ewis Carroll, Through the Looking Glass
$ogic celebrates the unity of a pathological masculine self%identity that cannot listen and recogni&es only negation but not difference Andrea 'ye, Words of Power
2-3
2-4
Use of Logic
(n mathematics and rhetoric) Give precise meaning to statements# Distinguish between valid and invalid arguments# *rovide rules of +correct" reasoning# 'atural language can be very ambiguous +(f you do your homewor,, then you"ll get to watch the game#" +(f you don"t do your homewor,, then you will not get to watch ###" +-ou do your homewor,, or you"ll fail the e.am#" +(f you don"t do your homewor,, then you"ll fail the e.am#"
Statements (propositions)
*ropositional logic deals with statements and their truth values A statement is a declarative sentence that can be true or false ruth values are 56 4 7 or 89 and :A$2; 7: or <9# ;.amples) % 1 + 1 = 2 7statement, 9 % he moon is made of cheese 7statement, :9 % Go home= 7not statement, imperative9 % 3hat a beautiful garden= 7not statement, e.clamation9 % y+1=2 7not statement, uncertain9 % he God e.ists 7statement, >9
/
2-5
2-6
Compound Statements
2implest statement are called primitive statement 3e cannot decide the truth value of a primitive statement# his is not what logic does# 3e shall use propositional variables to denote primitive statements, p, q, r, ? (nstead we combine primitive statements by means of logic connectives into compound statements or formulas and loo, how the truth value of a compound statement depends on the truth values of the primitive statements it includes# 3e will denote compound statements by , , ?
2-7
2-8
Logic Connectives
negation 7not, 9 +(t is not true that at least one politician was honest" con@unction 7and, 9 +(n this room there is a lady, and in the other room there is a tiger" dis@unction 7or, 9 +Margaret Mitchell wrote +Gone with the 3ind or ( am going home" implication 7if?, then?, 9 +(f there is a tiger in this room, then there is no lady there" e.clusive or 7either ?, or ?, 9 + here is either a tiger in this room, or a lady" biconditional 7eAuivalence9 7if and only if, 9 + here is a lady in this room if and only if there is a tiger in the other room"
Truth tables
ruth table is a way to specify the e.act dependence of the truth value of a compound statement through the values of primitive statements involved truth values of primitive statements
7propositional variables9 truth value of compound statements 7formulas9
p < <
A < 8
< 8
2-9
2-10
Truth Tables of Connectives (disjunction) Dis@unction B inclusive +or" p < < A < 8 < 8 pA < 8 8 8
+2tudents who have ta,en calculus can ta,e this course" +2tudents who have ta,en computing can ta,e this course" +2tudents who have ta,en calculus or computing can ta,e this course"
p
789 : 7<9
Con@unction
p < < 8 8
A < 8 < 8
binary connective + oday is :riday" +(t is raining" + oday is :riday and it is raining"
8 8
Be careful with +or" constructions in natural languages= +-ou do your homewor,, or you"ll fail the e.am#" + oday is :riday or 2aturday"
2-11
2-12
+-ou can follow the rules or be disAualified#" +'atalie will arrive today or 'atalie will not arrive at all#"
'ote that logical 7material9 implication does not assume any causal connection# !f blac, is white, then we live in Antarctic#" "!f pigs fly, then *aris is in :rance#"
2-13
2-14
!mplication as a promise
(mplication can be thought of as a promise, and it is true if the promise is ,ept +!f ( am elected, then ( will lower ta.es" % 4e is not elected and ta.es are not lowered % 4e is not elected and ta.es are lowered % 4e is elected and ta.es are lowered promise ,ept= promise ,ept= promise ,ept=
p A
hypothesis antecedent premise +if p, then A" +if p, A" +p is sufficient for A" +A if p" +A %hen p" conclusion conseAuence +A unless p" +p implies A" +p onl$ if A" +A %henever p" +A follo%s from p" +a sufficient con& dition for A is p" +a necessar$ con& dition for p is A"
2-15
2-16
p A
Converse
+ he home team wins whenever it is raining" 7+(f it is raining then the home team wins"9
A p
+(f the home team wins, then it is raining" A
Contrapositive (nverse
p
+(f the home team does not win, then it is not raining"
+-ou can ta,e the flight if and only if you buy a tic,et#"
+(f it is not raining, then the home team does not win"
2-17
2-18
'xample
+-ou can access the (nternet from campus if you are a computer science ma@or or if you are not a freshman#"
Tautologies autology is a compound statement 7formula9 that is true for all combinations of truth values of its propositional variables 7p A9 7A p9
p % +you can access the (nternet from campus" A % +you are a computer science ma@or" r % +you are a freshman" p < < 8 8 A < 8 < 8
7p A9 7A p9
8 8 8 8
2-19
2-20
Contradictions Contradiction is a compound statement 7formula9 that is false for all combinations of truth values of its propositional variables 7p A9 7p A9
p < < 8 8 A < 8 < 8
7p A9 7p A9
(ome%or)
;.ercises from the Boo,) 'o# 8 ,D, E, Fa, Fc 7page GE9