Data Structures and Algorithms: Logic Summary - Lecture Slides | CSCE 310, Study notes of Algorithms and Programming

Material Type: Notes; Class: Data Structures and Algorithms; Subject: Computer Science and Engineering ; University: University of Nebraska - Lincoln; Term: Unknown 1989;

Typology: Study notes

Pre 2010

Uploaded on 08/30/2009

koofers-user-e8w
koofers-user-e8w 🇺🇸

10 documents

1 / 10

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
http://www.cse.unl.edu/~goddard/Courses/CSCE310J
Logic Summary
Dr. Steve Goddard
CSCE 310J: Data Structures & Algorithms
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Data Structures and Algorithms: Logic Summary - Lecture Slides | CSCE 310 and more Study notes Algorithms and Programming in PDF only on Docsity!

http://www.cse.unl.edu/~goddard/Courses/CSCE310J

Logic Summary

Dr. Steve Goddard

[email protected]

CSCE 310J: Data Structures & Algorithms

I

Giving credit where credit is due:

-^

Most of slides for this lecture are based on slides createdby Dr. Ben Choi, Louisiana Technical University.

-^

I have modified them and added new slides

CSCE 310J: Data Structures & Algorithms

Quantifiers: all, some I

“for all x”

x P(x) is true iff P(x) is true for

all

x

•^

universal quantifier (universe of discourse)

I

“there exist x”

x P(x) is true iff P(x) is true for

some

value

of x^ •

existential quantifier

I

x A(x) is logically equivalent to

¬ ∃

x(

¬

A(x))

I

x A(x) is logically equivalent to

¬∀

x(

¬

A(x))

I

x (A(x)

B(x))

“For all x such that if A(x) holds then B(x) holds”

Prove by counterexample,Contraposition, Contradiction I

Counterexample^ to prove

x (A(x)

B(x)) is false, we show

some

object x

for which A(x) is true and B(x) is false.^ •

x (A(x)

B(x)))

x (A(x)

B(x))

I

Contraposition^ to prove A

B, we show (

¬

B)

(

¬

A)

I

Contradiction^ to prove A

B, we assume

¬

B and then prove B.

•^

A

B

(A

B)

B

•^

A

B

(A

B) is false

I

Assuming (A

∧ ¬

B) is true,

and discover a

contradiction

(such as A

∧ ¬

A),

then conclude (A

∧ ¬

B) is false, and so A

B.

Rules of Inference I

A rule of inference is a

general pattern

that allows us to

draw some new conclusion from a set of given statements.^ •

If we know {…} then we can conclude {…}

I

If {B and (B

C)} then {C}

•^

modus ponens

I

If {A

B and B

C} then {A

C}

•^

syllogism

I

If {B

C and

¬

B

C} then {C}

•^

rule of cases

Boolean Algebra

1.^

Closure: •^

if x, y

B and z = x + y then z

B

-^

if x, y

B and z = x · y then z

B

2.^

Identity and Zero elements: •^

for + designated by 0: x + 0 = x

-^

for · designated by 1: x · 1 = x

3.^

Commutative: •^

x + y = y + x

-^

x · y = y · x

4.^

Distributive: •^

x · (y + z) = (x · y) + (x · z)

-^

x + (y · z) = (x + y) · (x + z)

5.^

Complement: for everyelement x

B, there exits an

element x’

B s.t.

-^

x + x’ = 1, x · x’ = 0

6.^

There are at least two distinctelements in B

A set B and two binary operators + “or,

”, · “and,

creates a Boolean Algebra iff Huntington’s Postulates hold:

Prove by Rules of Inference

I

Prove [B

(B

C)]

C

•^

Proof: [B

(B

C)]

C

[B

(B

C)]

C

[B

B

C)]

C

[(B

B)

(B

C)]

C

[(B

C)]

C

B

C

C

True (

tautology

I

Direct Proof:

[B

(B

C)]

[B

C]

C