mechanizing abstract interpretation
play

Mechanizing Abstract Interpretation Thesis Defense David Darais - PowerPoint PPT Presentation

Mechanizing Abstract Interpretation Thesis Defense David Darais University of Maryland Software Reliability The Usual Story } Program Testing Analysis Compiler Operating System Hardware 3 The Usual Story } Program .


  1. The Plan Spec ̑ α ( γ ([ w , x ]) + γ ([ y , z ])) Step 1: 
 = Check These Calculations α ({ i + j | i ∈ γ ([ w , x ]) Using a Proof Assistant ∧ j ∈ γ ([ y , z ]) }) = α ({ w + y ,…, x + z }) = α ({ w + y }) ⊔ ⋯ ⊔ α ({ x + z }) Step 2: 
 = Algorithm Extract a Certified 
 [ w + y , x + z ] Implementation ≜ ̂ [ w , x ] + [ y , z ]

  2. The Plan Spec ̑ α ( γ ([ w , x ]) + γ ([ y , z ])) Step 1: 
 = Check These Calculations α ({ i + j | i ∈ γ ([ w , x ]) Using a Proof Assistant ∧ j ∈ γ ([ y , z ]) }) = Implementation ✗ α ({ w + y ,…, x + z }) = α ({ w + y }) ⊔ ⋯ ⊔ α ({ x + z }) Step 2: 
 = Algorithm Extract a Certified 
 [ w + y , x + z ] ≜ ̂ [ w , x ] + [ y , z ]

  3. “This looks like an algorithm” 
 “I know how to execute this” (to a human) (to a machine)

  4. 
 
 
 
 “This looks like an algorithm” 
 “I know how to execute this” (to a human) (to a machine) Mathematical 
 Formulas 
 Backed by an Algorithm

  5. 
 
 
 
 “This looks like an algorithm” 
 “I know how to execute this” (to a human) (to a machine) Classical 
 Mathematics 
 Constructive 
 Mathematics

  6. 
 
 
 
 “This looks like an algorithm” 
 “I know how to execute this” (to a human) (to a machine) Classical 
 Mathematics 
 PROBLEM: SOLUTION: how to know 
 explicitly 
 when boundary account for is crossed algorithmic Constructive 
 content Mathematics

  7. Classical Galois Connections α ℘ ( ℤ ) ℤ × ℤ

  8. Constructive Galois Connections η ℤ ℤ × ℤ

  9. Constructive Galois Connections η ℤ ℤ × ℤ defn η ( i ) ≔ [ i , i ] algorithmic 
 content of 
 abstraction

  10. Constructive Galois Connections η ℤ ℤ × ℤ defn η ( i ) ≔ [ i , i ] embedding 
 algorithms law 1 α = ⟨ η ⟩

  11. Constructive Galois Connections η ℤ ℤ × ℤ defn η ( i ) ≔ [ i , i ] singleton powersets law 1 α = ⟨ η ⟩ compute law 2 ⟨ η ⟩ ({ x }) = ⟨ η ( x ) ⟩

  12. ̑ α ( γ ([ w , x ]) + γ ([ y , z ])) = α ({ i + j | i ∈ γ ([ w , x ]) ∧ j ∈ γ ([ y , z ]) }) = α ({ w + y ,…, x + z }) = α ({ w + y }) ⊔ ⋯ ⊔ α ({ x + z }) = [ w + y , x + z ] ≜ ̂ [ w , x ] + [ y , z ]

  13. ̑ α ( γ ([ w , x ]) + γ ([ y , z ]))

  14. ̑ α ( γ ([ w , x ]) + γ ([ y , z ])) law 1 α = ⟨ η ⟩

  15. ̑ α ( γ ([ w , x ]) + γ ([ y , z ]))

  16. ̑ ⟨ η ⟩ ( γ ([ w , x ]) + γ ([ y , z ]))

  17. ̑ ⟨ η ⟩ ( γ ([ w , x ]) + γ ([ y , z ])) = ⟨ η ⟩ ({ i + j | i ∈ γ ([ w , x ]) ∧ j ∈ γ ([ y , z ]) }) = ⟨ η ⟩ ({ w + y ,…, x + z }) = ⟨ η ⟩ ({ w + y }) ⊔ ⋯ ⊔ ⟨ η ⟩ ({ x + z })

  18. ̑ ⟨ η ⟩ ( γ ([ w , x ]) + γ ([ y , z ])) = ⟨ η ⟩ ({ i + j | i ∈ γ ([ w , x ]) ∧ j ∈ γ ([ y , z ]) }) = law 2 ⟨ η ⟩ ({ w + y ,…, x + z }) ⟨ η ⟩ ({ x }) = ⟨ η ( x ) ⟩ = ⟨ η ⟩ ({ w + y }) ⊔ ⋯ ⊔ ⟨ η ⟩ ({ x + z })

  19. ̑ ⟨ η ⟩ ( γ ([ w , x ]) + γ ([ y , z ])) = ⟨ η ⟩ ({ i + j | i ∈ γ ([ w , x ]) ∧ j ∈ γ ([ y , z ]) }) = ⟨ η ⟩ ({ w + y ,…, x + z }) = ⟨ η ⟩ ({ w + y }) ⊔ ⋯ ⊔ ⟨ η ⟩ ({ x + z })

  20. ̑ ⟨ η ⟩ ( γ ([ w , x ]) + γ ([ y , z ])) = ⟨ η ⟩ ({ i + j | i ∈ γ ([ w , x ]) ∧ j ∈ γ ([ y , z ]) }) = ⟨ η ⟩ ({ w + y ,…, x + z }) = ⟨ η ( w + y ) ⟩ ⊔ ⋯ ⊔ ⟨ η ( x + z ) ⟩

  21. ̑ ⟨ η ⟩ ( γ ([ w , x ]) + γ ([ y , z ])) = ⟨ η ⟩ ({ i + j | i ∈ γ ([ w , x ]) ∧ j ∈ γ ([ y , z ]) }) = ⟨ η ⟩ ({ w + y ,…, x + z }) = ⟨ η ( w + y ) ⟩ ⊔ ⋯ ⊔ ⟨ η ( x + z ) ⟩ = ⟨ [ w + y , x + z ] ⟩ ≜ ̂ [ w , x ] + [ y , z ]

  22. The Plan Spec ̑ ⟨ η ⟩ ( γ ([ w , x ]) + γ ([ y , z ])) Step 1: 
 = Check These Calculations ⟨ η ⟩ ({ i + j | i ∈ γ ([ w , x ]) Using a Proof Assistant ∧ j ∈ γ ([ y , z ]) }) = ⟨ η ⟩ ({ w + y ,…, x + z }) = ⟨ η ( w + y ) ⟩ ⊔ ⋯ ⊔ ⟨ η ( x + z ) ⟩ Step 2: 
 = Algorithm Implementation ✓ Extract a Certified 
 ⟨ [ w + y , x + z ] ⟩ ≜ ̂ [ w , x ] + [ y , z ]

  23. calc.agda calc.cousot ‣ ⟬ α [ ⇄ᴿ ⇗ ⇄ᴵ ] α (eval[ n ])( ρ♯ ) ⋅ eval[ Num n ] ⋅ ρ♯ ⟭ ⟅ defn of α ⟆ ‣ ⟬ ηᴵ * ⋅ (eval[ Num n ] * = αᴵ (eval[ n ]( γᴿ ( ρ♯ ))) ⋅ ( μᴿ ⋅ ρ♯ )) ⟭ ⟅ defn of eval[ n ] ⟆ ‣ [focus-right [ ⋅ ] of ηᴵ * ] = αᴵ ({i | ρ ⊢ n ↦ i}) ⟅ defn[eval[ Num n ]] ⟆ ⟅ defn of _ ⊢ _ ↦ _ ⟆ ‣ ⟬ ηᴵ * ⋅ (return ⋅ n ) ⟭ = αᴵ ({ n }) ‣ ⟅ right-unit[*] ⟆ ⟅ defn of eval ♯ [ n ] ⟆ ‣ ⟬ pure ⋅ ( ηᴵ ⋅ n ) ⟭ ≜ eval ♯ [ n ]( ρ♯ ) ‣ ⟬ pure ⋅ eval ♯ [ Num n ] ⋅ ρ♯ ⟭ 67

  24. Classical GCs A : poset α : A ↗ B B : poset γ : B ↗ A x ⊑ γ ( α ( x )) ∧ α ( γ ( y )) ⊑ y =========================== x ⊑ γ ( y ) ⟺ α ( x ) ⊑ y 68

  25. Classical GCs A : poset α : A ↗ B B : poset γ : B ↗ A α∘γ ⊑ id id ⊑ γ∘α ∧ =========================== id( x ) ⊑ γ ( y ) ⟺ α ( x ) ⊑ id( y ) 69

  26. Constructive GCs η : A ↗ ℘ (B) A : poset μ : B ↗ ℘ (A) B : poset ret ⊑ μ⊛η ∧ η⊛μ ⊑ ret =========================== ret( n ) ⊆ μ * ( r ) ⟺ η * ( n ) ⊆ ret( r ) 70

  27. Constructive GCs A : poset η : A ↗ B μ : B ↗ ℘ (A) B : poset ret ⊑ μ⊛ ⟨ η ⟩ ∧ ⟨ η ⟩ ⊛μ ⊑ ret =========================== ret( n ) ⊆ μ * * ( r ) ⟺ ⟨ η ⟩ ( n ) ⊆ ret( r ) 71

  28. Constructive GCs A : poset η : A ↗ B μ : B ↗ ℘ (A) B : poset ret ⊑ μ⊛ ⟨ η ⟩ ∧ ⟨ η ⟩ ⊛μ ⊑ ret =========================== ret( n ) ⊆ μ * * ( r ) ⟺ ⟨ η ⟩ ( n ) ⊆ ret( r ) 72

  29. Constructive GCs A : poset η : A ↗ B μ : B ↗ ℘ (A) B : poset ret ⊑ μ⊛ ⟨ η ⟩ ∧ ⟨ η ⟩ ⊛μ ⊑ ret =========================== ret( n ) ⊆ μ * * ( r ) ⟺ ⟨ η ⟩ ( n ) ⊆ ret( r ) 73

  30. Classical GCs = adjunction in 
 category of posets (adjoints are mono. functions) Constructive GCs = biadjunction in 
 category of posets enriched over ℘ -Kleisli (adjoints are mono. ℘ -monadic functions)

  31. Constructive Galois Connections ✓ First theory to support both calculation and extraction ✓ Soundness and completeness w.r.t. classical GCs ✓ Two case studies: calculational AI and gradual typing ✗ Only (constr.) equivalent to subset of classical GCs ✗ Same limitations as classical GCs ( ∄α for some γ ) 75

  32. Constructive 
 Abstracting 
 Galois Galois 
 Definitional 
 Transformers Connections Interpreters 76

  33. Galois Transformers 0: int x y ; 1: void safe_fun(int N ) { 2: if ( N ≠ 0) { x := 0;} 3: else { x := 1;} 4: if ( N ≠ 0) { y := 100/ N ;} 5: else { y := 100/ x ;}} 77

  34. Galois Transformers 0: int x y ; 1: void safe_fun(int N ) { 2: if ( N ≠ 0) { x := 0;} 3: else { x := 1;} 4: if ( N ≠ 0) { y := 100/ N ;} 5: else { y := 100/ x ;}} Flow-insensitive results : var ↦ ℘ ({-,0,+}) 77

  35. Galois Transformers 0: int x y ; N ∈ {-,0,+} 1: void safe_fun(int N ) { x ∈ {0,+} 2: if ( N ≠ 0) { x := 0;} y ∈ {-,0,+} 
 3: else { x := 1;} 4: if ( N ≠ 0) { y := 100/ N ;} UNSAFE : {100/ N } 
 5: else { y := 100/ x ;}} UNSAFE : {100/ x } Flow-insensitive results : var ↦ ℘ ({-,0,+}) 77

  36. Galois Transformers 4: x ∈ {0,+} 0: int x y ; 4.T: N ∈ {-,+} 1: void safe_fun(int N ) { 5.F: x ∈ {0,+} 2: if ( N ≠ 0) { x := 0;} 3: else { x := 1;} N , y ∈ {-,0,+} 4: if ( N ≠ 0) { y := 100/ N ;} 5: else { y := 100/ x ;}} UNSAFE : {100/ x } Flow-sensitive results : loc ↦ (var ↦ ℘ ({-,0,+})) 78

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend