Logic Programming. Prolog : 3

Size: px
Start display at page:

Download "Logic Programming. Prolog : 3"

Transcription

1 Logic Programming Prolog : 3

2 Review We don't write normal functions in Prolog. Instead we relate the input and the output e.g. factorial: factorial(0, 1). factorial(n, V) : N > 0, N1 is N 1, factorial(n1, V1), V is N * V1.

3

4 3 > 0 N1 is 3 1 factorial(n1, V1) APPLY RULE

5 3 > 0 N1 is 3 1 factorial(n1, V1)

6 3 > 0 N1 is 3 1 factorial(n1, V1) SOLVE SUBGOALS (left to right)

7 3 > 0 N1 is 3 1 factorial(n1, V1)

8 3 > 0 N1 is 3 1 factorial(n1, V1) N1 ==> 2

9 3 > 0 2 is 3 1 factorial(2, V1) N1 ==> 2

10 3 > 0 2 is 3 1 factorial(2, V1)

11 3 > 0 2 is 3 1 factorial(2, V1) 2 > 0 N2 is 2 1 factorial(n2, V2) V1 is 2 * V2 APPLY RULE

12 3 > 0 2 is 3 1 factorial(2, V1) 2 > 0 N2 is 2 1 factorial(n2, V2) V1 is 2 * V2

13 3 > 0 2 is 3 1 factorial(2, V1) 2 > 0 N2 is 2 1 factorial(n2, V2) V1 is 2 * V2 SOLVE SUBGOALS (left to right)

14 3 > 0 2 is 3 1 factorial(2, V1) 2 > 0 N2 is 2 1 factorial(n2, V2) V1 is 2 * V2

15 3 > 0 2 is 3 1 factorial(2, V1) 2 > 0 N2 is 2 1 factorial(n2, V2) V1 is 2 * V2 N2 ==> 1

16 3 > 0 2 is 3 1 factorial(2, V1) 2 > 0 1 is 2 1 factorial(1, V2) V1 is 2 * V2 N2 ==> 1

17 3 > 0 2 is 3 1 factorial(2, V1) 2 > 0 1 is 2 1 factorial(1, V2) V1 is 2 * V2

18 3 > 0 2 is 3 1 factorial(2, V1) 2 > 0 1 is 2 1 factorial(1, V2) V1 is 2 * V2 factorial(0, 1) USE FACT

19 3 > 0 2 is 3 1 factorial(2, V1) 2 > 0 1 is 2 1 factorial(1, V2) V1 is 2 * V2 factorial(0, 1) V2 ==> 1

20 3 > 0 2 is 3 1 factorial(2, V1) 2 > 0 1 is 2 1 factorial(1, 1) V1 is 2 * 1 factorial(0, 1) V2 ==> 1

21 3 > 0 2 is 3 1 factorial(2, V1) 2 > 0 1 is 2 1 factorial(1, 1) V1 is 2 * 1 factorial(0, 1)

22 3 > 0 2 is 3 1 factorial(2, V1) 2 > 0 1 is 2 1 factorial(1, 1) V1 is 2 * 1 factorial(0, 1) V1 ==> 2

23 3 > 0 2 is 3 1 factorial(2, 2) V is 3 * 2 2 > 0 1 is 2 1 factorial(1, 1) 2 is 2 * 1 factorial(0, 1) V1 ==> 2

24 3 > 0 2 is 3 1 factorial(2, 2) V is 3 * 2 2 > 0 1 is 2 1 factorial(1, 1) 2 is 2 * 1 factorial(0, 1)

25 3 > 0 2 is 3 1 factorial(2, 2) V is 3 * 2 2 > 0 1 is 2 1 factorial(1, 1) 2 is 2 * 1 factorial(0, 1) V ==> 6

26 factorial(3, F) 6) 3 > 0 2 is 3 1 factorial(2, 2) 6 is 3 * 2 2 > 0 1 is 2 1 factorial(1, 1) 2 is 2 * 1 factorial(0, 1) V ==> 6

27 factorial(3, F) 6) 3 > 0 2 is 3 1 factorial(2, 2) 6 is 3 * 2 2 > 0 1 is 2 1 factorial(1, 1) 2 is 2 * 1 factorial(0, 1)

28 Backtracking True. Search V = 6. factorial(3, F) 6) 3 > 0 2 is 3 1 factorial(2, 2) 6 is 3 * 2 2 > 0 1 is 2 1 factorial(1, 1) 2 is 2 * 1 factorial(0, 1)

29 Cuts : Control the Search Some control from ordering clauses and goals Cut : stop back tracking! Critical for efficient Prolog Allows us to short circuit evaluation Use carefully... cut breaks our simple logical model Prolog = controlled search

30 Style Exercise (10 min) Select: Write a function select(x, L, R) so that: X is in the list L R has all the other items of L Perm: Write a function perm(l, P) so that: P is some permutation of L (permutation = reordering) (hint: use select!)

31 Logic Puzzle I Towers of Hanoi N disks of increasing radius on a peg #1 Move all disks to peg #3, but... Move only one (top) disk at a time Never put a larger disk on top of a smaller disk.

32 Logic Puzzle II Farmer, Wolf, Goat, Cabbage All are on the east side of river. We want all on the west side of the river, ALIVE wolf and goat alone => wolf will eat goat goat and cabbage alone => goat will eat cabbage Can we get everyone across without being eaten?

Chapter Two: Finite Automata

Chapter Two: Finite Automata Chapter Two: Finite Automata In theoretical computer science, automata theory is the study of abstract machines (or more appropriately, abstract 'mathematical' machines or systems) and the computational

More information

Automata and Formal Languages - CM0081 Determinist Finite Automata

Automata and Formal Languages - CM0081 Determinist Finite Automata Automata and Formal Languages - CM0081 Determinist Finite Automata Andrés Sicard-Ramírez Universidad EAFIT Semester 2018-2 Formal Languages: Origins Source areas [Greibach 1981, p. 14] Logic and recursive-function

More information

CHAPTER 4 SOME METHODS OF PROOF

CHAPTER 4 SOME METHODS OF PROOF CHAPTER 4 SOME METHODS OF PROOF In all sciences, general theories usually arise from a number of observations. In the experimental sciences, the validity of the theories can only be tested by carefully

More information

Mathematical Fundamentals

Mathematical Fundamentals Mathematical Fundamentals Sets Factorials, Logarithms Recursion Summations, Recurrences Proof Techniques: By Contradiction, Induction Estimation Techniques Data Structures 1 Mathematical Fundamentals Sets

More information

Lecture 4 Model Checking and Logic Synthesis

Lecture 4 Model Checking and Logic Synthesis Lecture 4 Model Checking and Logic Synthesis Nok Wongpiromsarn Richard M. Murray Ufuk Topcu EECI, 18 March 2013 Outline Model checking: what it is, how it works, how it is used Computational complexity

More information

1 Recursive Algorithms

1 Recursive Algorithms 400 lecture note #8 [ 5.6-5.8] Recurrence Relations 1 Recursive Algorithms A recursive algorithm is an algorithm which invokes itself. A recursive algorithm looks at a problem backward -- the solution

More information

Data Structure Lecture#4: Mathematical Preliminaries U Kang Seoul National University

Data Structure Lecture#4: Mathematical Preliminaries U Kang Seoul National University Data Structure Lecture#4: Mathematical Preliminaries U Kang Seoul National University U Kang 1 In This Lecture Set concepts and notation Logarithms Summations Recurrence Relations Recursion Induction Proofs

More information

7.11 A proof involving composition Variation in terminology... 88

7.11 A proof involving composition Variation in terminology... 88 Contents Preface xi 1 Math review 1 1.1 Some sets............................. 1 1.2 Pairs of reals........................... 3 1.3 Exponentials and logs...................... 4 1.4 Some handy functions......................

More information

Binomial Coefficient Identities/Complements

Binomial Coefficient Identities/Complements Binomial Coefficient Identities/Complements CSE21 Fall 2017, Day 4 Oct 6, 2017 https://sites.google.com/a/eng.ucsd.edu/cse21-fall-2017-miles-jones/ permutation P(n,r) = n(n-1) (n-2) (n-r+1) = Terminology

More information

Algorithms. Jordi Planes. Escola Politècnica Superior Universitat de Lleida

Algorithms. Jordi Planes. Escola Politècnica Superior Universitat de Lleida Algorithms Jordi Planes Escola Politècnica Superior Universitat de Lleida 2016 Syllabus What s been done Formal specification Computational Cost Transformation recursion iteration Divide and conquer Sorting

More information

CSC258: Computer Organization. Digital Logic: Transistors and Gates

CSC258: Computer Organization. Digital Logic: Transistors and Gates CSC258: Computer Organization Digital Logic: Transistors and Gates 1 Pre-Class Review 1. What are the largest (positive) and smallest (negative) numbers that can be represented using 4- bit 2 s complement?

More information

MI 4 Mathematical Induction Name. Mathematical Induction

MI 4 Mathematical Induction Name. Mathematical Induction Mathematical Induction It turns out that the most efficient solution to the Towers of Hanoi problem with n disks takes n 1 moves. If this isn t the formula you determined, make sure to check your data

More information

Handout 7: Recurrences (Cont d)

Handout 7: Recurrences (Cont d) ENGG 2440B: Discrete Mathematics for Engineers Handout 7: Recurrences (Cont d) 2018 19 First Term Instructor: Anthony Man Cho So October 8, 2018 In the last handout, we studied techniques for solving linear

More information

Where does it come from?

Where does it come from? 1 Course organization Textbook J.E. Hopcroft, R. Motwani, J.D. Ullman Introduction to Automata Theory, Languages, and Computation Second Edition, Addison-Wesley, New York, 2001 We shall cover Chapters

More information

Pentagon Walk Revisited. Double Heads Revisited Homework #1 Thursday 26 Jan 2006

Pentagon Walk Revisited. Double Heads Revisited Homework #1 Thursday 26 Jan 2006 1 Let X 0, X 1,... be random variables that take values in the set {A, B, C, D, E}. Suppose X n is the node being visited at time n in the Pentagon walk we discussed in class. That is, we assume that X

More information

Divide and Conquer. Recurrence Relations

Divide and Conquer. Recurrence Relations Divide and Conquer Recurrence Relations Divide-and-Conquer Strategy: Break up problem into parts. Solve each part recursively. Combine solutions to sub-problems into overall solution. 2 MergeSort Mergesort.

More information

Data Structure Lecture#4: Mathematical Preliminaries U Kang Seoul National University

Data Structure Lecture#4: Mathematical Preliminaries U Kang Seoul National University Data Structure Lecture#4: Mathematical Preliminaries U Kang Seoul National University U Kang 1 In This Lecture Set Concepts and Notation Relation Logarithm and Summations Recurrence Relations Recursion

More information

In recent years CTL and LTL logics have been used with considerable industrial success.

In recent years CTL and LTL logics have been used with considerable industrial success. Modelchecking In recent years CTL and LTL logics have been used with considerable industrial success. For example microprocessors manufacturers (like Intel, Motorola) use programs which automatically can

More information

Intermediate Math Circles March 11, 2009 Sequences and Series

Intermediate Math Circles March 11, 2009 Sequences and Series 1 University of Waterloo Faculty of Mathematics Centre for Education in Mathematics and Computing Intermediate Math Circles March 11, 009 Sequences and Series Tower of Hanoi The Tower of Hanoi is a game

More information

Advanced Counting Techniques. Chapter 8

Advanced Counting Techniques. Chapter 8 Advanced Counting Techniques Chapter 8 Chapter Summary Applications of Recurrence Relations Solving Linear Recurrence Relations Homogeneous Recurrence Relations Nonhomogeneous Recurrence Relations Divide-and-Conquer

More information

Part III, Sequences and Series CS131 Mathematics for Computer Scientists II Note 16 RECURRENCES

Part III, Sequences and Series CS131 Mathematics for Computer Scientists II Note 16 RECURRENCES CS131 Part III, Sequences and Series CS131 Mathematics for Computer Scientists II Note 16 RECURRENCES A recurrence is a rule which defines each term of a sequence using the preceding terms. The Fibonacci

More information

Appendix G: Mathematical Induction

Appendix G: Mathematical Induction Appendix G: Mathematical Induction Introduction In this appendix, you will study a form of mathematical proof called mathematical induction. To see the logical need for mathematical induction, take another

More information

Analysis of Algorithm Efficiency. Dr. Yingwu Zhu

Analysis of Algorithm Efficiency. Dr. Yingwu Zhu Analysis of Algorithm Efficiency Dr. Yingwu Zhu Measure Algorithm Efficiency Time efficiency How fast the algorithm runs; amount of time required to accomplish the task Our focus! Space efficiency Amount

More information

Data Structures and Algorithms

Data Structures and Algorithms Data Structures and Algorithms CS245-2015S-23 NP-Completeness and Undecidablity David Galles Department of Computer Science University of San Francisco 23-0: Hard Problems Some algorithms take exponential

More information

cse547, math547 DISCRETE MATHEMATICS Professor Anita Wasilewska

cse547, math547 DISCRETE MATHEMATICS Professor Anita Wasilewska cse547, math547 DISCRETE MATHEMATICS Professor Anita Wasilewska LECTURE 1 INTRODUCTION Course Web Page www.cs.stonybrook.edu/ cse547 The webpage contains: detailed lectures notes slides; very detailed

More information

SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION

SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION CHAPTER 5 SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION Alessandro Artale UniBZ - http://www.inf.unibz.it/ artale/ SECTION 5.6 Defining Sequences Recursively Copyright Cengage Learning. All rights reserved.

More information

Jong C. Park Computer Science Division, KAIST

Jong C. Park Computer Science Division, KAIST Jong C. Park Computer Science Division, KAIST Today s Topics Introduction Solving Recurrence Relations Discrete Mathematics, 2008 2 Computer Science Division, KAIST Definition A recurrence relation for

More information

CS 2210 Discrete Structures Advanced Counting. Fall 2017 Sukumar Ghosh

CS 2210 Discrete Structures Advanced Counting. Fall 2017 Sukumar Ghosh CS 2210 Discrete Structures Advanced Counting Fall 2017 Sukumar Ghosh Compound Interest A person deposits $10,000 in a savings account that yields 10% interest annually. How much will be there in the account

More information

University of Toronto Faculty of Applied Science and Engineering Edward S. Rogers Sr. Department of Electrical and Computer Engineering

University of Toronto Faculty of Applied Science and Engineering Edward S. Rogers Sr. Department of Electrical and Computer Engineering University of Toronto Faculty of Applied Science and Engineering Edward S. Rogers Sr. Department of Electrical and Computer Engineering Final Examination ECE 241F - Digital Systems Examiners: J. Rose and

More information

What is current? cgrahamphysics.com Current

What is current? cgrahamphysics.com Current What is current? cgrahamphysics.com 2016 Current 9/4/2016 Do you know your circuit? Without talking to another or sharing any ideas draw a complete electrical circuit with symbols including... - two bulbs,

