Download intro - Computer Science

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Software quality wikipedia , lookup

Recursion (computer science) wikipedia , lookup

Logic programming wikipedia , lookup

Corecursion wikipedia , lookup

Transcript
Introduction to CS 270
Math 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.
1
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.
2
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.
3
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
4
Course Lectures

Week 1 [Functional programming and recursion]




Week 2 [Recursion and Induction]



Course Introduction (formal specification and reasoning and computer
verification)
Functional programming in Scheme (DrRacket)
Recursion and List Processing
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
5
Course Lectures

Week 4 [Natural Deduction]



Week 5 [Elementary Metamathematics]




Derivations and formal proofs (LogicLab)
Indirect Proofs
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
6
Course Lectures

Week 7 [Satisfiability and SAT Solvers]



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]



Reduction to satisfiability (MiniSAT)
DPLL algorithm for satisfiability
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)
7
Textbook

Logic & Proof (CMU OLI)
8
Textbook

Little Schemer & Little Prover
Optional – available in CLC
9
Software (LogicLab)
10
Software (MiniSAT)
11
Software (DrRacket)
12
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
13
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
14
Getting Help (piazza)
15
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
16
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.
17
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
18
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.
19
Verification and Validation

Verification and Validation is the process
of checking that a SW/HW system meets
specifications and fulfills its intended
purpose
Features
Tie-Line Flows
PowerG rid
Real Time Analysis
Power System
Vulnerabilities
Real Time Analysis
Power System
Reliability
Excellent Training
Facility for Concerned
Parties
Hardware Power System
Model
Decision Making
Station
Engineering
Analysis Station
Economic Analysis
Station
Ultra-Fast Bus
20
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
21
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
22
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
23