HW#2: Due Oct 18 NOTE. Submit both hardcopy and softcopy.

Slides:



Advertisements
Similar presentations
CSC 205 Programming II Lecture 10 Towers of Hanoi.
Advertisements

More Recursion: Permutations and Towers of Hanoi COP 3502.
AE1APS Algorithmic Problem Solving John Drake
Introducing Formal Methods, Module 1, Version 1.1, Oct., Formal Specification and Analytical Verification L 5.
HW4:Royal Garden’s Puzzle as a Model Checking Problem Pictures from UbiSoft.
COSO 1030 Section 4 Recursion. What is about Towers of Hanoi Divide and Conquer Strategy Recursion and Induction Thinking Recursively Recursion Pitfalls.
Fall 2007CS 2251 Proof by Induction. Fall 2007CS 2252 Proof by Induction There are two forms of induction Standard Induction –Prove the theorem is true.
Algorithms Describing what you know. Contents What are they and were do we find them? Why show the algorithm? What formalisms are used for presenting.
High-Level Programming Languages: C++
Towers of Hanoi. Introduction This problem is discussed in many maths texts, And in computer science an AI as an illustration of recursion and problem.
Analysis of Algorithm Lecture 3 Recurrence, control structure and few examples (Part 1) Huma Ayub (Assistant Professor) Department of Software Engineering.
 2003 Prentice Hall, Inc. All rights reserved. 1 Functions and Recursion Outline Function Templates Recursion Example Using Recursion: The Fibonacci Series.
Computer Science: A Structured Programming Approach Using C1 6-9 Recursion In general, programmers use two approaches to writing repetitive algorithms.
Click here to register TAN online Online TAN Registration.
© 2011 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Stewart Venit ~ Elizabeth Drake Developing a Program.
C++ Basics C++ is a high-level, general purpose, object-oriented programming language.
Chapter 10.7 Notes: Solve Quadratic Equations by the Quadratic Formula Goal: You will solve quadratic equations by using the Quadratic Formula.
HW6: Due Dec 8th 23:59 1.Describe test cases to reach full path coverage of the triangle program by completing the path condition table below. Also, draw.
1 ELEC 206 Chapter 3 Control Structures 5-Step Problem Solving Methodology 1. State the problem clearly. 2. Describe the input and output. 3. Work a.
HW #2. Due Mar 27 23:59 Do NOT forget to submit both a hardcopy solution to the HW box and a softcopy solution to TA (Youngjoo Kim):
Data Structure and Algorithms. Algorithms: efficiency and complexity Recursion Reading Algorithms.
HW#3: Due Nov 9 NOTE. Submit both hardcopy and softcopy. 1. Formal verification of a flash memory reading unit (70 pts) – Show the correctness of the flash_read()
Chapter 6 Questions Quick Quiz
Q1:Royal Garden’s Puzzle as a Model Checking Problem Pictures from UbiSoft HW6: Due Dec 4th 23:59.
IXP Lab 2012: Part 2 Example Functions. Outline Demo-1: Packet Counter – 1ME Version Demo-2: Packet Counter – nMEs Version Demo-3: Packet Size Counter.
Ex2. Tower of Hanio 1/11 Write down a C program to solve the Tower of Hanoi ga me (3 poles and 4 disks) by using CBMC – Hint: you may non-deterministically.
HW7: Due Dec 5th 23:59 1.Describe test cases to reach full path coverage of the triangle program by completing the path condition table below. Also, draw.
HW #5 Due Nov 14 23:59 1. Write down a C program and a Promela model to solve the Tower of Hanoi game (3 poles and 4 disks) by using CBMC and Spin Hint:
1 Towers of Hanoi Three pegs, one with n disks of decreasing diameter; two other pegs are empty Task: move all disks to the third peg under the following.
Programming Application in Civil Engineering
Recursion CS 244 Brent M. Dingle, Ph.D. Game Design and Development Program Department of Mathematics, Statistics, and Computer Science University of Wisconsin.
Unit 6 Analysis of Recursive Algorithms
Recursion.
Recursion Data Structure Submitted By:- Dheeraj Kataria.
Memory: Page Table Structure
The Zero Product Property
Chapter 4 C Program Control Part I
Recursion Chapter 12.
Towers of Hanoi Move n (4) disks from pole A to pole C
Engineering Problem Solving with C++, Etter/Ingber
Java Software Structures: John Lewis & Joseph Chase
HW: Maintenance Sheet 7.10 *Due Friday
Unit 6 Part 2 Test Review Algebra 1.
Loops in C C has three loop statements: the while, the for, and the do…while. The first two are pretest loops, and the the third is a post-test loop. We.
Chapter 5 Repetition.
Variables In programming, we often need to have places to store data. These receptacles are called variables. They are called that because they can change.
Written Description of Algorithms
Structured Program Development in C
Functions.
CSE 1342 Programming Concepts
Jeopardy Final Jeopardy Vocabulary Function Tables Random $100 $100
Key Difference between Manual Testing and Model Checking
HW#5 1. Verify the max_heapify(int x[],int i,int h_size) by using CBMC
HW Verify the max_heapify(int x[],int i,int h_size) by using CBMC
WDYE? 3.2: Analyzing Fairness
MATH 1310 Session 2.
2. Second Step for Learning C++ Programming • Data Type • Char • Float
Loop Construct.
HW #2. Due Apr 25 23:59 Do NOT forget to submit both a hardcopy solution to the HW box and a softcopy solution to TA.
Move this box to see the hints (there are two hints for this code)
WDYE? 3.2: Analyzing Fairness
Basic Concepts of Algorithm
1. Show the correctness of the following max() (50 pts)
HW#3: Due Nov 8 23:59 NOTE. Submit both hardcopy and softcopy.
Recursive Thinking.
  Homework 6 (June 20) Material covered: Slides
