Attribution Non-Commercial (BY-NC)

712 views

Attribution Non-Commercial (BY-NC)

- 02-Comb
- Theoretical Models Computing Book
- Logical Operators
- Boolean Alzebra, Minterms and Maxterms
- Wittgenstein, Tractatus Logico-Philosophicus
- Aptitude Logical Reasoning
- List of Boolean Algebra Topics - Wikipedia
- Manual Robotc
- bel-cs
- Automated Debbuggin For Prgrams
- N01 - Logic Circuits
- 01-propositions-110215093905-phpapp02
- Datasheet
- a.doc
- epdf.tips_fundamentals-of-algorithmics.pdf
- 21Circuits-2x2
- Swift Programming from Scratch.pdf
- 2009dedreas
- polynomial connections
- mfcs_2007

You are on page 1of 21

Logic

陳鍾誠 2006 年於金門

大綱

Outline

• Boolean Logic ( 布林邏輯 )

何謂邏輯 ?

What is Logic ?

• A world of true and false.

• Data • Function

–T , F – And (&)

– Or (|)

– Not (-)

邏輯系統的種類

Types of Logic

• Propositional logic ( 命題邏輯 )

– Also known as Boolean Logic (§1.1-1.2):

– Basic definitions. (§1.1)

– Equivalence rules & derivations. (§1.2)

• Predicate logic ( 述詞邏輯 或 謂詞邏輯 )

– Also known as First-Order Logic (§1.3-1.4)

– Predicates.

– Quantified predicate expressions.

– Equivalences & derivations.

述詞邏輯

Propositional Logic

Propositional Logic is the logic of

compound statements built from simpler

statements

using so-called Boolean connectives.

Some applications in computer science: George Boole

(1815-1864)

• Design of digital electronic circuits.

• Expressing conditions in programs.

• Queries to databases & search engines.

述詞邏輯的基本運算

Propositional Logic – Operators

Formal Name Nickname Arity Symbol

Conjunction operator AND Binary ∧

Disjunction operator OR Binary ∨

Implication operator IMPLIES Binary →

Biconditional operator IFF Binary ↔

運算一：反相

Negation operator - NOT

p ¬p

T F

F T

運算二：及

Conjunction operator – AND

p q p∧q

F F F

F T F

T F F

T T T

運算三：或

Disjunction operator – OR

p q p∨ q

F F F

F T T

T F T

T T T

述詞邏輯的表示式

Expressions of Propositional Logic

• Use parentheses to group sub-expressions

– Example :

• m : male

• c : child

• m ∧c : male child (boy)

– Example :

• f ∧(g ∨s)

運算四：互斥或

Exclusive-Or – XOR

p q p⊕ q

F F F

F T T

T F T

T T F

自然語言的語義不清楚

Natural Language is Ambiguous

Note that English “or” can be

ambiguous regarding the “both”

case! p q p "or" q

“Pat is a singer or

Pat is a writer.” - F F F

“Pat is a man or F T T

Pat is a woman.” - T F T

Need context to disambiguate the

meaning! T T ?

For this class, assume “or” means

inclusive.

運算五：導致

The Implication Operator

• p → q means p implies q.

– If p is true, then q is true;

– but if p is not true, then q could be either true or false.

• Example :

– E.g., let p = “You study hard.”

q = “You will get a good grade.”

– p → q = “If you study hard, then you will get a good

grade.” (else, it could go either way)

pq 的真值表

Implication Truth Table

• p → q is false only when

p is true but q is not true. p q p→q

• p → q does not say F F T

that p causes q!

F T T

• p → q does not require

that p or q are ever true!

T F F

T T T

• E.g. “(1=0) → pigs can fly” is

TRUE!

Imply 運算 的範例

Examples of Implications

• “If this lecture ends, then the sun will rise

tomorrow.” True or False?

penguin.” True or False?

True or False?

richer than Bill Gates.” True or False?

