Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS 270 Lecture 1 In Class Problems. Q1: Logic Puzzle You arrive at the end of a long hallway. There are two knights guarding two doors. One knight always.

Similar presentations


Presentation on theme: "CS 270 Lecture 1 In Class Problems. Q1: Logic Puzzle You arrive at the end of a long hallway. There are two knights guarding two doors. One knight always."— Presentation transcript:

1 CS 270 Lecture 1 In Class Problems

2 Q1: Logic Puzzle You arrive at the end of a long hallway. There are two knights guarding two doors. One knight always speaks the truth. One knight always tells lies. One door leads to safety. One door leads to death. You may ask 1 question yes/no question to one knight before picking a door to go through. Use a table to prove your question works.

3 Q2: Truth Tables Prove using Truth Tables that NAND is functionally complete Relation between NAND and NOT and: (X NAND Y) NAND (X NAND Y) or: (X NAND X) NAND (Y NAND Y) XNOT XX NAND X FalseTrueF NAND F = T TrueFalse?

4 Q3: Tautology Checker You have a magic function Boolean Tautology(Expression){ … } Given any expression, it will return true if the expression is a tautology and false otherwise. Example: Tautology(A or (not A)) returns True Use Tautology to write a function that tells you if the statement is a contradiction. (A contradiction is always false)


Download ppt "CS 270 Lecture 1 In Class Problems. Q1: Logic Puzzle You arrive at the end of a long hallway. There are two knights guarding two doors. One knight always."

Similar presentations


Ads by Google