More information

Advanced Counting Techniques

Advanced Counting Techniques . All rights reserved. Authorized only for instructor use in the classroom. No reproduction or further distribution permitted without the prior written consent of McGraw-Hill Education. Advanced Counting

More information

6.01 Final Exam: Fall 2009

6.01 Final Exam: Fall 2009 6.01 Final Exam: Fall 2009 Name: ANSWERS Enter all answers in the boxes provided. You may use any paper materials you have brought. You may use a calculator. No computers, cell phones, or music players.

More information

Foundations of Logic Programming

Foundations of Logic Programming Foundations of Logic Programming Deductive Logic e.g. of use: Gypsy specifications and proofs About deductive logic (Gödel, 1931) Interesting systems (with a finite number of axioms) are necessarily either:

More information

CMSC 132, Object-Oriented Programming II Summer Lecture 10:

CMSC 132, Object-Oriented Programming II Summer Lecture 10: CMSC 132, Object-Oriented Programming II Summer 2016 Lecturer: Anwar Mamat Lecture 10: Disclaimer: These notes may be distributed outside this class only with the permission of the Instructor. 10.1 RECURSION

More information

AP PHYSICS SUMMER ASSIGNMENT

AP PHYSICS SUMMER ASSIGNMENT AP PHYSICS SUMMER ASSIGNMENT There are two parts of the summer assignment, both parts mirror the course. The first part is problem solving, where there are 14 math problems that you are given to solve

More information

Chapter 8: Recursion. March 10, 2008

Chapter 8: Recursion. March 10, 2008 Chapter 8: Recursion March 10, 2008 Outline 1 8.1 Recursively Defined Sequences 2 8.2 Solving Recurrence Relations by Iteration 3 8.4 General Recursive Definitions Recursively Defined Sequences As mentioned

More information

MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.

MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question. MTH 164 Practice Exam 2 Spring 2008 Dr. Garcia-Puente Name Section MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question. Decide whether or not the following

More information

Mathematical Induction. How does discrete math help us. How does discrete math help (CS160)? How does discrete math help (CS161)?

Mathematical Induction. How does discrete math help us. How does discrete math help (CS160)? How does discrete math help (CS161)? How does discrete math help us Helps create a solution (program) Helps analyze a program How does discrete math help (CS160)? Helps create a solution (program) q Logic helps you understand conditionals

More information

Q1. The density of aluminum is 2700 kg/m 3. Find the mass of a uniform solid aluminum cylinder of radius cm and height cm.

Q1. The density of aluminum is 2700 kg/m 3. Find the mass of a uniform solid aluminum cylinder of radius cm and height cm. Coordinator: W. Al-Basheer Sunday, June 28, 2015 Page: 1 Q1. The density of aluminum is 2700 kg/m 3. Find the mass of a uniform solid aluminum cylinder of radius 10.00 cm and height 30.48 cm. A) 25.85

More information

CSE 140 Spring 2017: Final Solutions (Total 50 Points)

CSE 140 Spring 2017: Final Solutions (Total 50 Points) CSE 140 Spring 2017: Final Solutions (Total 50 Points) 1. (Boolean Algebra) Prove the following Boolean theorem using Boolean laws only, i.e. no theorem is allowed for the proof. State the name of the

More information

CHAPTER 8 Advanced Counting Techniques

CHAPTER 8 Advanced Counting Techniques 96 Chapter 8 Advanced Counting Techniques CHAPTER 8 Advanced Counting Techniques SECTION 8. Applications of Recurrence Relations 2. a) A permutation of a set with n elements consists of a choice of a first

More information

Intelligent Agents. Formal Characteristics of Planning. Ute Schmid. Cognitive Systems, Applied Computer Science, Bamberg University

Intelligent Agents. Formal Characteristics of Planning. Ute Schmid. Cognitive Systems, Applied Computer Science, Bamberg University Intelligent Agents Formal Characteristics of Planning Ute Schmid Cognitive Systems, Applied Computer Science, Bamberg University Extensions to the slides for chapter 3 of Dana Nau with contributions by

More information

CS 4104 Data and Algorithm Analysis. CS4014: What You Need to Already Know. CS4104: What We Will Do. Introduction to Problem Solving (1)

CS 4104 Data and Algorithm Analysis. CS4014: What You Need to Already Know. CS4104: What We Will Do. Introduction to Problem Solving (1) Department of Computer Science Virginia Tech Blacksburg, Virginia Copyright c 010,017 by Clifford A. Shaffer Data and Algorithm Analysis Title page Data and Algorithm Analysis Clifford A. Shaffer Spring

More information

Lab 12: El Nino Southern Oscillation

Lab 12: El Nino Southern Oscillation Name: Date: OCN 104: Our Dynamic Ocean Lab 12: El Nino Southern Oscillation Part 1: Observations of the tropical Pacific Ocean during a normal year The National Oceanographic and Atmospheric Administration

More information

Electrical Engineering and Computer Science Department The University of Toledo Toledo, OH 43606

