Midterm COM3220 Open book/open notes Tuesday, April 28, 6pm pm

Slides:



Advertisements
Similar presentations
Lecture 15. Graph Algorithms
Advertisements

1 Turing Machines and Equivalent Models Section 13.2 The Church-Turing Thesis.
Some Graph Algorithms.
Planning based on Model Checking Dept. of Information Systems and Applied CS Bamberg University Seminar Paper Svetlana Balinova.
Chapter 7 - Local Stabilization1 Chapter 7: roadmap 7.1 Super stabilization 7.2 Self-Stabilizing Fault-Containing Algorithms 7.3 Error-Detection Codes.
ECE Synthesis & Verification - L271 ECE 697B (667) Spring 2006 Synthesis and Verification of Digital Systems Model Checking basics.
Midwestern State University Department of Computer Science Dr. Ranette Halverson CMPS 2433 – CHAPTER 4 GRAPHS 1.
PROTOCOL VERIFICATION & PROTOCOL VALIDATION. Protocol Verification Communication Protocols should be checked for correctness, robustness and performance,
Planar Orientations Chapter 4 ( ) in the book Written By: Tomer Heber.
IKI 10100: Data Structures & Algorithms Ruli Manurung (acknowledgments to Denny & Ade Azurat) 1 Fasilkom UI Ruli Manurung (Fasilkom UI)IKI10100: Lecture10.
CompSci 102 Discrete Math for Computer Science April 19, 2012 Prof. Rodger Lecture adapted from Bruce Maggs/Lecture developed at Carnegie Mellon, primarily.
CS138A Single Source Shortest Paths Peter Schröder.
Topological Sort and Hashing
Graph Algorithms: Topological Sort The topological sorting problem: given a directed, acyclic graph G = (V, E), find a linear ordering of the vertices.
Graphs Chapter 12. Chapter Objectives  To become familiar with graph terminology and the different types of graphs  To study a Graph ADT and different.
© 2006 Pearson Addison-Wesley. All rights reserved14 A-1 Chapter 14 excerpts Graphs (breadth-first-search)
Computability and Complexity 15-1 Computability and Complexity Andrei Bulatov NP-Completeness.
CS 536 Spring Global Optimizations Lecture 23.
Improving code generation. Better code generation requires greater context Over expressions: optimal ordering of subtrees Over basic blocks: Common subexpression.
Connected Components, Directed Graphs, Topological Sort COMP171.
4/25/08Prof. Hilfinger CS164 Lecture 371 Global Optimization Lecture 37 (From notes by R. Bodik & G. Necula)
Graphs Chapter 12. Chapter 12: Graphs2 Chapter Objectives To become familiar with graph terminology and the different types of graphs To study a Graph.
Temporal Logic and Model Checking. Reactive Systems We often classify systems into two types: Transformational: functions from inputs available at the.
Spring 2010CS 2251 Graphs Chapter 10. Spring 2010CS 2252 Chapter Objectives To become familiar with graph terminology and the different types of graphs.
Connected Components, Directed Graphs, Topological Sort Lecture 25 COMP171 Fall 2006.
Prof. Fateman CS 164 Lecture 221 Global Optimization Lecture 22.
מבנה המחשב – מבוא למחשבים ספרתיים Foundations of Combinational Circuits תרגול מספר 3.
Connected Components, Directed graphs, Topological sort COMP171 Fall 2005.
Fall 2007CS 2251 Graphs Chapter 12. Fall 2007CS 2252 Chapter Objectives To become familiar with graph terminology and the different types of graphs To.
Improving Code Generation Honors Compilers April 16 th 2002.
 Last lesson  Graphs  Today  Graphs (Implementation, Traversal)
