really naturally linear indexed type checking
play

Really Naturally Linear Indexed Type Checking Arthur Azevedo de - PowerPoint PPT Presentation

Really Naturally Linear Indexed Type Checking Arthur Azevedo de Amorim 1 , Marco Gaboardi 2 , us Gallego Arias 1 , Justin Hsu 1 Emilio Jes 1 University of Pennsylvania 2 University of Dundee October 2, 2014 In the beginning... In the


  1. Really Naturally Linear Indexed Type Checking Arthur Azevedo de Amorim 1 , Marco Gaboardi 2 , us Gallego Arias 1 , Justin Hsu 1 Emilio Jes´ 1 University of Pennsylvania 2 University of Dundee October 2, 2014

  2. In the beginning...

  3. In the beginning...

  4. In the beginning... Check properties via types • Type safety • Parametricity • Non-interference

  5. More recently Properties model quantitative information Numerical robustness how robust? • Probabilistic assertions • how likely? Differential privacy • how private?

  6. More recently Properties model quantitative information Numerical robustness how robust? • Probabilistic assertions • how likely? Differential privacy • how private?

  7. More recently Properties model quantitative information Numerical robustness how robust? • Probabilistic assertions • how likely? Differential privacy • how private?

  8. More recently Properties model quantitative information Numerical robustness how robust? • Probabilistic assertions • how likely? Differential privacy • how private?

  9. More recently Properties model quantitative information Numerical robustness how robust? • Probabilistic assertions • how likely? Differential privacy • how private? Properties not just true or false

  10. But what about typechecking? Typechecking quantitative languages is tricky • May need to solve numeric constraints • Typechecking may not be decidable • May need heuristics to make typechecking practical

  11. But what about typechecking? Typechecking quantitative languages is tricky • May need to solve numeric constraints • Typechecking may not be decidable • May need heuristics to make typechecking practical Our goal • Design and implement a typechecking algorithm for DFuzz, a language for verifying differential privacy

  12. The plan today • A DFuzz crash course • The problem with standard approaches • Modifying the DFuzz language to ease typechecking • Decidability and heuristics

  13. The quantitative property Differential privacy [DMNS06] • Rigorous definition of privacy for randomized programs • Idea: random noise should “conceal” an individual’s data • Quantitative: measure how private a program is • Close connection to sensitivity analysis

  14. Sensitivity analysis R -sensitive function

  15. Sensitivity analysis R -sensitive function f

  16. Sensitivity analysis R -sensitive function f

  17. Sensitivity analysis R -sensitive function f

  18. Sensitivity analysis R -sensitive function f d

  19. Sensitivity analysis R -sensitive function f < R d d

  20. A language for differential privacy DFuzz [GHHNP13] • Type system for differentially private programs • Use linear logic to model sensitivity • Combine with (lightweight) dependent types

  21. In a little more detail... Types τ ::= N [ R ] | τ ⊕ τ | τ ⊗ τ | ! R τ ⊸ τ | ∀ i . τ

  22. In a little more detail... Types τ ::= N [ R ] | τ ⊕ τ | τ ⊗ τ | ! R τ ⊸ τ | ∀ i . τ Contexts Γ ::= · | Γ , x : [ R ] τ

  23. In a little more detail... Types τ ::= N [ R ] | τ ⊕ τ | τ ⊗ τ | ! R τ ⊸ τ | ∀ i . τ Contexts Γ ::= · | Γ , x : [ R ] τ Typing judgment Γ ⊢ e : τ

  24. Reading the types Sensitivity reading • Functions ! R τ 1 ⊸ τ 2 : R -sensitive functions • Changing input by d changes output by at most R · d

  25. Sensitivity analysis R -sensitive function f < R d d

  26. Reading the types Sensitivity reading • Functions ! R τ 1 ⊸ τ 2 : R -sensitive functions • Changing input by d changes output by at most R · d

  27. Reading the types Sensitivity reading • Functions ! R τ 1 ⊸ τ 2 : R -sensitive functions • Changing input by d changes output by at most R · d Subtyping • “A 1-sensitive function is also a 2-sensitive function” • Subtyping: weaken sensitivity bound ! R τ ⊸ τ 2 ⊑ ! R ′ τ 1 ⊸ τ 2 if R ≤ R ′ compare polynomials

  28. In a little more detail... Types τ ::= N [ R ] | τ ⊕ τ | τ ⊗ τ | ! R τ ⊸ τ | ∀ i . τ Contexts Γ ::= · | Γ , x : [ R ] τ Typing judgment Γ ⊢ e : τ

  29. In a little more detail... Types τ ::= N [ R ] | τ ⊕ τ | τ ⊗ τ | ! R τ ⊸ τ | ∀ i . τ Contexts Γ ::= · | Γ , x : [ R ] τ Typing judgment Γ ⊢ e : τ

  30. The sensitivity language Grammar R ::= i R | i N | R | R + R | R · R variables over real/naturals

  31. The sensitivity language Grammar R ::= i R | i N | R | R + R | R · R variables over real/naturals

  32. The sensitivity language Grammar R ::= i R | i N | R | R + R | R · R variables over real/naturals Sensitivity not known statically • DFuzz is dependent! • Sensitivity may depend on inputs (length of list, number of iterations, etc.)

  33. In a little more detail... Types τ ::= N [ R ] | τ ⊕ τ | τ ⊗ τ | ! R τ ⊸ τ | ∀ i . τ Contexts Γ ::= · | Γ , x : [ R ] τ Typing judgment Γ ⊢ e : τ

  34. The sensitivity language Grammar R ::= i R | i N | R | R + R | R · R variables over real/naturals Sensitivity not known statically • DFuzz is dependent! • Sensitivity may depend on inputs (length of list, number of iterations, etc.)

  35. The sensitivity language Grammar R ::= i R | i N | R | R + R | R · R variables over real/naturals Sensitivity not known statically • DFuzz is dependent! • Sensitivity may depend on inputs (length of list, number of iterations, etc.) What does this mean for typechecking? • Sensitivities are polynomials over reals and naturals • How to check subtyping?

  36. Reading the types Sensitivity reading • Functions ! R τ 1 ⊸ τ 2 : R -sensitive functions • Changing input by d changes output by at most R · d Subtyping • “A 1-sensitive function is also a 2-sensitive function” • Subtyping: weaken sensitivity bound ! R τ ⊸ τ 2 ⊑ ! R ′ τ 1 ⊸ τ 2 if R ≤ R ′ compare polynomials

  37. Reading the types Sensitivity reading • Functions ! R τ 1 ⊸ τ 2 : R -sensitive functions • Changing input by d changes output by at most R · d Subtyping • “A 1-sensitive function is also a 2-sensitive function” • Subtyping: weaken sensitivity bound ! R τ ⊸ τ 2 ⊑ ! R ′ τ 1 ⊸ τ 2 if R ≤ R ′ compare polynomials

  38. The typechecking problem type without sensitivities Assume • Can extract type skeleton from term • Given annotated term, compute best type w.r.t. subtyping

  39. The typechecking problem type without sensitivities Assume • Can extract type skeleton from term • Given annotated term, compute best type w.r.t. subtyping

  40. The typechecking problem type without sensitivities Assume • Can extract type skeleton from term • Given annotated term, compute best type w.r.t. subtyping

  41. The typechecking problem type without sensitivities Assume • Can extract type skeleton from term • Given annotated term, compute best type w.r.t. subtyping

  42. The typechecking problem type without sensitivities Assume • Can extract type skeleton from term • Given annotated term, compute best type w.r.t. subtyping

  43. The typechecking problem type without sensitivities Assume • Can extract type skeleton from term • Given annotated term, compute best type w.r.t. subtyping Annotations • We need: fully annotated argument types of all functions ! ?? τ 1 ⊸ τ 2 no annot. no annot. annot.

  44. The typechecking problem type without sensitivities Assume • Can extract type skeleton from term • Given annotated term, compute best type w.r.t. subtyping Annotations • We need: fully annotated argument types of all functions ! ?? τ 1 ⊸ τ 2 no annot. no annot. annot.

  45. The typechecking problem type without sensitivities Assume • Can extract type skeleton from term • Given annotated term, compute best type w.r.t. subtyping Annotations • We need: fully annotated argument types of all functions ! ?? τ 1 ⊸ τ 2 no annot. no annot. annot.

  46. The typechecking problem type without sensitivities Assume • Can extract type skeleton from term • Given annotated term, compute best type w.r.t. subtyping Annotations • We need: fully annotated argument types of all functions ! ?? τ 1 ⊸ τ 2 no annot. no annot. annot.

  47. The typechecking problem type without sensitivities Assume • Can extract type skeleton from term • Given annotated term, compute best type w.r.t. subtyping Annotations • We need: fully annotated argument types of all functions ! ?? τ 1 ⊸ τ 2 no annot. no annot. annot. • Other more minor annotations

  48. The typechecking problem Input • Annotated term e • Annotated context skeleton Γ • : x : ?? τ annot. no annot.

  49. The typechecking problem Input • Annotated term e • Annotated context skeleton Γ • : x : ?? τ annot. no annot.

  50. The typechecking problem Input • Annotated term e • Annotated context skeleton Γ • : x : ?? τ annot. no annot.

  51. The typechecking problem Input • Annotated term e • Annotated context skeleton Γ • : x : ?? τ annot. no annot. Output • Type τ ∗ and context Γ with Γ ⊢ e : τ ∗ • Most precise context and type (with respect to subtyping)

Recommend


More recommend