Electrical Engineering and Computer Science Department The University of Toledo Toledo, OH 43606 Gursel Serpen and David L. Livingston Electrical Engineering and Computer Science Department The University of Toledo Toledo, OH 43606 ANNIE 98 PRESENTATION THE RESEARCH WORK A higher-order single-layer

More information

Advanced Counting Techniques. 7.1 Recurrence Relations

Advanced Counting Techniques. 7.1 Recurrence Relations Chapter 7 Advanced Counting Techniques 71 Recurrence Relations We have seen that a recursive definition of a sequence specifies one or more initial terms and a rule for determining subsequent terms from

More information

Local and Stochastic Search

Local and Stochastic Search RN, Chapter 4.3 4.4; 7.6 Local and Stochastic Search Some material based on D Lin, B Selman 1 Search Overview Introduction to Search Blind Search Techniques Heuristic Search Techniques Constraint Satisfaction

More information

MAT points Impact on Course Grade: approximately 10%

MAT points Impact on Course Grade: approximately 10% MAT 409 Test #2 60 points Impact on Course Grade: approximately 10% Name Score Solve each problem based on the information provided. It is not necessary to complete every calculation. That is, your responses

More information

CS 5321: Advanced Algorithms - Recurrence. Acknowledgement. Outline. Ali Ebnenasir Department of Computer Science Michigan Technological University

CS 5321: Advanced Algorithms - Recurrence. Acknowledgement. Outline. Ali Ebnenasir Department of Computer Science Michigan Technological University CS 5321: Advanced Algorithms - Recurrence Ali Ebnenasir Department of Computer Science Michigan Technological University Acknowledgement Eric Torng Moon Jung Chung Charles Ofria Outline Motivating example:

More information

Chapter 2. Mathematical Reasoning. 2.1 Mathematical Models

Chapter 2. Mathematical Reasoning. 2.1 Mathematical Models Contents Mathematical Reasoning 3.1 Mathematical Models........................... 3. Mathematical Proof............................ 4..1 Structure of Proofs........................ 4.. Direct Method..........................

More information

CS 5321: Advanced Algorithms Analysis Using Recurrence. Acknowledgement. Outline

CS 5321: Advanced Algorithms Analysis Using Recurrence. Acknowledgement. Outline CS 5321: Advanced Algorithms Analysis Using Recurrence Ali Ebnenasir Department of Computer Science Michigan Technological University Acknowledgement Eric Torng Moon Jung Chung Charles Ofria Outline Motivating

More information

CS Non-recursive and Recursive Algorithm Analysis

CS Non-recursive and Recursive Algorithm Analysis CS483-04 Non-recursive and Recursive Algorithm Analysis Instructor: Fei Li Room 443 ST II Office hours: Tue. & Thur. 4:30pm - 5:30pm or by appointments lifei@cs.gmu.edu with subject: CS483 http://www.cs.gmu.edu/

More information

Computational Complexity and Intractability: An Introduction to the Theory of NP. Chapter 9

Computational Complexity and Intractability: An Introduction to the Theory of NP. Chapter 9 1 Computational Complexity and Intractability: An Introduction to the Theory of NP Chapter 9 2 Objectives Classify problems as tractable or intractable Define decision problems Define the class P Define

More information

Why do we need math in a data structures course?

Why do we need math in a data structures course? Math Review 1 Why do we need math in a data structures course? To nalyze data structures and algorithms Deriving formulae for time and memory requirements Will the solution scale? Quantify the results

More information

Prolog: Resolution, Unification, & Cuts

Prolog: Resolution, Unification, & Cuts CS 152: Programming Language Paradigms Prolog: Resolution, Unification, & Cuts Prof. Tom Austin San José State University References for Prolog "Learn Prolog Now", http://www.learnprolognow.org SWI-Prolog

More information

SUBJECT: PHYSICAL SCIENCES GRADE: 10 CHAPTER / MODULE: MECHANICS UNIT / LESSON TOPIC: - Equations of Motion - Graphs of Motion

SUBJECT: PHYSICAL SCIENCES GRADE: 10 CHAPTER / MODULE: MECHANICS UNIT / LESSON TOPIC: - Equations of Motion - Graphs of Motion SUBJECT: PHYSICAL SCIENCES GRADE: 10 CHAPTER / MODULE: MECHANICS UNIT / LESSON TOPIC: - Equations of Motion - Graphs of Motion By the end of this unit, you should be able to: describe motion along a straight

More information

Cause (or Because) Effect Possible Questions and/or Conclusions

Cause (or Because) Effect Possible Questions and/or Conclusions TEACHER KEY: CHART FOR CAUSE AND EFFECT READING Changes in the Salinas Economy: Understanding a cause and effect reading Question: How did the railroad change the economy of the Salinas community? Cause

More information

Single qubit + CNOT gates

Single qubit + CNOT gates Lecture 6 Universal quantum gates Single qubit + CNOT gates Single qubit and CNOT gates together can be used to implement an arbitrary twolevel unitary operation on the state space of n qubits. Suppose

More information

1 Sequences and Summation

1 Sequences and Summation 1 Sequences and Summation A sequence is a function whose domain is either all the integers between two given integers or all the integers greater than or equal to a given integer. For example, a m, a m+1,...,

More information

TOC. Search Paradigms: And Tree Search. Formal Definitions. And-tree-based Search. Formal Definitions

TOC. Search Paradigms: And Tree Search. Formal Definitions. And-tree-based Search. Formal Definitions TOC CPSC 33 - Artificial Intelligence Search Paradigms: And Tree Search Adapted from slides by Jörg Rob Kremer Denzinger ICT 8 kremer@cpsc.ucalgary.ca http://pages.cpsc.ucalgary.ca/~kremer/ Introduction

More information

15-819K: Logic Programming Lecture 3. Induction. Frank Pfenning. September 5, 2006

15-819K: Logic Programming Lecture 3. Induction. Frank Pfenning. September 5, 2006 15-819K: Logic Programming Lecture 3 Induction Frank Pfenning September 5, 2006 One of the reasons we are interested in high-level programming languages is that, if properly designed, they allow rigorous

More information

Recurrent Problems. ITT9131 Konkreetne Matemaatika. Chapter One The Tower of Hanoi Lines in the Plane The Josephus Problem

Recurrent Problems. ITT9131 Konkreetne Matemaatika. Chapter One The Tower of Hanoi Lines in the Plane The Josephus Problem Recurrent Problems ITT93 Konkreetne Matemaatika Chapter One The Tower of Hanoi Lines in the Plane The Josephus Problem Contents The Tower of Hanoi Lines in the Plane 3 The Josephus Problem 4 Intermezzo:

More information

Linear Recurrence Relations

Linear Recurrence Relations Linear Recurrence Relations Linear Homogeneous Recurrence Relations The Towers of Hanoi According to legend, there is a temple in Hanoi with three posts and 64 gold disks of different sizes. Each disk

More information

The ecliptic and the sidereal motion of the sun Moon and the planets on it.

The ecliptic and the sidereal motion of the sun Moon and the planets on it. The ecliptic and the sidereal motion of the sun Moon and the planets on it. The following picture is a picture of the sky as it looks about noon on May 18 2012. The light of the Sun has been erased artificially

More information

Logical reasoning - Can we formalise our thought processes?

Logical reasoning - Can we formalise our thought processes? Logical reasoning - Can we formalise our thought processes? Why study (mathematical) logic? Logic: the science or method of reasoning Logical: able to reason correctly Human reasoning poorly understood,

More information

Chap. 2 Finite Automata

Chap. 2 Finite Automata Chap. 2 Finite Automata 2.1 An Informal Picture of Finite Automata A man with a wolf, goat, and cabbage is on the left bank of a river A boat carries one man and only one of the other three. The wolf eats

More information

COMP 555 Bioalgorithms. Fall Lecture 3: Algorithms and Complexity

COMP 555 Bioalgorithms. Fall Lecture 3: Algorithms and Complexity COMP 555 Bioalgorithms Fall 2014 Lecture 3: Algorithms and Complexity Study Chapter 2.1-2.8 Topics Algorithms Correctness Complexity Some algorithm design strategies Exhaustive Greedy Recursion Asymptotic

More information

Section 3.7: Solving Radical Equations

Section 3.7: Solving Radical Equations Objective: Solve equations with radicals and check for extraneous solutions. In this section, we solve equations that have roots in the problem. As you might expect, to clear a root we can raise both sides

More information

[1] Describe with examples, the three inference rules involving quantifiers

[1] Describe with examples, the three inference rules involving quantifiers [1] Describe with examples, the three inference rules involving quantifiers The three new inference rules are as follows: 1- Universal Instantiation : For any sentence a, variable v, and ground term g

More information

Affine Dynamic Logic

Affine Dynamic Logic Affine Dynamic Logic Sree Vishant Prabhakaran sreevisp@andrew.cmu.edu May 9, 2017 1 Abstract dl as we have seen in class is one of many dynamic multimodal logic systems used to model and prove statements

More information

INTRODUCTION TO ONE-DIMENSIONAL COLLISIONS (Elastic and Inelastic collisions)

INTRODUCTION TO ONE-DIMENSIONAL COLLISIONS (Elastic and Inelastic collisions) INTRODUCTION TO ONE-DIMENSIONAL COLLISIONS (Elastic and Inelastic collisions) The following two experiments deal with two different types of one-dimensional collisions. Below is a discussion of such collisions,

More information

Name: Partner(s): 1101 or 3310: Desk # Date: Eclipses. Purpose

Name: Partner(s): 1101 or 3310: Desk # Date: Eclipses. Purpose Name: Partner(s): 1101 or 3310: Desk # Date: Purpose Eclipses Describe the orbit of the Moon Explain the differences between the types of solar eclipses Explain the differences between the types of lunar

More information

COMPSCI 105 S Principles of Computer Science. Recursion 2

COMPSCI 105 S Principles of Computer Science. Recursion 2 COMPSCI 105 S2 2014 Principles of Computer Science Recursion 2 Exercise } We can determine how many digits a positive integer has by repeatedly dividing by 10 (without keeping the remainder) until the