Tirgul 7 Review of graphs Graph algorithms: – BFS (next tirgul) – DFS – Properties of DFS – Topological sort.
CS2420: Lecture 36 Vladimir Kulyukin Computer Science Department Utah State University.
Prof. Bodik CS 164 Lecture 16, Fall Global Optimization Lecture 16.
Specification Patterns Early taxonomy for property specifications –safety properties: nothing bad will ever happen –liveness properties: something good.
© 2006 Pearson Addison-Wesley. All rights reserved14 A-1 Chapter 14 Graphs.
Introduction to Graphs. Introduction Graphs are a generalization of trees –Nodes or verticies –Edges or arcs Two kinds of graphs –Directed –Undirected.
Algorithm Design.
Graphs Chapter 12. Chapter 12: Graphs2 Chapter Objectives To become familiar with graph terminology and the different types of graphs To study a Graph.
© 2006 Pearson Addison-Wesley. All rights reserved 14 A-1 Chapter 14 Graphs.
Copyright 2001, Matt Dwyer, John Hatcliff, and Radu Iosif. The syllabus and all lectures for this course are copyrighted materials and may not be used.
DATA STRUCTURES AND ALGORITHMS Lecture Notes 10 Prepared by İnanç TAHRALI.
Great Theoretical Ideas in Computer Science for Some.
1 Chapter 11 Global Properties (Distributed Termination)
COMPSCI 102 Introduction to Discrete Mathematics.
Data Structures and Algorithm Analysis Graph Algorithms Lecturer: Jing Liu Homepage:
Honors Track: Competitive Programming & Problem Solving 2-Satisfiability José Kuiper.
Basic concepts of Model Checking
CSE 373 Topological Sort Graph Traversals
Preview Warm Up California Standards Lesson Presentation.
The Echo Algorithm The echo algorithm can be used to collect and disperse information in a distributed system It was originally designed for learning network.
CSC317 Graph algorithms Why bother?
Depth-First Search.
More Graph Algorithms.
Outline Altering flow of control Boolean expressions
Graphs & Graph Algorithms 2
Graphs Chapter 13.
"Learning how to learn is life's most important skill. " - Tony Buzan
Automatic Verification of Industrial Designs
Topological Sort CSE 373 Data Structures Lecture 19.
Example 1: Finding Solutions of Equations with Two Variables
Connected Components, Directed Graphs, Topological Sort
Minimum Spanning Tree Algorithms
Interval Partitioning of a Flow Graph
Chapter 14 Graphs © 2006 Pearson Addison-Wesley. All rights reserved.
Graph Algorithms "A charlatan makes obscure what is clear; a thinker makes clear what is obscure. " - Hugh Kingsmill CLRS, Sections 22.2 – 22.4.
Discrete Mathematics for Computer Science
Some Graph Algorithms.
Chapter 14 Graphs © 2011 Pearson Addison-Wesley. All rights reserved.
Midterm COM3220 Open book/open notes Tuesday, April 28, 6pm pm
Presentation transcript:

Midterm COM3220 Open book/open notes Tuesday, April 28, 6pm - 7.30 pm 5/21/2019 Midterm/COM 3220

What is the Boolean function represented by this BDD? x1 Question 1: 5 points 1 x2 What is the Boolean function represented by this BDD? Express it in terms of and and or only. x3 x4 x5 x6 1 5/21/2019 Midterm/COM 3220

Consider the BDD on the left. It uses the variable ordering x1 1 Question 2: 15 points Consider the BDD on the left. It uses the variable ordering x1, x2, x3, x4. Construct the BDD for the variable ordering x1, x3, x2, x4. x2 x3 x4 1 5/21/2019 Midterm/COM 3220

(x1 and x2) or (x3 and x4) x1 1 x3 x2 x4 1 1 1 1 1 1 1 5/21/2019 1 x3 x2 x4 1 1 1 1 1 1 1 5/21/2019 Midterm/COM 3220

(x1 and x2) or (x3 and x4) x1 1 After ELIMINATION x3 x2 x4 1 1 1 1 1 1 1 After ELIMINATION x3 x2 x4 1 1 1 1 1 1 1 5/21/2019 Midterm/COM 3220

(x1 and x2) or (x3 and x4) x1 1 After ELIMINATION x3 x2 x4 1 1 1 1 1 1 1 After ELIMINATION x3 x2 x4 1 1 1 1 1 1 1 5/21/2019 Midterm/COM 3220

(x1 and x2) or (x3 and x4) x1 1 After ELIMINATION x3 x2 x4 1 1 1 1 1 1 After ELIMINATION x3 x2 x4 1 1 1 1 1 5/21/2019 Midterm/COM 3220

(x1 and x2) or (x3 and x4) x1 1 After MERGING and ELIMINATION x3 x2 x4 1 After MERGING and ELIMINATION x3 x2 x4 1 1 1 1 5/21/2019 Midterm/COM 3220

(x1 and x2) or (x3 and x4) x1 1 After MERGING and ELIMINATION x3 x2 x4 1 After MERGING and ELIMINATION x3 x2 x4 1 1 1 5/21/2019 Midterm/COM 3220

(x1 and x2) or (x3 and x4) x1 1 After TERMINAL x3 x2 x4 1 5/21/2019 1 After TERMINAL x3 x2 x4 1 5/21/2019 Midterm/COM 3220

