240 likes | 257 Views
Learn formal logic in CS, prove computer program behavior, termination, correctness, safety. Topics include recursion, induction, program verification. Understand logical reasoning for system design. Prerequisites: CS 172.
E N D
Introduction to CS 270Math Foundations of CS Verification of Computer Systems Mark Boady and Jeremy Johnson Drexel University
Course Description • Introduces formal logic and its connections to Computer Science. Students learn to translate statements about the behavior of computer programs into logical claims and to prove such assertions both by hand and using automated tools. Considers approaches to proving termination, correctness, and safety for programs. Discusses propositional and predicate logic, logical inference, recursion and recursively defined sets, mathematical induction, and structural induction.
Course Goals • For students to learn how to formally specify and reason about properties of computer systems. To appreciate what it means to prove something and the value of formalism. To become aware of tools for formal specification and automatic deduction. To use logical thinking to become better programmers and systems designers.
Course Objectives • To use recursion and divide and conquer to solve problems • To provide recursive definitions of patterns and data structures • To formally specify the input/output requirements of programs • To use induction and other proof techniques to prove properties of algorithms, data structures, programs, and computer systems • To use logic to describe the state of systems and to use logical deduction (by hand and using tools) to prove properties of systems • To understand the power and limitations of formal logic.
Course Topics • Propositional and Predicate Logic • Formal Proof using Natural Deduction • Applications of Logic to Computer Science • Functional Programming • Recursion, Recursive Definitions and Induction • Program Specification and Verification • Termination Analysis • Test Case and Counter Example Generation • Automated Reasoning
Course Lectures • Week 1 [Functional programming and recursion] • Course Introduction (formal specification and reasoning and computer verification) • Functional programming in Scheme (DrRacket) • Recursion and List Processing • Week 2 [Recursion and Induction] • Recursive algorithms and recurrence relations • Informal introduction to induction • Week 3 [Propositional Logic] • Boolean functions and Boolean expressions, syntax and semantics • Boolean algebra and simplification, logic circuits
Course Lectures • Week 4 [Natural Deduction] • Derivations and formal proofs (LogicLab) • Indirect Proofs • Week 5 [Elementary Metamathematics] • Proof tactics, strategies and derived rules (LogicLab) • Normal forms, Soundness and Completeness • Tautology prover • Week 6 [Predicate Logic] • Syntax and semantics • Comparison to propositional calculus • Formal specifications
Course Lectures • Week 7 [Satisfiability and SAT Solvers] • Reduction to satisfiability (MiniSAT) • DPLL algorithm for satisfiability • Week 8 [Structural Induction] • Induction principle and inductive proofs • Proofs about recursive algorithms and data structures (lists, trees, expressions) • Week 9 [Equational reasoning and termination] • Rewrite rules, focus and context, and axioms (J-Bob) • Definitional axiom and termination (J-Bob) • Week 10 [Induction and reasoning about recursive programs] • Inductive proofs about lists (J-Bob) • Inductive proofs about expression trees (J-Bob)
Textbook • Logic & Proof (CMU OLI)
Textbook • Little Schemer & Little Prover
Prerequisites and Grading • Programming skills (CS 172) • Course Requirements and Grading • In class labs (10%) • Weekly homework assignments (40%) • Midterms (25%) and Final (25%) exam • Midterms tentatively week 6 (online) • Final exam during finals week
Getting Help • Office Hours • Jeremy Johnson [W10-12,F 1-3], Mark Boady [T 1-2, W 4-5, R 2-4], • Yashwanth Dahanayake [], Cameron Graybill [], Kretevaska Klimentina [], Cody Moser [], Guruansh Singh [] • www.cs.drexel.edu/clc • Piazza • piazza.com/drexel/fall2015/cs270/home
Class Logistics • Announcements will be posted in piazza • Use Piazza to ask questions • The course staff will regularly monitor and reply to questions in a timely manner • Assignments will be due by 9am on Tuesdays • Late assignments will not be accepted except for extenuating circumstances. In such situations students must get permission from their instructor
Software Bugs • In 1980, NORAD reported that the US was under missile attack. The problem was caused by a faulty circuit, a possibility the reporting software hadn’t taken into account. • The Therac-25 medical radiation therapy device was involved in several cases where massive overdoses of radiation were administered to patients in 1985-87, a side effect of the buggy software powering the device. • In 1996, a European Ariane 5 rocket was set to deliver a payload of satellites into Earth orbit, but problems with the software caused the launch rocket to veer off its path a mere 37 seconds after launch.
Software Bugs • In 1994 in Scotland, a Chinook helicopter crashed and killed all 29 passengers. While initially the pilot was blamed for the crash, that decision was later overturned since there was evidence that a systems error had been the actual cause. • One of the subcontractors NASA used when building its Mars climate orbiter had used English units instead of the intended metric system, which caused the orbiter’s thrusters to work incorrectly. Due to this bug, the orbiter crashed almost immediately when it arrived at Mars in 1999. The cost of the project was $327 million, not to mention the lost time (it took almost a year for the orbiter to reach Mars). • In 2002 NIST estimated that programming errors cost the US economy $60B annually
Hardware Bug • Intel FDIV Bug • Intel P5 Pentium floating point unit • $500M • Error as high as the fourth significant digit of a decimal number, but the possibilities of this happening are 1 in 360 billion. • Approximately 8000 bugs introduced in during design of Pentium 4.
Verification and Validation • Verification and Validation is the process of checking that a SW/HW system meets specifications and fulfills its intended purpose
Empirical Testing • Traditionally, errors in hardware and software have been detected empirically by testing • Number of possibilities too large so only a small subset can be tested • E.G. Testing arithmetic operations on all 264 double precision floating point numbers is infeasible
Formal Methods • In the context of hardware and software systems, formal verification is the act of proving or disproving the correctness of intended algorithms underlying a system with respect to a certain formal specification or property, using formal methods of mathematics
Success Stories • Verified the cache coherence protocol in the IEEE Futurebus+ Standard • Analysis of Microsoft Windows device drivers using SLAM • Non-overflow proof for Airbus A380 flight control software • Verification of Pentium 4 floating-point unit with a mixture of STE and theorem proving • NICTA’s embedded L4 microkernel • Compcert compiler