More information

Lecture 29: Tractable and Intractable Problems

Lecture 29: Tractable and Intractable Problems Lecture 29: Tractable and Intractable Problems Aims: To look at the ideas of polynomial and exponential functions and algorithms; and tractable and intractable problems. Page 1 of 10 To look at ways of

More information

The Karnaugh Map COE 202. Digital Logic Design. Dr. Muhamed Mudawar King Fahd University of Petroleum and Minerals

The Karnaugh Map COE 202. Digital Logic Design. Dr. Muhamed Mudawar King Fahd University of Petroleum and Minerals The Karnaugh Map COE 202 Digital Logic Design Dr. Muhamed Mudawar King Fahd University of Petroleum and Minerals Presentation Outline Boolean Function Minimization The Karnaugh Map (K-Map) Two, Three,

More information

Notes for Lecture 21

Notes for Lecture 21 U.C. Berkeley CS170: Intro to CS Theory Handout N21 Professor Luca Trevisan November 20, 2001 Notes for Lecture 21 1 Tractable and Intractable Problems So far, almost all of the problems that we have studied

More information

Solving Equations by Adding and Subtracting

Solving Equations by Adding and Subtracting SECTION 2.1 Solving Equations by Adding and Subtracting 2.1 OBJECTIVES 1. Determine whether a given number is a solution for an equation 2. Use the addition property to solve equations 3. Determine whether

More information

CHAPTER 7 ELECTRODYNAMICS

CHAPTER 7 ELECTRODYNAMICS CHAPTER 7 ELECTRODYNAMICS Outlines 1. Electromotive Force 2. Electromagnetic Induction 3. Maxwell s Equations Michael Faraday James C. Maxwell 2 Summary of Electrostatics and Magnetostatics ρ/ε This semester,

More information

GENERAL MATHEMATICS 11

GENERAL MATHEMATICS 11 THE SEED MONTESSORI SCHOOL GENERAL MATHEMATICS 11 Operations on Propositions July 14, 2016 WORK PLAN Daily Routine Objectives Recall Lesson Proper Practice Exercises Exit Card DAILY DOSE On ¼ sheet of

More information

Foundations of Artificial Intelligence

Foundations of Artificial Intelligence Foundations of Artificial Intelligence 31. Propositional Logic: DPLL Algorithm Malte Helmert and Gabriele Röger University of Basel April 24, 2017 Propositional Logic: Overview Chapter overview: propositional

More information

Lecture 10: Multiple Integrals

Lecture 10: Multiple Integrals Lecture 10: Multiple Integrals 1. Key points Multiple integrals as Iterated Integrals Change of variables: Jacobian Maple int(f(x,y),[xa..b,yc..d]) VectorCalculus[Jacobian] LinearAlgebra[Determinant] 2.

More information

Exercise 4.0 PLANETARY ORBITS AND CONFIGURATIONS

Exercise 4.0 PLANETARY ORBITS AND CONFIGURATIONS Exercise 4.0 PLANETARY ORBITS AND CONFIGURATIONS I. Introduction The planets revolve around the Sun in orbits that lie nearly in the same plane. Therefore, the planets, with the exception of Pluto, are

More information

5. Sequences & Recursion

5. Sequences & Recursion 5. Sequences & Recursion Terence Sim 1 / 42 A mathematician, like a painter or poet, is a maker of patterns. Reading Sections 5.1 5.4, 5.6 5.8 of Epp. Section 2.10 of Campbell. Godfrey Harold Hardy, 1877

More information

RECAP!! Paul is a safe driver who always drives the speed limit. Here is a record of his driving on a straight road. Time (s)

RECAP!! Paul is a safe driver who always drives the speed limit. Here is a record of his driving on a straight road. Time (s) RECAP!! What is uniform motion? > Motion in a straight line > Moving at a constant speed Yes or No? Yes or No? Paul is a safe driver who always drives the speed limit. Here is a record of his driving on

More information

CS 126 Lecture T6: NP-Completeness

CS 126 Lecture T6: NP-Completeness CS 126 Lecture T6: NP-Completeness Outline Introduction: polynomial vs. exponential time P vs. NP: the holy grail NP-Completeness: Cook s Theorem NP-Completeness: Reduction Conclusions CS126 19-1 Randy

More information

Vocabulary Activities

Vocabulary Activities Ecosystems, Food Chains + Food Webs Vocabulary Activities 2012 Three Dog Graphx Designs Ecosystems, Food Chains + Food Webs Vocabulary Activities by Tom Wier This three page set of vocabulary worksheets

More information

Topics in Algorithms. 1 Generation of Basic Combinatorial Objects. Exercises. 1.1 Generation of Subsets. 1. Consider the sum:

Topics in Algorithms. 1 Generation of Basic Combinatorial Objects. Exercises. 1.1 Generation of Subsets. 1. Consider the sum: Topics in Algorithms Exercises 1 Generation of Basic Combinatorial Objects 1.1 Generation of Subsets 1. Consider the sum: (ε 1,...,ε n) {0,1} n f(ε 1,..., ε n ) (a) Show that it may be calculated in O(n)

