rank polymorphism viewed as a constraint problem
play

Rank Polymorphism Viewed as a Constraint Problem Justin Slepak - PowerPoint PPT Presentation

Rank Polymorphism Viewed as a Constraint Problem Justin Slepak Panagiotis Manolios Olin Shivers jrslepak@ccs.neu.edu pete@ccs.neu.edu shivers@ccs.neu.edu Northeastern University 1 100 175 0.6 ( [(lo 0) (hi 0) ( 0)] (+ (* hi )


  1. (+ [[1 4] [2 3] [7 8]] [3 5 1]) + : (Arr (Shp) (-> ((Arr (Shp) Int) (Arr (Shp) Int)) (Arr (Shp) Int))) [[1 4] : (Arr (Shp 3 2) Int) [2 3] [7 8]] [3 5 1] : (Arr (Shp 3) Int) (Shp) ⊑ (Shp 3) ⊑ (Shp 3 2) (Arr (Shp 3 2) Int) 71

  2. (+ [[1 4] [2 3] [7 8]] [3 5 1]) [[+ +] : (Arr (Shp 2 3) [+ +] (-> ((Arr (Shp) Int) [+ +]] (Arr (Shp) Int)) (Arr (Shp) Int))) [[1 4] : (Arr (Shp 3 2) Int) [2 3] [7 8]] [[3 3] : (Arr (Shp 3 2) Int) [5 5] [1 1]] (Shp) ⊑ (Shp 3) ⊑ (Shp 3 2) (Arr (Shp 3 2) Int) 72

  3. (+ [[1 4] [2 3] [7 8]] [3 5]) 73

  4. (+ [[1 4] [2 3] [7 8]] [3 5]) [[1 4] : (Arr (Shp 3 2) Int) [2 3] [7 8]] [3 5] : (Arr (Shp 2) Int) 74

  5. (+ [[1 4] [2 3] [7 8]] [3 5]) [[1 4] : (Arr (Shp 3 2) Int) [2 3] [7 8]] [3 5] : (Arr (Shp 2) Int) (Shp 2) ⊑ / (Shp 3 2) 75

  6. (+ [[1 4] [2 3] [7 8]] [3 5]) [[1 4] : (Arr (Shp 3 2) Int) [2 3] [7 8]] [3 5] : (Arr (Shp 2) Int) (Shp 2) ⊑ (Shp 3 2) ⊑ / (Shp 3 2) / (Shp 2) 76

  7. (+ [[1 4] [2 3] [7 8]] [3 5]) [[1 4] : (Arr (Shp 3 2) Int) [2 3] [7 8]] [3 5] : (Arr (Shp 2) Int) (Shp 2) ⊑ (Shp 3 2) ⊑ / (Shp 3 2) / (Shp 2) Ill-typed 77

  8. Constraints for Rank Polymorphism 78

  9. First-order logic 79

  10. First-order logic 8 �

  11. First-order logic Free monoid over 81

  12. First-order logic Free monoid over 82

  13. First-order logic Free monoid over Free monoid over associativity identity 83

  14. First-order logic Free monoid over Free monoid over associativity identity nothing equal unless required 84

  15. First-order logic Free monoid over Free monoid over associativity identity nothing equal unless required 85

  16. 86

  17. 87

  18. 88

  19. Redundant but will be useful later 89

  20. Type checking: Validate index arguments supplied by programmer 9 �

  21. Type checking: Validate index arguments supplied by programmer Cell types? 91

  22. Type checking: Validate index arguments supplied by programmer Cell types? 92

  23. Type checking: Validate index arguments supplied by programmer Cell types? Principal frame? 93

  24. Type checking: Validate index arguments supplied by programmer Cell types? Principal frame? 94

  25. Naïve solution 95

  26. Naïve solution quantifiers for bound index vars • 96

  27. Naïve solution quantifiers for bound index vars • quantifier for principal frame • 97

  28. Naïve solution quantifiers for bound index vars • quantifier for principal frame • quantifiers for prefix/suffix completions • 98

  29. Naïve solution quantifiers for bound index vars • quantifier for principal frame • quantifiers for prefix/suffix completions • 99

  30. Naïve solution quantifiers for bound index vars • quantifier for principal frame • quantifiers for prefix/suffix completions • Write in terms of 1 ��

Recommend


More recommend