Consider the BDD on the left. It uses the variable ordering x1 1 Question 2: 15 points Consider the BDD on the left. It uses the variable ordering x1, x2, x3, x4. Construct the BDD for the variable ordering x1, x3, x2, x4. x2 x3 x4 Compare with x1,x2,x3,x4 ordering: 4 versus 6 interior nodes 1 5/21/2019 Midterm/COM 3220

x1 1 x2 x3 Question 3: 10 points The BDD to the left is 1 x2 x3 Question 3: 10 points The BDD to the left is not reduced. Bring it to reduced form. 1 1 1 1 5/21/2019 Midterm/COM 3220

x1 After ELIMINATION 1 x2 x3 1 1 1 1 5/21/2019 Midterm/COM 3220

x1 Prepare for MERGING 1 x2 x3 1 1 1 1 5/21/2019 Midterm/COM 3220

x1 After MERGING 1 x2 x3 1 1 1 5/21/2019 Midterm/COM 3220

x1 Prepare for MERGING 1 x2 x3 1 1 1 5/21/2019 Midterm/COM 3220

x1 After MERGING 1 x2 x3 1 1 5/21/2019 Midterm/COM 3220

x1 After ELIMINATION and TERMINAL 1 x2 x3 1 5/21/2019 Midterm/COM 3220

Which of the following formulas hold? Explain! In state A: AF b Question 4: 15 points Which of the following formulas hold? Explain! In state A: AF b In state A: AF i In state A: AF d A a C b B c E F D G g e f d h i H I 5/21/2019 Midterm/COM 3220

Which of the following formulas hold? Explain! In state A: AF b : TRUE Question 4: 15 points Which of the following formulas hold? Explain! In state A: AF b : TRUE In state A: AF i In state A: AF d A a C b B c E F D G g e f d h i H I 5/21/2019 Midterm/COM 3220

Which of the following formulas holds Explain! In state A: AF b Question 4: 15 points Which of the following formulas holds Explain! In state A: AF b In state A: AF i : FALSE In state A: AF d A a C b B c E F D G g e f d h i H I 5/21/2019 Midterm/COM 3220

Which of the following formulas hold? Explain! In state A: AF b Question 4: 15 points Which of the following formulas hold? Explain! In state A: AF b In state A: AF i In state A: AF d : FALSE A a C b B c E F D G g e f d h i H I 5/21/2019 Midterm/COM 3220

Some background The following questions involve a scope which is the extent of a program’s execution over which a formula must hold. There are five basic kinds of scopes: global, before, after, between, after-until. 5/21/2019 Midterm/COM 3220

Some background scope global (the entire program execution), before (the execution up to a given state), after (the execution after a given state) between (any part of the execution from one given state to another given state) after-until (like between even if the second state does not occur) 5/21/2019 Midterm/COM 3220

Some background A scope itself should be interpreted as optional; if the scope delimiters are not present in an execution then the specification will be true. 5/21/2019 Midterm/COM 3220

Global Before Q After Q Between Q and R State Sequence Q R Q Q R Four Formula Scopes 5/21/2019 Midterm/COM 3220

Question 5: Absence 2 points per unknown The purpose of the following CTL formulas is to describe a portion of a system’s execution that is free of certain states. In the following you will have to find unknowns Y1, Y2, … Those unknowns you should replace by identifiers and/or symbols to make the formula correct. Example: Y1 + 3 = 8. Solution: Y1 = 5 5/21/2019 Midterm/COM 3220

CTL formulas for Absence P is false Globally: Y1 Y2(!P) Before R: A[!Y3 U (Y4 or AG(!R))] After Q: Y5 G(Q Y6 AG(!P)) Between Q and R: Y7 G(Q=>A[!P U (Y8 or Y9 Y10 (!R))]) The next intentionally does not contain unknowns After Q until R: AG(Q=>!E[!R U (P and !R)]) 5/21/2019 Midterm/COM 3220

CTL formulas for Absence P is false Globally: Y1 Y2(!P) AG(!P) Before R: A[!Y3 U (Y4 or AG(!R))] After Q: Y5 G(Q Y6 AG(!P)) Between Q and R: Y7 G(Q=>A[!P U (Y8 or Y9 Y10 (!R))]) The next intentionally does not contain unknowns After Q until R: AG(Q=>!E[!R U (P and !R)]) 5/21/2019 Midterm/COM 3220

CTL formulas for Absence P is false Before R: A[!Y3 U (Y4 or AG(!R))] Before R: A[!P U (R or AG(!R))] P is false until R holds or until R will never hold 5/21/2019 Midterm/COM 3220