More information

Logic Programming: Prolog

Logic Programming: Prolog Logic Programming: Prolog Course: CS40002 Instructor: Dr. Pallab Dasgupta Department of Computer Science & Engineering Indian Institute of Technology Kharagpur Basics The notion of instantiation likes(

More information

Department of Electrical and Computer Engineering University of Wisconsin Madison. Fall Midterm Examination CLOSED BOOK

Department of Electrical and Computer Engineering University of Wisconsin Madison. Fall Midterm Examination CLOSED BOOK Department of Electrical and Computer Engineering University of Wisconsin Madison ECE 553: Testing and Testable Design of Digital Systems Fall 203-204 Midterm Examination CLOSED OOK Kewal K. Saluja Date:

More information

Algorithms. Adnan YAZICI Dept. of Computer Engineering Middle East Technical Univ. Ankara - TURKEY. Algorihms, A.Yazici, Fall 2007 CEng 315

Algorithms. Adnan YAZICI Dept. of Computer Engineering Middle East Technical Univ. Ankara - TURKEY. Algorihms, A.Yazici, Fall 2007 CEng 315 Algorithms Adnan YAZICI Dept. of Computer Engineering Middle East Technical Univ. Ankara - TURKEY Algorihms, A.Yazici, Fall 2007 CEng 315 1 Design and Analysis of Algorithms Aspects of studying algorithms:

More information

Teaching with a Smile

Teaching with a Smile Teaching with a Smile Igor Minevich Boston College AMS - MAA Joint Mathematics Meetings January 11, 2015 Outline 1 Introduction 2 Puzzles and Other Fun Stuff 3 Projects Yin-Yang of Mathematics Yang Logic

More information

, find P(X = 2 or 3) et) 5. )px (1 p) n x x = 0, 1, 2,..., n. 0 elsewhere = 40

, find P(X = 2 or 3) et) 5. )px (1 p) n x x = 0, 1, 2,..., n. 0 elsewhere = 40 Assignment 4 Fall 07. Exercise 3.. on Page 46: If the mgf of a rom variable X is ( 3 + 3 et) 5, find P(X or 3). Since the M(t) of X is ( 3 + 3 et) 5, X has a binomial distribution with n 5, p 3. The probability

More information

Why Willpower is Never Enough and What to do About It

Why Willpower is Never Enough and What to do About It mattmcwilliams.com Why Willpower is Never Enough and What to do About It Willpower alone is never enough to overcome an obstacle, resist temptation, or reach your destiny. In fact, as the day wears on,

More information

RELATED RATE PROBLEMS

RELATED RATE PROBLEMS MA123, Chapter 7a: Related Rates Word Problems (pp. 140-149, Gootman) Chapter Goals: In this Chapter we learn a general strategy on how to approach related rates problems, one of the main types of word

More information

CHAPTER 10 TRIGONOMETRY

CHAPTER 10 TRIGONOMETRY CHAPTER 10 TRIGONOMETRY EXERCISE 39, Page 87 1. Find the length of side x in the diagram below. By Pythagoras, from which, 2 25 x 7 2 x 25 7 and x = 25 7 = 24 m 2. Find the length of side x in the diagram

More information

Chap. 2 Finite Automata

Chap. 2 Finite Automata Chap. 2 Finite Automata 2.1 An Informal Picture of Finite Automata (See 2nd Edition) A man with a wolf, goat, and cabbage is on the left bank of a river A boat carries one man and only one of the other

More information

Relative Velocities In Two Dimensions

Relative Velocities In Two Dimensions Relative Velocities In Two Dimensions The heading is the angle of the moving body the direction the object is pointing. The resultant velocity is typically the velocity of the object relative to the ground.

More information

Series Editor KENNETH H. ROSEN INDUCTION THEORY AND APPLICATIONS. of Manitoba. University. Winnipeg, Canada. CRC Press. Taylor StFrancis Group

Series Editor KENNETH H. ROSEN INDUCTION THEORY AND APPLICATIONS. of Manitoba. University. Winnipeg, Canada. CRC Press. Taylor StFrancis Group DISCIIETE MATHEMATICS AND ITS APPLICATIONS Series Editor KENNETH H. ROSEN HANDBOOK OF MATHEMATICAL INDUCTION THEORY AND APPLICATIONS David S. Gunderson University of Manitoba Winnipeg, Canada CRC Press

More information

Introduction to Intelligent Systems: Homework 2

Introduction to Intelligent Systems: Homework 2 Introduction to Intelligent Systems: Homework 2 lvin Lin - Section 1 ugust 2017 - December 2017 Problem 1 For each of the following, gives a PES description of the task and given solver of the tasks. There

More information

Test Booklet. Subject: SC, Grade: 05 5th Grade Science May Student name:

Test Booklet. Subject: SC, Grade: 05 5th Grade Science May Student name: Test Booklet Subject: SC, Grade: 05 5th Grade Science May 2010 Student name: Author: Ohio District: Ohio Released Tests Printed: Monday July 02, 2012 1 Scientists found fish fossils in the desert. What

More information