三種反運算

Converse, Inverse, Contrapositive

Some terminology, for an implication p → q:

• Its converse is: q → p.

• Its contrapositive:¬q → ¬ p.

table) as p → q. Can you figure out which?

p → q = -q → -p 兩者相等

How do we know for sure?

Proving the equivalence of p → q and its

contrapositive using truth tables:

p q ¬q ¬p p→ q ¬

q→ ¬

p

F F T T T T

F T F T T T

T F T F F F

T T F F T T

利用真值表來證明

Proving Equivalence via Truth Tables

• -(-p∧-q) = p∨q

Ex.

p qProve

p∨ that

q ¬ p ¬p∨ ⇔p ¬(¬p

qq ¬ ∧ ¬q ∧¬

¬q).

(¬p∧ ¬

q)

FF F T T T F

FT T T F F T

TF T F T F T

TT T F F F T

• Demorgan’s Theorem : ( 笛摩根定律 )

p q = p + q = p+q

p ↔ q 的真值表

Biconditional Truth Table

• p ↔ q means that p and q p q p ↔q

have the same truth value.

F F T

• Note this truth table is the

F T F

exact opposite of ⊕’s! T F F

– p ↔ q means ¬(p ⊕ q) T T T

• p ↔ q does not imply

p and q are true, or cause

each other.

布林運算總整理

Boolean Operations Summary

• We have seen 1 unary operator (out of the 4

possible) and 5 binary operators (out of the 16

possible). Their truth tables are below.

p q ¬p p∧

q p∨ q p⊕ q p→ q p↔ q

F F T F F F T T

F T T F T T T F

T F F F T T F F

T T F T T F T T

布林運算的幾種符號表達法

Some Alternative Notations

Propositional logic: ¬∧ ∨ ⊕ → ↔

Boolean algebra: p pq + ⊕

C/C++/Java (wordwise): ! && || != ==

C/C++/Java (bitwise): ~ & | ^

Logic gates:

- 02-CombUploaded byJamal
- Theoretical Models Computing BookUploaded byLe Thanh
- Logical OperatorsUploaded byMouseManX
- Boolean Alzebra, Minterms and MaxtermsUploaded byAnkit Mehta
- Wittgenstein, Tractatus Logico-PhilosophicusUploaded byVinícius dos Santos
- Aptitude Logical ReasoningUploaded byJaysingh Jadeja
- List of Boolean Algebra Topics - WikipediaUploaded byaditya00012
- Manual RobotcUploaded byGabino10
- bel-csUploaded byIndrasen Singh
- Automated Debbuggin For PrgramsUploaded byJonathan Guzman
- N01 - Logic CircuitsUploaded bysullivan583
- 01-propositions-110215093905-phpapp02Uploaded byFatima Sadik
- DatasheetUploaded bykumarjagadeep
- a.docUploaded byMa Jun
- epdf.tips_fundamentals-of-algorithmics.pdfUploaded bymax crax
- 21Circuits-2x2Uploaded byuebecs
- Swift Programming from Scratch.pdfUploaded bymys2013
- 2009dedreasUploaded byDylan Morais
- polynomial connectionsUploaded byapi-385112882
- mfcs_2007Uploaded byandhracolleges
- Lec 6c Logic Functions and Boolean Minimization examples.pdfUploaded bymuhammad saeed
- Or GroupworkUploaded byNur Farehan
- Digital Electronics Module 02Uploaded bySanoj Sebastian
- (Slides) Safe Runtime Verification of Real Time PropertiesUploaded byfireboy_a2004
- CS Cheat SheetUploaded byersayantan
- Boolean AlgebraUploaded bysudip_on_air1
- set and logicUploaded byanon_267791969
- Digital Electronics Notes_DecryptedUploaded byYashvant Kumar Ashok
- BCA CBCS North Bengal UniversityUploaded bylovebangla
- MIT15_093J_F09_lec18 (1)Uploaded byKirubaKaran S