CTL formulas for Absence P is false After Q: Y5 G(Q Y6 AG(!P)) After Q: A G(Q => AG(!P)) For all paths the following condition holds at every state: If Q holds at a state then for all paths from that state !P holds globally. 5/21/2019 Midterm/COM 3220

CTL formulas for Absence P is false Between Q and R: Y7 G(Q=>A[!P U (Y8 or Y9 Y10 (!R))]) Between Q and R: A G(Q=>A[!P U (R or A G (!R))]) Globally, if Q holds at a state s then P is false until R holds or R is false globally from s. 5/21/2019 Midterm/COM 3220

Question 6: Response 5 points per unknown The purpose of the following CTL formulas is to describe cause-effect relationships between a pair of states. An occurrence of the first, the cause, must be followed by an occurrence of the second, the effect, within a defined portion of a system’s execution. Find the three UNKNOWNs 5/21/2019 Midterm/COM 3220

CTL formulas for Response S responds to P: (P is the cause, S the effect) UNKNOWN2 Q: AG(Q=>AG(P=>AF(S))) UNKNOWN1: AG(P=>AF(S)) UNKNOWN3 R: A[(P=>A[!R U ((S and !R) or AG(!R))]) U (R or AG(!R))] Note: the three UNKNOWN are part of the explanation of the CTL formula. Each unknown is one word. Explain the formula for UNKNOWN3. 5/21/2019 Midterm/COM 3220

CTL formulas for Response S responds to P: (P is the cause, S the effect) UNKNOWN2 Q: AG(Q=>AG(P=>AF(S))) AFTER Q: AG(Q=>AG(P=>AF(S))) : Globally, if Q holds, then if P holds, eventually S will hold. UNKNOWN1: AG(P=>AF(S)) UNKNOWN3 R: A[(P=>A[!R U ((S and !R) or AG(!R))]) U (R or AG(!R))] 5/21/2019 Midterm/COM 3220

CTL formulas for Response S responds to P: (P is the cause, S the effect) UNKNOWN2 Q: AG(Q=>AG(P=>AF(S))) UNKNOWN1 : AG(P=>AF(S)) GLOBALLY : AG(P=>AF(S)): Globally, if P holds then S will eventually hold. 5/21/2019 Midterm/COM 3220

CTL formulas for Response S responds to P: (P is the cause, S the effect) UNKNOWN3 R: A[(P=>A[!R U ((S and !R) or AG(!R))]) U (R or AG(!R))] BEFORE R: … Amazing how complex it is to express BEFORE. Until R holds or R never holds, if P holds then for all paths until (S and !R) holds or R never holds not R holds. 5/21/2019 Midterm/COM 3220

Question 7: Properties of assignment /10 points Assume that the property {q*y+x=a} holds before we execute the two assignment statements: x:=x-y; q:=q+1; Does the property still hold after execution of the two assignment statements? Explain your answer. Solution: Substitute: (q+1)y+x-y=qy+x. Therefore, qy+x=a still holds. 5/21/2019 Midterm/COM 3220

Question 8: Blackbox Testing: Topological Sorting Assume you have to test a program written for the following specification: Given a directed acyclic graph G=(V,E) with n vertices, label the vertices from 1 to n such that, if v is labeled k, then all vertices that can be reached from v by a directed path are labeled with labels >k. 5/21/2019 Midterm/COM 3220

What to do. Write test requirements and test specifications for this testing task. 30 points Outline an algorithm for implementing the specification. Any implications on your test requirements? 10 points 5/21/2019 Midterm/COM 3220

Test requirements Graph has zero vertices Graph has one vertex Graph has >1 vertices Graph has zero edges Graph has one edge Graph has >1 edges 5/21/2019 Midterm/COM 3220

Test requirements Graph has a cycle: expect error Graph is not connected 5/21/2019 Midterm/COM 3220

Algorithm Compute number of predecessors of each vertex. While there is a node with 0 predecessors put such a node into topological order and delete node and all outgoing edges. Update predecessor counts. If there are nodes left in the graph, there must be a cycle. 5/21/2019 Midterm/COM 3220

Test specifications Empty graph => output: empty graph 1 1 2 1 2 3 5/21/2019 Midterm/COM 3220

Test specifications Error: graph cyclic 5/21/2019 Midterm/COM 3220

Test specifications 1 4 3 6 2 5 Other solutions possible 1 2 3 4 5/21/2019 Midterm/COM 3220

Testing whether topological i < j: test whether there is a path from i to j. Use Warshall’s algorithm with adjacency matrix representation: for y:=1 to V do for x:=1 to V do if a[x,y] then for j:=1 to V do if a[y,j] then a[x,j]:= true; 5/21/2019 Midterm/COM 3220