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()

Slides:



Advertisements
Similar presentations
Towers of Hanoi Move n (4) disks from pole A to pole C such that a disk is never put on a smaller disk A BC ABC.
Advertisements

CSC 205 Programming II Lecture 10 Towers of Hanoi.
More Recursion: Permutations and Towers of Hanoi COP 3502.
AE1APS Algorithmic Problem Solving John Drake
MATH 224 – Discrete Mathematics
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.
Dynamic Programming.
Factorial Recursion stack Binary Search Towers of Hanoi
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.
Chapter 8 . Sequence Control
Recursion.
Assignment #2, 12- month Calendar CS-2301, B-Term Programming Assignment #2 12-Month Calendar CS-2301, System Programming for Non-Majors (Slides.
Data Structures and Programming.  John Edgar2.
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.
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.
Department of Computer Science Data Structures Using C++ 2E Chapter 6: Recursion Learn about recursive Definitions Algorithms Functions Explore the base.
Computer Science: A Structured Programming Approach Using C1 6-9 Recursion In general, programmers use two approaches to writing repetitive algorithms.
Programming for Beginners Martin Nelson Elizabeth FitzGerald Lecture 5: Software Design & Testing; Revision Session.
© 2011 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Stewart Venit ~ Elizabeth Drake Developing a Program.
Data Structures and Algorithms Introduction to Algorithms M. B. Fayek CUFE 2006.
C++ Basics C++ is a high-level, general purpose, object-oriented programming language.
Edited by Malak Abdullah Jordan University of Science and Technology Data Structures Using C++ 2E Chapter 6 Recursion.
Java Programming: Guided Learning with Early Objects Chapter 11 Recursion.
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.
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):
1 Program Planning and Design Important stages before actual program is written.
Data Structure and Algorithms. Algorithms: efficiency and complexity Recursion Reading Algorithms.
Text Exercise 12.2 (a) (b) (c) Construct the completed ANOVA table below. Answer this part by indicating what the f test statistic value is, what the appropriate.
Chapter 6 Questions Quick Quiz
Q1:Royal Garden’s Puzzle as a Model Checking Problem Pictures from UbiSoft HW6: Due Dec 4th 23:59.
Week 61 Introduction to Programming Ms. Knudtzon C Period Tuesday October 12.
Recursion. 2 Overview  Learn about recursive definitions  Explore the base case and the general case of a recursive definition  Discover recursive.
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 Recursion Recursive function: a function that calls itself (directly or indirectly). Recursion is often a good alternative to iteration (loops). Its.
4 - Conditional Control Structures CHAPTER 4. Introduction A Program is usually not limited to a linear sequence of instructions. In real life, a programme.
Computer Programming 12 Lesson 6 – Loop structure By: Dan Lunney.
Selection Using IF THEN ELSE CASE Introducing Loops.
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.
1 Data Structures CSCI 132, Spring 2016 Notes 16 Tail Recursion.
Programming Application in Civil Engineering
Algorithm Analysis 1.
Recursion.
Recursion Data Structure Submitted By:- Dheeraj Kataria.
Introduction to Programming
Chapter 4 C Program Control Part I
Engineering Problem Solving with C++, Etter/Ingber
Lecture 2 Introduction to Programming
Programming Problem steps must be able to be fully & unambiguously described Problem types; Can be clearly described Cannot be clearly described (e.g.
HW: Maintenance Sheet 7.10 *Due Friday
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.
HW#2: Due Oct 18 NOTE. Submit both hardcopy and softcopy.
Structured Program Development in C
Notes 9.5 – Mathematical Induction
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
MATH 1310 Session 2.
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.
HW#3: Due Nov 8 23:59 NOTE. Submit both hardcopy and softcopy.
Recursive Thinking.
  Homework 6 (June 20) Material covered: Slides
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#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() By using randomized testing – Randomly select the physical sectors to write four characters and set the corresponding SAMs By using exhaustive testing – Create (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 ++; }

2. Write down a C program to solve the Tower of Hanoi game (3 poles and 5 disks) in a random manner (10 pts) Do not solve the game using an intelligent strategy, but random sequence of moving choices Obtain 100 random solutions and get the average step #. Describe the shortest solution among the above 100 solutions 3. Write down a C program to solve the Tower of Hanoi game (3 poles and 5 disks) by using CBMC (20 pts) Hint: the C program will be quite similar to the random one 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