- Improved Hamming Code for Error DetectionUploaded by陳鍾誠
- Micro c/Os II 作業系統Uploaded by陳鍾誠
- MINIX3 ProcessesUploaded by陳鍾誠
- Open TextbookUploaded by陳鍾誠
- A Reasoning Framework for Heterogeneous XMLUploaded by陳鍾誠
- Low-Voltage Pulsewidth Control Loops for SOC ApplicationsUploaded by陳鍾誠
- Citizen JournalismUploaded by陳鍾誠
- 網路程式設計Uploaded by陳鍾誠
- 2009 National Computer Symposium (NCS 2009)Uploaded by陳鍾誠
- 0_BlenderAnd3DUploaded by陳鍾誠
- Logic IntroductionUploaded by陳鍾誠
- Logical EquivalenceUploaded by陳鍾誠
- 從我國法制論GPL 授權契約Uploaded by陳鍾誠
- A Novel Approach to Improving Burst Errors Correction Capability of Hamming CodeUploaded by陳鍾誠
- 一階邏輯的推論 First-Order Logic ReasoningUploaded by陳鍾誠
- First Order LogicUploaded by陳鍾誠
- A Document Similarity Measurement without DictionariesUploaded by陳鍾誠
- Error Probabilities of Two-Dimensional M-Ary Signaling in FadingUploaded by陳鍾誠
- Direct-Sequence Spread-Spectrum Parallel Acquisition in a Fading Mobile ChannelUploaded by陳鍾誠
- Blender的材質與花紋Uploaded by陳鍾誠
- 5_BlenderVideoSequenceEditorUploaded by陳鍾誠

- proving -m9;p 424Uploaded byapi-279213523
- Ge 4 Mathematics in the Modern WorldUploaded byGerralyn Sagala Perito Lpt
- ADUni - Theory of Computation - Problem Set 01 SolutionsUploaded byAjith Suresh
- Data Types in Visual BasicUploaded bysridharanc23
- Haskell 2010 Language ReportUploaded byJeff Pratt
- Truth tablesUploaded byhabbashmahmood
- Aaron R. Bradley, Zohar Manna-The Calculus of Computation_ Decision Procedures With Applications to Verification-Springer (2007)Uploaded byAalok Thakkar
- Discrete Math Review Sheet (Exam 1)Uploaded byJ R
- Chapter 24 the Chomsky HierarchyUploaded byGurkaran Pawar
- Intro to FuzzyUploaded byManish Vishal
- Mathematical Induction-Concept.pdfUploaded byScreaming Silence
- fUploaded byAnonymous 8ishCm7R
- Coding QuesUploaded byAnsh Jindal
- Compiler Design SYLLABUSUploaded byksai.mb
- Semantic Tableaux for Propositional LogicUploaded bylog
- Prawitz_InferenceAndKnowledge.pdfUploaded byAnonymous QINdkjMxxo
- Predicate Derivation TipsUploaded byalicenuoli
- WorkUploaded byrohit_pathak_8
- Functional Verification of System on ChipUploaded byKashif Ahmed
- 274047692-Languages-and-Machines-Thomas-A-Sudkamp.pdfUploaded byNayim Mohammad
- Chomsky Normal FormUploaded byGopal K Verma
- AutomataUploaded byPradeep Cool
- Logic and PhilosUploaded byprosochesati
- תכן לוגי מתקדם- הרצאה 2 | NPN ClassificationUploaded byRon
- Lexical Analysis1Uploaded byKailash Borse
- Mallet TutorialUploaded byKujtim Rahmani
- TMF1814 Tutorial 5 Ans.docxUploaded byDemus Johney
- automata assigmentUploaded byAbhay Singh
- Fuzzy LogicUploaded byDzul Ishak
- John T. Baldwin and Saharon Shelah- On the classifiability of Cellular AutomataUploaded byKsmweo