This lecture delves into the key concepts of program semantics, operational semantics, and their significance in the analysis and verification of software. It covers various approaches such as natural operational semantics and structural operational semantics, emphasizing the importance of verifying programs to eliminate bugs. The lecture outlines tools for runtime and design time analysis, including static analysis and formal verification. Examples, such as the verification of assertions within the program, are used to illustrate undecidable problems and techniques for over-approximation in program analysis.
01 / 96Understanding Program Semantics: Analysis and Verification Techniques
1 / 17
Download Presentation
Understanding Program Semantics: Analysis and Verification Techniques
An Image/Link below is provided (as is) to download presentation
Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.Content is provided to you AS IS for your information and personal use only.Download presentation by click this link.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.During download, if you can't get a presentation, the file might be deleted by the publisher.
E N D
More Related Content
Presentation Transcript
Program Analysis and Verification 0368-4479http://www.cs.tau.ac.il/~maon/teaching/2013-2014/paav/paav1314b.html Noam Rinetzky Lecture 2: Program Semantics Slides credit: Roman Manevich, MoolySagiv, EranYahav
Today • What does semantics mean? • Why do we need it? • How is it related to analysis/verification? • Operational semantics • Natural operational semantics • Structural operational semantics
What can we do about it? Run time Design Time • Monitoring • Testing • Static analysis • Formal verification • Specification
What can we do about it? Run time Design Time • Monitoring • Testing • Static analysis • Formal verification • Specification
Program analysis & verification y = ? x = ? if (x > 0) { y = 42; } else { y = 73; foo(); } assert (y == 42); No/?/Yes • Is assertion true?
Program analysis & verification y = ? x = ? x = y * 2 if (x % 2 == 0) { y = 42; } else { y = 73; foo(); } assert (y == 42); Yes/?/No • Can we prove this? Automatically? • Bad news: problem is generally undecidable
“Abstract-state transformer” semantics y = ?; y=T, x=T x = y * 2 if (x % 2 == 0) { y = 42; } else { y = 73; foo(); } assert (y == 42); T T O E O E T T y x (y=E,x=E)={(0,0), (0,2),(-4,10),…}
“Abstract-state transformer” semantics y = ?; y=T, x=T x = y * 2 y=T, x=E if (x % 2 == 0) { y=T, x=E y = 42; y=T, x=E } else { y = 73; … foo(); … } assert (y == 42); y=E, x=E T T O E O E T T y x (y=E,x=E)={(0,0), (0,2),(-4,10),…} Yes/?/No
“Abstract-state transformer” semantics y = ?; y=T, x=T x = y * 2 y=T, x=E if (x % 2 == 0) { y=T, x=E y = 42; y=T, x=E } else { y = 73; … foo(); … } assert (y == 42); y=E, x=E T T O E O E T T y x (y=E,x=E)={(0,0), (0,2),(-4,10),…} Yes/?/No
“Abstract-state transformer” semantics y = ?; y=T, x=T x = y * 2 y=T, x=E if (x % 2 == 0) { y=T, x=E y = 42; y=E, x=E } else { y = 73; … foo(); … } assert (y%2 == 0)y=E, x=E T T O E O E T T y x (y=E,x=E)={(0,0), (0,2),(-4,10),…} ?
What semantics do we want? • Captures the aspects of computations we care about • “adequate” • Hides irrelevant details • “fully abstract” • Compositional
What semantics do we want? • Captures the aspects of computations we care about • “adequate” • Hides irrelevant details • “fully abstract” • Compositional
Formal semantics “Formal semantics is concerned with rigorously specifying the meaning, or behavior, of programs, pieces of hardware, etc.” / page 1
Formal semantics • “This theory allows a program to be manipulated like a formula –that is to say, its properties can be calculated.” • Gérard Huet & Philippe Flajolethomage to Gilles Kahn
Why formal semantics? • Implementation-independent definition of a programming language • Automatically generating interpreters (and some day maybe full fledged compilers) • Verification and debugging • if you don’t know what it does, how do you know its incorrect?