Abstract a unified lattice model for static analysis of programs by - - PowerPoint PPT Presentation

abstract
SMART_READER_LITE
LIVE PREVIEW

Abstract a unified lattice model for static analysis of programs by - - PowerPoint PPT Presentation

Abstract a unified lattice model for static analysis of programs by construction or approximation of fixpoints Interpretation Patrick Cousot and Radhia Cousot, 1977 Motivation (for static analysis) Say youve written code that you really


slide-1
SLIDE 1

Abstract Interpretation

a unified lattice model for static analysis of programs by construction or approximation of fixpoints

Patrick Cousot and Radhia Cousot, 1977

slide-2
SLIDE 2

Motivation (for static analysis)

Say you’ve written code that you really don’t want bugs in… ….like the controls for some rocket boots.

slide-3
SLIDE 3

Motivation

You want to reason about

t x Note: These sketches, and the intuition behind them, are from Patrick Cousot’s website!

slide-4
SLIDE 4

Motivation

To make sure you’re safe

t x

slide-5
SLIDE 5

Motivation

….but you can’t analyze code perfectly

Halting Problem

slide-6
SLIDE 6

Motivation

Testing is dangerous…

t x

slide-7
SLIDE 7

Motivation

Luckily you have an ally…

A A N N A A L L Y Y S S I I S S

slide-8
SLIDE 8

Motivation

With the power of… Abstraction! Better safe than sorry!

slide-9
SLIDE 9

History – before this paper

  • Early 70s work in data flow, type systems,

etc

  • As well as mathematical semantics
slide-10
SLIDE 10

This paper

Uses mathematical semantics to give a grand unified theory of static analysis Trivia: Based on authors’ work in interval analysis Initially a 100 page handwritten manuscript submitted to the 4th POPL

slide-11
SLIDE 11

After this paper

  • Rich literature on static analysis in just about any domain you want
  • Further theoretical exploration of AI
  • Future, more computer-aided design.
slide-12
SLIDE 12

Some Definitions

  • A lattice is a partial order < L, ≤ > such that

every two elements have a unique supremum (join) and infimum (meet)

  • A complete lattice has a unique join and meet

for every non-empty subset of L

  • A semi-lattice only has join (or meet)

Order Theory

(from Wikipedia)

slide-13
SLIDE 13

Abstraction Concrete Abstract

α γ

slide-14
SLIDE 14

Properties of α, γ?

  • Concrete

Abstract

α γ

slide-15
SLIDE 15

Examples of Abstractions

  • Sets of Integers
  • (unbounded) Intervals
  • Congruence mod 2
  • One value or Sign
slide-16
SLIDE 16
slide-17
SLIDE 17

Interpretation

How do we actually use this?

Hi I’m a PL Here have this semantics

How do we actually use this?

Wow it’s great tnx

slide-18
SLIDE 18

In this case

  • Flowchart language
  • Context-collecting semantics (cv)
  • Local Interpretation Int(r,cv)
  • Global Interpretation G-Int(cv)
  • cv = G-Int(cv)
  • Least fixed point
  • Iterate G-Int(bot) to solve
slide-19
SLIDE 19

Abstract Interpretation

slide-20
SLIDE 20

Widening

  • So, we’re done, right?
  • No!
  • We could be walking an infinite path
  • Instead – jump! With over-approximations

LFP Bot

slide-21
SLIDE 21
slide-22
SLIDE 22

Widening

slide-23
SLIDE 23

Narrowing

  • We might jump way too far
  • Walk it back!
  • Again, this may be an (infinitely) long walk
slide-24
SLIDE 24

Narrowing

slide-25
SLIDE 25