Warm Up Objective: Scientists will describe forensic geology by analyzing the stations. What is the topic? What will you be doing? Why is this important?
Q1:Royal Garden’s Puzzle as a Model Checking Problem
HW#7 Describe test cases to reach full path coverage of the triangle program by completing the path condition table below. Also, draw the complete execution.
Algorithms and data structures: basic definitions
Presentation transcript:

HW#2: Due Oct 18 NOTE. Submit both hardcopy and softcopy. Formal verification of a flash memory reading unit (70 pts) Show the correctness of the flash_read() By using randomized testing Randomly select the physical sectors to write four characters and set the corresponding SAMs By using exhaustive testing Create 43680 (16*15*14*13) distinct test cases Do not print test cases in your hardcopy to save trees By using CBMC Create environment model satisfying the invariant formula by using __CPROVER_assume() and nested loops Submit the above three answers The above three versions of code including the target program and your environment Describe your environment model in detail Compare the three verification results (i.e., time, memory usage, assert violation, etc)

typedef struct _SAM_type{ unsigned char offset[SECT_PER_U]; }SAM_type; typedef struct _PU_type{ unsigned char sect[SECT_PER_U]; }PU_type; // Environment assumption // 0. Each unit contains 4 sectors. // 1. There is one logical unit containing "abcd" // 2. There are 4 physical units // 3. The value of SAM table is 255 if the corresponding // physical sector does not have a valid data void flash_read(char *buf, SAM_type *SAM, PU_type *pu ){ unsigned char nSamIdx = 0; unsigned char pu_id = 0; unsigned char n_scts = 4; // number of sectors to read unsigned char offset = 0; //offset of the physical sector to read unsigned char pBuf = 0; while(n_scts > 0){ pu_id=0; offset = 255; // read 1 character while(1) { if (SAM[pu_id].offset[nSamIdx] != 255){ offset = SAM[pu_id].offset[nSamIdx++]; buf[pBuf] = PU[pu_id].sect[offset]; break; } pu_id ++; n_scts--; pBuf ++;

Write down a C program to solve the Tower of Hanoi game (3 poles and 4 disks) by using CBMC (30 pts) Hint: you may non-deterministically select the disk to move Find the shortest solution by analyzing counter examples. Also explain why your solution is the shortest one. Use non-determinism and __CPROVER_assume() properly for the moving choice Use assert statement to detect when all the disks are moved to the destination