2012: J Paul GibsonTSP: MSC SAI Mathematical FoundationsMAT7003.Computability- Answers.1 MAT 7003 : Mathematical Foundations (for Software Engineering)

Slides:



Advertisements
Similar presentations
Automated Theorem Proving Lecture 1. Program verification is undecidable! Given program P and specification S, does P satisfy S?
Advertisements

Sorting algorithms Sieve of Eratosthenes
2009: J Paul GibsonT&MSP-CSC 4504 : Langages formels et applications Event-B/DataStructures.1 CSC 4504 : Langages formels et applications (La méthode Event-B)
2009: J Paul GibsonT&MSP-CSC 4504 : Langages formels et applications Event-B/Purse.1 CSC 4504 : Langages formels et applications (La méthode Event-B) J.
2009: J Paul GibsonT&MSP-CSC 4504 : Langages formels et applications Event-B/PurseCode.1 CSC 4504 : Langages formels et applications (La méthode Event-B)
2012: J Paul GibsonT&MSP: Mathematical FoundationsMAT7003/L2-GraphsAndTrees.1 MAT 7003 : Mathematical Foundations (for Software Engineering) J Paul Gibson,
Discrete Mathematics I Lectures Chapter 6
2012 J Paul GibsonTSP: Mathematical FoundationsMAT7003/L6-XO-Answer.1 MAT 7003 : Mathematical Foundations (for Software Engineering) J Paul Gibson, A207.
Induction and recursion
2010: J Paul GibsonTSP: Mathematical FoundationsMAT7003/Logic-SampleAnswers.1 MAT 7003 : Mathematical Foundations (for Software Engineering) J Paul Gibson,
0 PROGRAMMING IN HASKELL Chapter 5 - List Comprehensions.
Fixing Broken Programs. How do you figure out what’s wrong? Look carefully at the error message. Locate the error – Most messages have line numbers –
 x (x 2  0) 1. True2. False.  x (3x + 2 = 12) 1. True2. False.
2012: J Paul GibsonTSP: Mathematical FoundationsMAT7003/L5- CountingAndEnumeration.1 MAT 7003 : Mathematical Foundations (for Software Engineering) J Paul.
Addition of Fractions with unlike Denominators
2012: J Paul GibsonTSP: Mathematical FoundationsMAT7003/L7-Computability.1 MAT 7003 : Mathematical Foundations (for Software Engineering) J Paul Gibson,
4 m m – 3 = Apply cross product property 4 6 = (m – 3) (m + 2) 4m + 8 = 6m – 18 Distribute Subtract – 6m − 2m + 8 = − 18 Subtract − 2m = − 26 Divide.
Prime Factorization.
Session 05: C# Patterns Algorithm Patterns: Sweep Search FEN AK IT: Softwarekonstruktion.
Introduction to Proofs
Mathematical Induction. F(1) = 1; F(n+1) = F(n) + (2n+1) for n≥ F(n) n F(n) =n 2 for all n ≥ 1 Prove it!
Math 3121 Abstract Algebra I Section 0: Sets. The axiomatic approach to Mathematics The notion of definition - from the text: "It is impossible to define.
MATH 224 – Discrete Mathematics
DECIDABILITY OF PRESBURGER ARITHMETIC USING FINITE AUTOMATA Presented by : Shubha Jain Reference : Paper by Alexandre Boudet and Hubert Comon.
Chapter 4.1 Solving Systems of Linear Equations in two variables.
2012: J Paul GibsonTSP: MSC SAI Mathematical FoundationsMAT7003.ProofsWithRodin.1 MAT 7003 : Mathematical Foundations (for Software Engineering) J Paul.
Advanced Algorithms Analysis and Design By Syed Hasnain Haider.
School of Computing and Engineering, University of Huddersfield CIA2326 Week 14 LECTURE: Formal Specifications. How to reason with Algebraic Specifications.
Lecture 11 Data Structures, Algorithms & Complexity Introduction Dr Kevin Casey BSc, MSc, PhD GRIFFITH COLLEGE DUBLIN.
Objectives You will be able to: 1.Add, subtract, multiply and divide integers. 2. Use the number line as a tool to help.
Nested Quantifiers Section 1.5.
1 Introduction to Abstract Mathematics Chapter 2: The Logic of Quantified Statements. Predicate Calculus Instructor: Hayk Melikya 2.3.
Methods of Proof Dr. Yasir Ali. Proof A (logical) proof of a statement is a finite sequence of statements (called the steps of the proof) leading from.
CSE 311 Foundations of Computing I Lecture 9 Proofs and Set Theory Autumn 2012 CSE
Computability Heap exercise. The class P. The class NP. Verifiers. Homework: Review RELPRIME proof. Find examples of problems in NP.
Operations with Decimals
2012: J Paul GibsonTSP: Mathematical FoundationsMAT7003/Project.1 MAT 7003 : Mathematical Foundations (for Software Engineering) J Paul Gibson, A207
Basic Definitions of Set Theory Lecture 23 Section 5.1 Wed, Mar 8, 2006.
MAT 1221 Survey of Calculus Section 2.4 The Product and Quotient Rules
Adding, Subtracting, Multiplying, and Diving Integers!!!
CSE 311: Foundations of Computing Fall 2013 Lecture 8: Proofs and Set theory.
Chapter 5. Section 5.1 Climbing an Infinite Ladder Suppose we have an infinite ladder: 1.We can reach the first rung of the ladder. 2.If we can reach.
Calculate the Following (Group A): – – (-5) (-5) 5. 3 – (+5)
Advanced Algorithms Analysis and Design By Dr. Nazir Ahmad Zafar Dr Nazir A. Zafar Advanced Algorithms Analysis and Design.
Pass the Parcel specification game[preparetopass12,pass12,preparetopass23,pass23, preparetopass34,pass34,preparetopass41,pass41, musicstop,musicstart,present]
Week 1 Real Numbers and Their Properties (Section 1.6, 1.7, 1.8)
HOW can properties be used to prove rules for multiplying integers?
Foundations of Computing I CSE 311 Fall Announcements Homework #2 due today – Solutions available (paper format) in front – HW #3 will be posted.
Chapter 1 Logic and Proof.
CIS Automata and Formal Languages – Pei Wang
PROGRAMMING IN HASKELL
PROGRAMMING IN HASKELL
Factors, multiple, primes: Factors from prime factors
CSE 311 Foundations of Computing I
Induction and recursion
EQ: How do I solve an equation in one variable?
Factors, multiple, primes: Prime factors
Advanced Algorithms Analysis and Design
Copyright © Cengage Learning. All rights reserved.
True or False: {image} is one-to-one function.
PRIME FACTORIZATION USING FACTOR TREES!.
PROGRAMMING IN HASKELL
CSE 3302 Programming Languages
Section 2.1 Properties of Numbers
Sub-system interfaces
CSCE 314: Programming Languages Dr. Dylan Shell
Learning Target I can multiply and divide integers.
1-7 Subtracting Integers
SETS, RELATIONS, FUNCTIONS
Factors, multiple, primes: Multiples
Presentation transcript:

2012: J Paul GibsonTSP: MSC SAI Mathematical FoundationsMAT7003.Computability- Answers.1 MAT 7003 : Mathematical Foundations (for Software Engineering) J Paul Gibson, A207 Computability-Answers

2012: J Paul GibsonTSP: MSC SAI Mathematical FoundationsMAT7003.Computability- Answers.2 QUESTION: A TRS for formally defining if a number is prime Note: easier to do in other formal languages/methods because the necessary concepts (like integers and lists are part of the language) But, with the TRS we define just what we need and use it only where needed. In software process it is this targetting (with the minimum force necessary) which is best … Question: can you write a TRS for deciding if a given number is prime? Hint: if not, try to break the problem down into bits For the lists model/properties we should (but don’t have to) move up a level of abstraction! We introduce Abstract Data Types…. IMHO the most powerful and universally applicable software process formal methods tool.

2012: J Paul GibsonTSP: MSC SAI Mathematical FoundationsMAT7003.Computability- Answers.3 A TRS for deciding if a number is composite x-ty-qz -> Cz Add to the tq- system (for multiply): Proposed Rule: if Cx is not a theorem then Px is a theorem Question: why may this not be acceptable for deciding if a number is prime? POSSIBLE ANSWER:

2012: J Paul GibsonTSP: MSC SAI Mathematical FoundationsMAT7003.Computability- Answers.4 A TRS for deciding if a number is prime AXIOM P-- xy DND x REWRITE RULES x DND y -> x DND xy -- DNDz -> zDF-- zDFx and x-DNDz -> zDFx- z-DFz -> Pz- Question: Can you verify that this is correct?

2012: J Paul GibsonTSP: MSC SAI Mathematical FoundationsMAT7003.Computability- Answers.5 Question: add remove operation TYPE Set SORTS Int, Bool OPNS empty:-> Set str: Set, int -> Set add: Set, int -> Set contains: Set, int -> Bool EQNS forall s :Set, x,y:int contains(empty, x) = false; x eq y => contains(str(s,x), y) = true; not (x eq y) => contains(str(s,x), y) = contains(s,y); contains(s,x) => add(s,x) = s; not(contains(s,x)) => add(s,x) = str(s,x) ENDTYPE remove: Set, int -> Set remove (empty, x) = empty x eq y => remove(str(s,x), y) = s; not(x eq y) => remove(str(s,x), y) = str(remove(s,y), x);

2012: J Paul GibsonTSP: MSC SAI Mathematical FoundationsMAT7003.Computability- Answers.6 Question: add union operation TYPE Set SORTS Int, Bool OPNS empty:-> Set str: Set, int -> Set add: Set, int -> Set contains: Set, int -> Bool EQNS forall s,s1,s2 :Set, x,y:int contains(empty, x) = false; x eq y => contains(str(s,x), y) = true; not (x eq y) => contains(str(s,x), y) = contains(s,y); contains(s,x) => add(s,x) = s; not(contains(s,x)) => add(s,x) = str(s,x) ENDTYPE union: Set, Set -> Set union (empty, s1) = s1; union (str(s1,x), s2) = union (s1, add(s2,x));

2012: J Paul GibsonTSP: MSC SAI Mathematical FoundationsMAT7003.Computability- Answers.7 Question: add equality operation TYPE Set SORTS Int, Bool OPNS empty:-> Set str: Set, int -> Set add: Set, int -> Set contains: Set, int -> Bool EQNS forall s,s1,s2 :Set, x,y:Int contains(empty, x) = false; x eq y => contains(str(s,x), y) = true; not (x eq y) => contains(str(s,x), y) = contains(s,y); contains(s,x) => add(s,x) = s; not(contains(s,x)) => add(s,x) = str(s,x) ENDTYPE equals, subset: Set, Set -> Bool equals(s1, s2) = subset(s1,s2) and subset (s2,s1) subset(empty, empty) = true; subset(empty, str(s,x)) = true; subset(str(s2,x), s1) = contains (s1,x) and subset(s2, s1);