AE1APS Algorithmic Problem Solving John Drake. The island of Knights and Knaves is a fictional island to test peoples ability to reason logically. There.

Slides:



Advertisements
Similar presentations
2.5 Reasoning in Algebra and Geometry
Advertisements

Artificial Intelligence
Rules of Inference Rosen 1.5.
AE1APS Algorithmic Problem Solving John Drake.  Coursework 3 due on Thursday at 1pm  (i.e. before the start of the tutorial).  Submit either hard-copy.
Algebra Problems… Solutions Algebra Problems… Solutions © 2007 Herbert I. Gross By Herbert I. Gross and Richard A. Medeiros next Set 9.
AE1APS Algorithmic Problem Solving John Drake
Solving Word Problems II
Chapter 2 Geometric Reasoning
The Island of Knights and Knaves. Knights always tell the truth.
CS344: Introduction to Artificial Intelligence (associated lab: CS386) Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture–5 and 6: Propositional Calculus.
Composition is a binary operation like addition, subtraction, multiplication and division are binary operations. (meaning they operate on two elements)
Some Puzzles About Truth (and belief, knowledge, opinion, and lying)
The Island of Knights and Knaves. Raymond Smullyan 1978 A little learning is a dangerous thing; Drink deep, or taste not the Pierian spring: There shallow.
AE1APS Algorithmic Problem Solving John Drake.  Invariants – Chapter 2  River Crossing – Chapter 3  Logic Puzzles – Chapter 5 (13) ◦ Knights and Knaves.
Logic 3 Tautological Implications and Tautological Equivalences
Propositional Logic. Negation Given a proposition p, negation of p is the ‘not’ of p.
Logic Puzzles Miran Kim Ben Seelbinder Matthew Sgambati.
Copyright © Cengage Learning. All rights reserved.
Logical and Rule-Based Reasoning Part I. Logical Models and Reasoning Big Question: Do people think logically?
Introduction Solving inequalities is similar to solving equations. To find the solution to an inequality, use methods similar to those used in solving.
Logic Gates Circuits to manipulate 0’s and 1’s. 0’s and 1’s used for numbers Also to make decisions within the computer. In that context, 1 corresponds.
2.5 Reasoning in Algebra and Geometry
Properties refer to rules that indicate a standard procedure or method to be followed. A proof is a demonstration of the truth of a statement in mathematics.
Logical Puzzles Truth and Lies. The Island of Rilas On the island of Rilas there are just two types of people: knights and knaves Knights always tell.
The Foundations: Logic and Proofs
Lecture 5 Knights and Knaves.. Administration Show hand in form. Show plagiarism form. Any problems with coursework? Google knight and knaves and look.
Chapter 1: The Foundations: Logic and Proofs
Copyright © Curt Hill Using Propositional Logic Several applications.
MATH 224 – Discrete Mathematics
DECIDABILITY OF PRESBURGER ARITHMETIC USING FINITE AUTOMATA Presented by : Shubha Jain Reference : Paper by Alexandre Boudet and Hubert Comon.
Final Lecture. Instructions in Exam ANSWER 2 QUESTIONS. There will be a choice of 3 questions. Each question will be in parts e.g. a, b, c. You can see.
CS 173, Lecture B August 27, 2015 Tandy Warnow. Proofs You want to prove that some statement A is true. You can try to prove it directly, or you can prove.
1 10/13/2015 MATH 224 – Discrete Mathematics Why Study Discrete Math  Determination of the efficiency of algorithms, e.g., insertion sort versus selection.
Algebra Form and Function by McCallum Connally Hughes-Hallett et al. Copyright 2010 by John Wiley & Sons. All rights reserved. 3.1 Solving Equations Section.
1 Sections 1.5 & 3.1 Methods of Proof / Proof Strategy.
Chapter 2 Section 5. Objective  Students will make a connection between reasoning in Algebra and reasoning in Geometry.
MATH 224 – Discrete Mathematics
Activity 1-19: The Propositional Calculus
1 Methods of Proof Proof techniques in this handout –Direct proof –Division into cases –Proof by contradiction In this handout, the proof techniques will.
Week 4 - Monday.  What did we talk about last time?  Divisibility  Quotient-remainder theorem  Proof by cases.
1.6. DEFINITIONS  An equation is a statement that two expressions are equal.  Usually contains 1 or more variables  A variable is a symbol that represents.
Warm Up. Warm Up Answers Theorem and Proof A theorem is a statement or conjecture that has been shown to be true. A theorem is a statement or conjecture.
Predicates and Quantifiers Dr. Yasir Ali. 1.Predicates 2.Quantifiers a.Universal Quantifiers b.Existential Quantifiers 3.Negation of Quantifiers 4.Universal.
Lecture Coursework 2 AGAIN. Rectangle Game Look at proof of matchsticks A rectangular board is divided into m columns by n rows. The area of the board.
11 Artificial Intelligence CS 165A Thursday, October 25, 2007  Knowledge and reasoning (Ch 7) Propositional logic 1.
Laws of Boolean Algebra Commutative Law Associative Law Distributive Law Identity Law De Morgan's Theorem.
What is Reasoning  Logical reasoning is the process of drawing conclusions from premises using rules of inference.  These inference rules are results.
Dr. Naveed Riaz Design and Analysis of Algorithms 1 1 Formal Methods in Software Engineering Lecture # 25.
Lecture Coursework 2. Rectangle Game Look at proof of matchsticks Read thru the question. A rectangular board is divided into m columns by n rows. The.
Foundations of Discrete Mathematics Chapter 1 By Dr. Dalia M. Gil, Ph.D.
2.5 Reasoning in Algebra and Geometry Algebraic properties of equality are used in Geometry. –Will help you solve problems and justify each step. In Geometry,
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.
Identity and Equality Properties. Properties refer to rules that indicate a standard procedure or method to be followed. A proof is a demonstration of.
WARM UP Solve: 1. 3x – 5 = (3x -5) = x – 3 + 4x = (2x – 4) = 6.
Intro to Proofs Unit IC Day 2. Do now Solve for x 5x – 18 = 3x + 2.
CS344: Introduction to Artificial Intelligence (associated lab: CS386)
Liar liar.
2.5 Reasoning in Algebra and Geometry
Propositional Calculus: Boolean Algebra and Simplification
Applications of Propositional Logic
CS 220: Discrete Structures and their Applications
Introduction Solving inequalities is similar to solving equations. To find the solution to an inequality, use methods similar to those used in solving.
Formal Methods in Software Engineering
Associativity of Equivalence
Foundations of Discrete Mathematics
Knights and Knaves.
Compound Conditionals
Let Q be the question Let A be “the native is a knight”
AP Statistics Warm-up: Problem 5.26.
Lesson 2-R Chapter 2 Review.
Presentation transcript:

AE1APS Algorithmic Problem Solving John Drake

The island of Knights and Knaves is a fictional island to test peoples ability to reason logically. There are two types of people on the island. Knights who always tell the truth Knaves who always lie.

Logic puzzles are about deducing facts about the island, from statements made by the people on the island. But you do not know whether the statement was made by a knight or a knave.

What happens if you ask a person if they are a knight or a knave? There may be gold on the island. What question could you ask to establish this? Im a Knight Im a Knight

At school we learnt to manipulate expressions. The values of expressions are numbers n 2 –m 2 = (n + m)(n - m) To do this we use laws. e.g. n + 0 = n and n – n = 0 (for ANY values of n) Associatively of addition (m + n) +p = m + (n + p) I am sure you are all familiar with laws regarding addition, multiplication.

Boolean expressions are either true or false. Boolean valued expressions are called propositions. it is sunny is an atomic Boolean expression. it is sunny and warm is non atomic as it can be broken down into two expressions. We are concerned with the rules for manipulating Boolean expressions.

Equality is a binary relation. It is a function with a range of Boolean values true and false. Equality is reflexive: [x x] It is symmetric: [x y is the same as y x] It is transitive: [x y and y z implies z x] If x y, then f(x) f(y) It is associative: [(x y) z is the same as x (y z) ] It is substitutive [x (y z) can be replaced by (y z) (y z) ]

A is a native on the island. Therefore A is either a knight or a knave. The statement A is a knight is either true or false. The statement there is gold on the island is either true or false. Suppose A is a knight, and suppose A makes statement S. The crucial observation is that the values of these two propositions are the same. Then A is a knight S

Suppose A is the proposition person A is a knight" and suppose A makes a statement S. We can infer that A is true is the same as S is true. That is, AS

If A says I am a knight then all we can infer from the statement is A A. Not much use! Similarly, it cannot be that a native says I am a knave because we would then conclude A ¬A which is always false. If A says I am the same type as B". We infer that A (A B) which simplifies to B. ¬ Boolean symbol for negation (i.e. NOT A)

A native says there is gold on this island, is the same as, I am a knight. Let G denote the proposition There is gold on the island". A's statement is A G. So what we are given is: A A G This simplifies to G. So we deduce that there is gold on the island but it is not possible to tell whether A is a knight or a knave.

If A is a knight, he will always tell the truth so we will know there is gold on the island. If A is a knave he will always lie so when asked if A G (i.e. Are the answers to Are you a knight? and Is there gold on the island? the same), he will answer true when there is gold on the island and false if not. If not clear will go through case analysis using truth tables

Given a pair of natives, what question would you ask to discover if the other one is a knight?

A tourist comes to a fork in a road, one way leads to a restaurant, the other does not. What question (yes/no) would you ask a native to find out which way it is to the restaurant?

Let Q be the question to be posed. The response to the question will be A Q Let L denote, the gold can be found by following the left fork The requirement is that L is the same as the response to Q. i.e. we require L (A Q)

{but as equality is associative} (L A) Q So the question Q posed is L A i.e. is the value of the restaurant can be found by following the right fork equal to the value of you are a knight

There are three natives A, B and C. C says A and B are both the same type Formulate a question, that when posed to A determines if C is telling the truth.

Let A be the statement A is a knight. Let Q be the unknown question. The response we want is C (i.e. if C is true then C is a knight). By the previous example, Q (A C) i.e. we replace L by C. Cs statement is A B, so now we know C (A B) by equality. So Q (A (A B)) which simplifies to Q B, Therefore the question to be posed is is B a knight?

Never trust a knave Equality is reflexive, symmetric, transitive, substitutive and associative – know these! More knights and knaves on Thursday Coursework 1, 2 and 3 now online, deadline for Coursework 3 is Thursday 15th November at 1pm