type checking linear dependent types
play

Type-checking Linear Dependent Types Arthur Azevedo de Amorim 1 2 - PowerPoint PPT Presentation

Type-checking Linear Dependent Types Arthur Azevedo de Amorim 1 2 Marco Gaboardi 3 Emilio Jess Gallego Arias 1 Justin Hsu 1 1 University of Pennsylvania 2 INRIA Paris-Rocquencourt 3 University of Dundee 1 2 2 2 Anonymization Movie Ratings


  1. Type-checking Linear Dependent Types Arthur Azevedo de Amorim 1 2 Marco Gaboardi 3 Emilio Jesús Gallego Arias 1 Justin Hsu 1 1 University of Pennsylvania 2 INRIA Paris-Rocquencourt 3 University of Dundee 1

  2. 2

  3. 2

  4. 2

  5. Anonymization Movie Ratings Internet 2

  6. 2

  7. 2

  8. How to allow database queries and retain privacy guarantees? 3

  9. Differential Privacy • Rigorous bound on “privacy loss” [Dwork, 2006] • Informally: adding one’s data doesn’t change query results by much • Many available algorithms • Statistical analyses, combinatorial optimizations, machine learning, ... 4

  10. Ensuring Differential Privacy Random Noise + Differentially Private Deterministic Query Probabilistic Query 5

  11. Ensuring Differential Privacy Random Noise ∝ k k -sensitive + Differentially Private Deterministic Query Probabilistic Query 5

  12. Ensuring Differential Privacy Bound on result variation Random Noise ∝ k k -sensitive + Differentially Private Deterministic Query Probabilistic Query 5

  13. Ensuring Differential Privacy Bound on result variation Random Noise ∝ k k -sensitive + Differentially Private Deterministic Query Probabilistic Query Requires tedious proofs 5

  14. Types to the Rescue • DFuzz [Reed&Pierce10,Gaboardi13] is a type system for function sensitivity (hence, differential privacy) • Capable of expressing many differentially private algorithms • Metatheory ensures differential privacy • Type-checking algorithm: proof automation 6

  15. Challenge: Checking and Inference The DFuzz type system combines interesting features: • Linear indexed types • Dependent types • Subtyping Their interplay makes it difficult to reuse existing techniques directly 7

  16. Our Contributions • A type-checking and type-inference algorithm for a system combining linear and dependent types in the presence of subtyping • Showing how ideas from the type-checking literature for those domains can be adapted to a type system built around a special-purpose index language 8

  17. Outline • DFuzz and function sensitivity • Type checking and inference for DFuzz 9

  18. DFuzz and Function Sensitivity 10

  19. Function Sensitivity Bound output variation based on input variation f is k -sensitive: d ( f ( x ) , f ( y )) ≤ k · d ( x , y ) 11

  20. Function Sensitivity Bound output variation based on input variation f is k -sensitive: d ( f ( x ) , f ( y )) ≤ k · d ( x , y ) Distance functions 11

  21. Function Sensitivity f f ( x ) x D ≤ k · D y f ( y ) f 11

  22. DFuzz in a Nutshell • ! k σ ⊸ τ : k -sensitive function (= linear) 12

  23. DFuzz in a Nutshell • ! k σ ⊸ τ : k -sensitive function (= linear) Multivariate polynomial 12

  24. DFuzz in a Nutshell • ! k σ ⊸ τ : k -sensitive function (= linear) • list n σ : list of length n (mechanisms that depend on input size) 12

  25. DFuzz in a Nutshell • ! k σ ⊸ τ : k -sensitive function (= linear) • list n σ : list of length n (mechanisms that depend on input size) • σ ⊑ τ : sensitivity weakening (e.g. (! 1 σ ⊸ τ ) ⊑ (! 2 σ ⊸ τ ) ) 12

  26. A Basic Example Consider the standard map function function map f l { case l of { | [] => [] | x :: l’ => f x :: map f l’ } } How to bound “distance” between results of two calls? 13

  27. Analyzing Example d ( map ( f ,� x ) , map ( g ,� y )) 14

  28. Analyzing Example d ( map ( f ,� x ) , map ( g ,� y )) k -sensitive 14

  29. Analyzing Example d ( map ( f ,� x ) , map ( g ,� y )) length n 14

  30. Analyzing Example Distance for lists d ( map ( f ,� x ) , map ( g ,� y )) n � = d ( f ( x i ) , g ( y i )) i = 1 14

  31. Analyzing Example d ( map ( f ,� x ) , map ( g ,� y )) n � = d ( f ( x i ) , g ( y i )) Triangle inequality i = 1 n � ≤ [ d ( f ( x i ) , g ( x i )) + d ( g ( x i ) , g ( y i ))] i = 1 14

  32. Analyzing Example d ( map ( f ,� x ) , map ( g ,� y )) n � = d ( f ( x i ) , g ( y i )) i = 1 Max difference n � between f and g ≤ [ d ( f ( x i ) , g ( x i )) + d ( g ( x i ) , g ( y i ))] i = 1 n � ≤ [ d ( f , g ) + k · d ( x i , y i )] i = 1 14

  33. Analyzing Example d ( map ( f ,� x ) , map ( g ,� y )) n � = d ( f ( x i ) , g ( y i )) i = 1 Definition of n � ≤ [ d ( f ( x i ) , g ( x i )) + d ( g ( x i ) , g ( y i ))] sensitivity i = 1 n � ≤ [ d ( f , g ) + k · d ( x i , y i )] i = 1 14

  34. Analyzing Example d ( map ( f ,� x ) , map ( g ,� y )) n � = d ( f ( x i ) , g ( y i )) i = 1 n � ≤ [ d ( f ( x i ) , g ( x i )) + d ( g ( x i ) , g ( y i ))] i = 1 n � ≤ [ d ( f , g ) + k · d ( x i , y i )] i = 1 = n · d ( f , g ) + k · d ( � x ,� y ) 14

  35. Typing Example in DFuzz map : ! n (! k σ ⊸ τ ) ⊸ ! k list n σ ⊸ list n τ 15

  36. Typing Example in DFuzz map : ! n (! k σ ⊸ τ ) ⊸ ! k list n σ ⊸ list n τ Argument sensitivities 15

  37. Some Rules Γ , x : k σ ⊢ e : τ ( ⊸ I ) Γ ⊢ λ x : k σ. e : ! k σ ⊸ τ 16

  38. Some Rules Keep track of sensitivity Γ , x : k σ ⊢ e : τ ( ⊸ I ) Γ ⊢ λ x : k σ. e : ! k σ ⊸ τ 16

  39. Some Rules Γ , x : k σ ⊢ e : τ ( ⊸ I ) Γ ⊢ λ x : k σ. e : ! k σ ⊸ τ Propagate sensitivity to type 16

  40. Some Rules Γ ⊢ e 1 :! k σ ⊸ τ ∆ ⊢ e 2 : σ ( ⊸ E ) Γ + k · ∆ ⊢ e 1 e 2 : τ Context split, combine sensitivities 16

  41. Some Rules Γ ⊢ e 1 :! k σ ⊸ τ ∆ ⊢ e 2 : σ ( ⊸ E ) Γ + k · ∆ ⊢ e 1 e 2 : τ Composition: multiply sensitivities 16

  42. Some Rules ∆ ⊢ e : list n σ Γ ⊢ e nil : τ Γ , h : k σ, t : k list i σ ⊢ e cons : τ ( list E ) Γ + k · ∆ ⊢ case e of [] → e nil | h :: t → e cons : τ 16

  43. Some Rules Assuming n = 0 ∆ ⊢ e : list n σ Γ ⊢ e nil : τ Γ , h : k σ, t : k list i σ ⊢ e cons : τ ( list E ) Γ + k · ∆ ⊢ case e of [] → e nil | h :: t → e cons : τ 16

  44. Some Rules Assuming n = i + 1 ∆ ⊢ e : list n σ Γ ⊢ e nil : τ Γ , h : k σ, t : k list i σ ⊢ e cons : τ ( list E ) Γ + k · ∆ ⊢ case e of [] → e nil | h :: t → e cons : τ 16

  45. Some Rules ∆ ⊢ e : list n σ Γ ⊢ e nil : τ Γ , h : k σ, t : k list i σ ⊢ e cons : τ ( list E ) Γ + k · ∆ ⊢ case e of [] → e nil | h :: t → e cons : τ Track sensitivity on list 16

  46. Type Checking and Inference 17

  47. Plan DFuzz Program 18

  48. Plan DFuzz Program Inference 18

  49. Plan DFuzz Program Inference σ Constraints 18

  50. Plan DFuzz Program Inference σ Constraints Polynomial inequalities from subtyping 18

  51. Plan DFuzz Program Inference σ Constraints Solver 18

  52. Plan DFuzz Program Inference σ Constraints Solver Yes 18

  53. Plan DFuzz Program Inference σ Constraints Solver ⊑ τ ? 18

  54. Plan DFuzz Program Inference σ Constraints Solver ⊑ τ ? Provided by annotation 18

  55. Plan DFuzz Program Inference σ Constraints Solver ⊑ τ ? Yes 18

  56. Important Points • Context splitting imposes a bottom-up strategy: start with leaves, combine sensitivities progressively 19

  57. Important Points • Context splitting imposes a bottom-up strategy: start with leaves, combine sensitivities progressively . . . e 1 . . . e 2 . . . 19

  58. Important Points • Context splitting imposes a bottom-up strategy: start with leaves, combine sensitivities progressively e 1 : σ 1 e 2 : σ 2 . . . e 1 . . . e 2 . . . 19

  59. Important Points • Context splitting imposes a bottom-up strategy: start with leaves, combine sensitivities progressively e 1 : σ 1 e 2 : σ 2 . . . e 1 . . . e 2 . . . : τ 19

  60. Important Points • Context splitting imposes a bottom-up strategy: start with leaves, combine sensitivities progressively • Restrict subtyping to essential places (e.g. application) 19

  61. Important Points • Context splitting imposes a bottom-up strategy: start with leaves, combine sensitivities progressively • Restrict subtyping to essential places (e.g. application) • Assume sensitivities on higher-order types are given 19

  62. Important Points • Context splitting imposes a bottom-up strategy: start with leaves, combine sensitivities progressively • Restrict subtyping to essential places (e.g. application) • Assume sensitivities on higher-order types are given E.g ! _ (! k α ⊸ α ) ⊸ α 19

  63. Problems • Language not rich enough to express minimal sensitivities • E.g. point-wise maximum of two polynomials is not a polynomial • Solution: enrich sensitivity language with new operators 20

  64. Problems • Language not rich enough to express minimal sensitivities • E.g. point-wise maximum of two polynomials is not a polynomial • Solution: enrich sensitivity language with new operators cf. literature on subtyping 20

  65. Problems • Language not rich enough to express minimal sensitivities • E.g. point-wise maximum of two polynomials is not a polynomial • Solution: enrich sensitivity language with new operators • Type checking is undecidable • Can encode equality of integer polynomials (Hilbert’s tenth problem) • Completeness relative to a decider of sensitivity inequalities 20

Recommend


More recommend