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

rank polymorphism viewed as a constraint problem
SMART_READER_LITE
LIVE PREVIEW

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 )


slide-1
SLIDE 1

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

slide-2
SLIDE 2

100 175 0.6 (λ [(lo 0) (hi 0) (α 0)] (+ (* hi α) (* lo (- 1 α))))

2

slide-3
SLIDE 3

100 175 0.6 ((λ [(lo 0) (hi 0) (α 0)] (+ (* hi α) (* lo (- 1 α)))) 100 175 0.6)

3

slide-4
SLIDE 4

RGB RGB

(λ [(lo 0) (hi 0) (α 0)] (+ (* hi α) (* lo (- 1 α))))

4

slide-5
SLIDE 5

RGB RGB

((λ [(lo 0) (hi 0) (α 0)] (+ (* hi α) (* lo (- 1 α)))) rgb1 ; 3 channels rgb2 ; 3 channels 0.6) ; scalar

5

slide-6
SLIDE 6

Credit: Wikimedia user Sadalsuud

(λ [(lo 0) (hi 0) (α 0)] (+ (* hi α) (* lo (- 1 α))))

6

slide-7
SLIDE 7

Credit: Wikimedia user Sadalsuud

((λ [(lo 0) (hi 0) (α 0)] (+ (* hi α) (* lo (- 1 α)))) sky ; row × col × chan labels ; row × col × chan img-mask) ; row × col × chan

7

slide-8
SLIDE 8

(λ [(lo 0) (hi 0) (α 0)] (+ (* hi α) (* lo (- 1 α))))

8

slide-9
SLIDE 9

((λ [(lo 0) (hi 0) (α 0)] (+ (* hi α) (* lo (- 1 α)))) film ; time × row × col × chan audience ; time × row × col × chan vid-mask) ; time × row × col × chan

9

slide-10
SLIDE 10

Credit: Wikimedia user Thetawave

(λ [(lo 0) (hi 0) (α 0)] (+ (* hi α) (* lo (- 1 α))))

1

slide-11
SLIDE 11

Credit: Wikimedia user Thetawave

((λ [(lo 0) (hi 0) (α 0)] (+ (* hi α) (* lo (- 1 α)))) scene1 ; time × row × col × chan scene2 ; time × row × col × chan [0.0 ... 1.0]) ; time

11

slide-12
SLIDE 12

(λ [(lo 0) (hi 0) (α 0)] (+ (* hi α) (* lo (- 1 α))))

12

slide-13
SLIDE 13

(λ [(lo 0) (hi 0) (α 0)] (+ (* hi α) (* lo (- 1 α)))) Polymorphic in dimensionality

13

slide-14
SLIDE 14

Rank Polymorphic Programming Model

14

slide-15
SLIDE 15

1 0 0 1 1 0 1 0 1 0 1 0 1 1 0 0 1 0 1 1 1

3,7

15

slide-16
SLIDE 16

1 0 0 1 1 0 1 0 1 0 1 0 1 1 0 0 1 0 1 1 1

3,7

0 1 2 3 4 5 6 7

2,2,2

16

slide-17
SLIDE 17

1 0 0 1 1 0 1 0 1 0 1 0 1 1 0 0 1 0 1 1 1

3,7

0 1 2 3 4 5 6 7

2,2,2

  • 17
slide-18
SLIDE 18

1 0 0 1 1 0 1 0 1 0 1 0 1 1 0 0 1 0 1 1 1

3,7

0 1 2 3 4 5 6 7

2,2,2

  • atoms: non-aggregate elements

18

slide-19
SLIDE 19

1 0 0 1 1 0 1 0 1 0 1 0 1 1 0 0 1 0 1 1 1

3,7

0 1 2 3 4 5 6 7

2,2,2

  • atoms: non-aggregate elements

shape: size in each dimension

19

slide-20
SLIDE 20

1 0 0 1 1 0 1 0 1 0 1 0 1 1 0 0 1 0 1 1 1

3,7

2 0 1 2 3 4 5 6 7

2,2,2

3

atoms: non-aggregate elements shape: size in each dimension rank: length of shape i.e., number of dimensions

2

slide-21
SLIDE 21

dot 1 4 2 3

2,2

3 5

2

21

slide-22
SLIDE 22

dot 1 4 2 3

2,2

3 5

2

cell: basic unit function operates on

22

slide-23
SLIDE 23

dot 1 4 2 3

2,2

3 5

2

cell: basic unit function operates on

23

slide-24
SLIDE 24

dot 1 4 2 3

2,2

3 5

2

cell: basic unit function operates on frame: structure around cells

24

slide-25
SLIDE 25

dot 1 4 2 3

2,2

3 5

2

cell: basic unit function operates on frame: structure around cells function applied to each cell

25

slide-26
SLIDE 26

dot 1 4 2 3

2,2

3 5

2

cell: basic unit function operates on frame: structure around cells function applied to each cell results reassembled in frame

26

slide-27
SLIDE 27

Rank n array can split n+1 ways

27

slide-28
SLIDE 28

Rank n array can split n+1 ways 0 1 2 3 1 2 3 4 2 3 4 5

3,4

28

slide-29
SLIDE 29

Rank n array can split n+1 ways 0 1 2 3 1 2 3 4 2 3 4 5

3,4

0 1 2 3 1 2 3 4 2 3 4 5

3,4

29

slide-30
SLIDE 30

Rank n array can split n+1 ways 0 1 2 3 1 2 3 4 2 3 4 5

3,4

0 1 2 3 1 2 3 4 2 3 4 5

3,4

0 1 2 3 1 2 3 4 2 3 4 5

3,4

3

slide-31
SLIDE 31

dot 1 4 2 3

2,2

3 5

2

31

slide-32
SLIDE 32

dot 1 4 2 3

2,2

3 5

2

+ 1 4 2 3

2,2

3 5

2

32

slide-33
SLIDE 33

dot 1 4 2 3

2,2

3 5

2

+ 1 4 2 3

2,2

3 5

2

poly 1 4 2 3

2,2

3 5

2

33

slide-34
SLIDE 34

dot 1 4 2 3

2,2

3 5

2

+ 1 4 2 3

2,2

3 5

2

poly 1 4 2 3

2,2

3 5

2

Principal frame: maximum under prefix ordering

34

slide-35
SLIDE 35

dot 1 4 2 3

2,2

3 5

2

= 23 21

2

+ 1 4 2 3

2,2

3 5

2

= 4 7 7 8

2,2

poly 1 4 2 3

2,2

3 5

2

= 13 17

2

Principal frame: maximum under prefix ordering

35

slide-36
SLIDE 36

Trying different shapes

36

slide-37
SLIDE 37

Trying different shapes dot 1 4 2 3 7 8

3,2

3 5

2

37

slide-38
SLIDE 38

Trying different shapes dot 1 4 2 3 7 8

3,2

3 5

2

+ 1 4 2 3 7 8

3,2

3 5

2

38

slide-39
SLIDE 39

Trying different shapes dot 1 4 2 3 7 8

3,2

3 5

2

+ 1 4 2 3 7 8

3,2

3 5

2

poly 1 4 2 3 7 8

3,2

3 5

2

39

slide-40
SLIDE 40

Trying different shapes dot 1 4 2 3 7 8

3,2

3 5

2

= 23 21 61

3

+ 1 4 2 3 7 8

3,2

3 5

2

poly 1 4 2 3 7 8

3,2

3 5

2

4

slide-41
SLIDE 41

Trying different shapes dot 1 4 2 3 7 8

3,2

3 5

2

= 23 21 61

3

+ 1 4 2 3 7 8

3,2

3 5

2

→ Shape error: no principal frame poly 1 4 2 3 7 8

3,2

3 5

2

41

slide-42
SLIDE 42

Trying different shapes dot 1 4 2 3 7 8

3,2

3 5

2

= 23 21 61

3

+ 1 4 2 3 7 8

3,2

3 5

2

→ Shape error: no principal frame poly 1 4 2 3 7 8

3,2

3 5

2

→ Shape error: no principal frame

42

slide-43
SLIDE 43

Trying different shapes

43

slide-44
SLIDE 44

Trying different shapes dot 1 4 2 3 7 8

3,2

3 5 1

3

44

slide-45
SLIDE 45

Trying different shapes dot 1 4 2 3 7 8

3,2

3 5 1

3

+ 1 4 2 3 7 8

3,2

3 5 1

3

45

slide-46
SLIDE 46

Trying different shapes dot 1 4 2 3 7 8

3,2

3 5 1

3

+ 1 4 2 3 7 8

3,2

3 5 1

3

poly 1 4 2 3 7 8

3,2

3 5 1

3

46

slide-47
SLIDE 47

Trying different shapes dot 1 4 2 3 7 8

3,2

3 5 1

3

→ Domain error: dot requires equal length args + 1 4 2 3 7 8

3,2

3 5 1

3

poly 1 4 2 3 7 8

3,2

3 5 1

3

47

slide-48
SLIDE 48

Trying different shapes dot 1 4 2 3 7 8

3,2

3 5 1

3

→ Domain error: dot requires equal length args + 1 4 2 3 7 8

3,2

3 5 1

3

= 4 7 7 8 8 9

3,2

poly 1 4 2 3 7 8

3,2

3 5 1

3

48

slide-49
SLIDE 49

Trying different shapes dot 1 4 2 3 7 8

3,2

3 5 1

3

→ Domain error: dot requires equal length args + 1 4 2 3 7 8

3,2

3 5 1

3

= 4 7 7 8 8 9

3,2

poly 1 4 2 3 7 8

3,2

3 5 1

3

→ 13 17 15

3

49

slide-50
SLIDE 50

Typing Rank Polymorphic Code

5

slide-51
SLIDE 51

1 0 0 1 1 0 1 0 1 0 1 0 1 1 0 0 1 0 1 1 1

3,7

51

slide-52
SLIDE 52

[[1 0 0 1 1 0 1] [0 1 0 1 0 1 1] [0 0 1 0 1 1 1]]

52

slide-53
SLIDE 53

[[1 0 0 1 1 0 1] [0 1 0 1 0 1 1] [0 0 1 0 1 1 1]] : (Arr (Shp 3 7) Int)

53

slide-54
SLIDE 54

[[1 0 0 1 1 0 1] [0 1 0 1 0 1 1] [0 0 1 0 1 1 1]] : (Arr (Shp 3 7) Int) 0 1 2 3 4 5 6 7

2,2,2

54

slide-55
SLIDE 55

[[1 0 0 1 1 0 1] [0 1 0 1 0 1 1] [0 0 1 0 1 1 1]] : (Arr (Shp 3 7) Int) [[[0 1] [2 3]] [[4 5] [6 7]]]

55

slide-56
SLIDE 56

[[1 0 0 1 1 0 1] [0 1 0 1 0 1 1] [0 0 1 0 1 1 1]] : (Arr (Shp 3 7) Int) [[[0 1] [2 3]] [[4 5] [6 7]]] : (Arr (Shp 2 2 2) Int)

56

slide-57
SLIDE 57

[[1 0 0 1 1 0 1] [0 1 0 1 0 1 1] [0 0 1 0 1 1 1]] : (Arr (Shp 3 7) Int) [[[0 1] [2 3]] [[4 5] [6 7]]] : (Arr (Shp 2 2 2) Int)

  • 57
slide-58
SLIDE 58

[[1 0 0 1 1 0 1] [0 1 0 1 0 1 1] [0 0 1 0 1 1 1]] : (Arr (Shp 3 7) Int) [[[0 1] [2 3]] [[4 5] [6 7]]] : (Arr (Shp 2 2 2) Int)

58

slide-59
SLIDE 59

[[1 0 0 1 1 0 1] [0 1 0 1 0 1 1] [0 0 1 0 1 1 1]] : (Arr (Shp 3 7) Int) [[[0 1] [2 3]] [[4 5] [6 7]]] : (Arr (Shp 2 2 2) Int) 0 : (Arr (Shp) Int)

59

slide-60
SLIDE 60

+ dot poly

6

slide-61
SLIDE 61

+ : (-> ((Arr (Shp) Int) (Arr (Shp) Int)) (Arr (Shp) Int)) dot poly

61

slide-62
SLIDE 62

+ : (-> ((Arr (Shp) Int) (Arr (Shp) Int)) (Arr (Shp) Int)) dot : (Π ((l Dim)) (-> ((Arr (Shp l) Int) (Arr (Shp l) Int)) (Arr (Shp) Int))) poly

62

slide-63
SLIDE 63

+ : (-> ((Arr (Shp) Int) (Arr (Shp) Int)) (Arr (Shp) Int)) dot : (Π ((l Dim)) (-> ((Arr (Shp l) Int) (Arr (Shp l) Int)) (Arr (Shp) Int))) poly : (Π ((l Dim)) (-> ((Arr (Shp l) Int) (Arr (Shp) Int)) (Arr (Shp) Int)))

63

slide-64
SLIDE 64

+ : (-> ((Arr (Shp) Int) (Arr (Shp) Int)) (Arr (Shp) Int)) dot : (Π ((l Dim)) (-> ((Arr (Shp l) Int) (Arr (Shp l) Int)) (Arr (Shp) Int))) poly : (Π ((l Dim)) (-> ((Arr (Shp l) Int) (Arr (Shp) Int)) (Arr (Shp) Int))) append

64

slide-65
SLIDE 65

+ : (-> ((Arr (Shp) Int) (Arr (Shp) Int)) (Arr (Shp) Int)) dot : (Π ((l Dim)) (-> ((Arr (Shp l) Int) (Arr (Shp l) Int)) (Arr (Shp) Int))) poly : (Π ((l Dim)) (-> ((Arr (Shp l) Int) (Arr (Shp) Int)) (Arr (Shp) Int))) append : (∀ ((T Atom)) (Π ((l1 Dim) (l2 Dim) (c Shp)) (-> ((Arr (++ (Shp l1) c) T) (Arr (++ (Shp l2) c) T)) (Arr (++ (Shp (+ l1 l2)) c) T))))

65

slide-66
SLIDE 66

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

66

slide-67
SLIDE 67

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

67

slide-68
SLIDE 68

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

68

slide-69
SLIDE 69

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

69

slide-70
SLIDE 70

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

7

slide-71
SLIDE 71

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

71

slide-72
SLIDE 72

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

72

slide-73
SLIDE 73

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

73

slide-74
SLIDE 74

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

74

slide-75
SLIDE 75

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

75

slide-76
SLIDE 76

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

76

slide-77
SLIDE 77

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

Ill-typed

77

slide-78
SLIDE 78

Constraints for Rank Polymorphism

78

slide-79
SLIDE 79

First-order logic

79

slide-80
SLIDE 80

First-order logic

8

slide-81
SLIDE 81

First-order logic Free monoid over

81

slide-82
SLIDE 82

First-order logic Free monoid over

82

slide-83
SLIDE 83

First-order logic Free monoid over Free monoid over

associativity identity

83

slide-84
SLIDE 84

First-order logic Free monoid over Free monoid over

associativity identity nothing equal unless required

84

slide-85
SLIDE 85

First-order logic Free monoid over Free monoid over

associativity identity nothing equal unless required

85

slide-86
SLIDE 86

86

slide-87
SLIDE 87

87

slide-88
SLIDE 88

88

slide-89
SLIDE 89

Redundant but will be useful later

89

slide-90
SLIDE 90

Type checking:

Validate index arguments supplied by programmer

9

slide-91
SLIDE 91

Type checking:

Validate index arguments supplied by programmer Cell types?

91

slide-92
SLIDE 92

Type checking:

Validate index arguments supplied by programmer Cell types?

92

slide-93
SLIDE 93

Type checking:

Validate index arguments supplied by programmer Cell types? Principal frame?

93

slide-94
SLIDE 94

Type checking:

Validate index arguments supplied by programmer Cell types? Principal frame?

94

slide-95
SLIDE 95

Naïve solution

95

slide-96
SLIDE 96

Naïve solution

  • quantifiers for bound index vars

96

slide-97
SLIDE 97

Naïve solution

  • quantifiers for bound index vars
  • quantifier for principal frame

97

slide-98
SLIDE 98

Naïve solution

  • quantifiers for bound index vars
  • quantifier for principal frame
  • quantifiers for prefix/suffix completions

98

slide-99
SLIDE 99

Naïve solution

  • quantifiers for bound index vars
  • quantifier for principal frame
  • quantifiers for prefix/suffix completions

99

slide-100
SLIDE 100

Naïve solution

  • quantifiers for bound index vars
  • quantifier for principal frame
  • quantifiers for prefix/suffix completions

Write in terms of

1

slide-101
SLIDE 101

Naïve solution

  • quantifiers for bound index vars
  • quantifier for principal frame
  • quantifiers for prefix/suffix completions

Write in terms of Decidability issues

11

slide-102
SLIDE 102

Better solution

12

slide-103
SLIDE 103

Better solution

Canonicalize symbolic shapes

13

slide-104
SLIDE 104

Better solution

Canonicalize symbolic shapes

14

slide-105
SLIDE 105

Better solution

Canonicalize symbolic shapes

15

slide-106
SLIDE 106

Better solution

Canonicalize symbolic shapes

16

slide-107
SLIDE 107

In universal fragment, easy equality/prefix/suffix — including witnesses

17

slide-108
SLIDE 108

In universal fragment, easy equality/prefix/suffix — including witnesses

18

slide-109
SLIDE 109

In universal fragment, easy equality/prefix/suffix — including witnesses

19

slide-110
SLIDE 110

In universal fragment, easy equality/prefix/suffix — including witnesses Fold argument frame shapes (suffix witnesses) together

11

slide-111
SLIDE 111

In universal fragment, easy equality/prefix/suffix — including witnesses Fold argument frame shapes (suffix witnesses) together

111

slide-112
SLIDE 112

In universal fragment, easy equality/prefix/suffix — including witnesses Fold argument frame shapes (suffix witnesses) together

112

slide-113
SLIDE 113

In universal fragment, easy equality/prefix/suffix — including witnesses Fold argument frame shapes (suffix witnesses) together Type checking works entirely within universal fragment

113

slide-114
SLIDE 114

Type inference:

Identify index arguments elided by programmer

114

slide-115
SLIDE 115

Type inference:

Identify index arguments elided by programmer Function type (Pi (e ...) (-> ((Arr ι σ) ...) τ))

115

slide-116
SLIDE 116

Type inference:

Identify index arguments elided by programmer Function type Argument types (Pi (e ...) (-> ((Arr ι σ) ...) τ)) (Arr κ σ) ...

116

slide-117
SLIDE 117

Type inference:

Identify index arguments elided by programmer Function type Argument types (Pi (e ...) (-> ((Arr ι σ) ...) τ)) (Arr κ σ) ...

  • quantifiers for bound index vars

117

slide-118
SLIDE 118

Type inference:

Identify index arguments elided by programmer Function type Argument types (Pi (e ...) (-> ((Arr ι σ) ...) τ)) (Arr κ σ) ...

  • quantifiers for bound index vars
  • quantifiers for frames

118

slide-119
SLIDE 119

Type inference:

Identify index arguments elided by programmer Function type Argument types (Pi (e ...) (-> ((Arr ι σ) ...) τ)) (Arr κ σ) ...

  • quantifiers for bound index vars
  • quantifiers for frames
  • quantifiers for index arguments

119

slide-120
SLIDE 120

Type inference:

Identify index arguments elided by programmer Function type Argument types (Pi (e ...) (-> ((Arr ι σ) ...) τ)) (Arr κ σ) ...

  • quantifiers for bound index vars
  • quantifiers for frames (eliminated before)
  • quantifiers for index arguments

12

slide-121
SLIDE 121

Type inference:

Identify index arguments elided by programmer Function type Argument types (Pi (e ...) (-> ((Arr ι σ) ...) τ)) (Arr κ σ) ...

  • quantifiers for bound index vars
  • quantifiers for frames (eliminated before)
  • quantifiers for index arguments (solving for these)

121

slide-122
SLIDE 122

Function type Argument types (Pi (e ...) (-> ((Arr ι σ) ...) τ)) (Arr κ σ) ...

122

slide-123
SLIDE 123

Function type Argument types (Pi (e ...) (-> ((Arr ι σ) ...) τ)) (Arr κ σ) ...

123

slide-124
SLIDE 124

Function type Argument types (Pi (e ...) (-> ((Arr ι σ) ...) τ)) (Arr κ σ) ...

124

slide-125
SLIDE 125

Function type Argument types (Pi (e ...) (-> ((Arr ι σ) ...) τ)) (Arr κ σ) ...

125

slide-126
SLIDE 126

Function type Argument types (Pi (e ...) (-> ((Arr ι σ) ...) τ)) (Arr κ σ) ... Pretend are additional generators

126

slide-127
SLIDE 127

Why can we treat like additional generators?

127

slide-128
SLIDE 128

Why can we treat like additional generators? Algorithm for existential fragment (Makanin, 1977)

128

slide-129
SLIDE 129

Why can we treat like additional generators? Algorithm for existential fragment (Makanin, 1977) "How might subsequences align with each other?"

129

slide-130
SLIDE 130

Why can we treat like additional generators? Algorithm for existential fragment (Makanin, 1977) "How might subsequences align with each other?" Equations about smaller sequences

13

slide-131
SLIDE 131

Why can we treat like additional generators? Algorithm for existential fragment (Makanin, 1977) "How might subsequences align with each other?" Equations about smaller sequences No boundaries inside a generator

131

slide-132
SLIDE 132

Why can we treat like additional generators? Algorithm for existential fragment (Makanin, 1977) "How might subsequences align with each other?" Equations about smaller sequences No boundaries inside a generator ... or a universal variable

132

slide-133
SLIDE 133

Why can we treat like additional generators? Algorithm for existential fragment (Makanin, 1977) "How might subsequences align with each other?" Equations about smaller sequences No boundaries inside a generator ... or a universal variable Caveat: only works in conjunctive fragment

133

slide-134
SLIDE 134

Multiple solutions?

134

slide-135
SLIDE 135

Multiple solutions?

(append [[1 2] [3 4]] [[5 6] [7 8]])

135

slide-136
SLIDE 136

Multiple solutions?

(append [[1 2] [3 4]] [[5 6] [7 8]])

(Pi ((l1 Dim) (l2 Dim) (c Shape)) (Arr (Shp) (-> ((Arr (++ (Shp l1) c) Int) (Arr (++ (Shp l2) c) Int)) (Arr (++ (Shp (+ l1 l2)) c) Int))))

136

slide-137
SLIDE 137

Multiple solutions?

(append [[1 2] [3 4]] [[5 6] [7 8]])

(Pi ((l1 Dim) (l2 Dim) (c Shape)) (Arr (Shp) (-> ((Arr (++ (Shp l1) c) Int) (Arr (++ (Shp l2) c) Int)) (Arr (++ (Shp (+ l1 l2)) c) Int))))

c = (Shp 2) c = (Shp)

137

slide-138
SLIDE 138

Multiple solutions?

(append [[1 2] [3 4]] [[5 6] [7 8]])

(Pi ((l1 Dim) (l2 Dim) (c Shape)) (Arr (Shp) (-> ((Arr (++ (Shp l1) c) Int) (Arr (++ (Shp l2) c) Int)) (Arr (++ (Shp (+ l1 l2)) c) Int))))

c = (Shp 2) Major axis append c = (Shp)

138

slide-139
SLIDE 139

Multiple solutions?

(append [[1 2] [3 4]] [[5 6] [7 8]])

(Pi ((l1 Dim) (l2 Dim) (c Shape)) (Arr (Shp) (-> ((Arr (++ (Shp l1) c) Int) (Arr (++ (Shp l2) c) Int)) (Arr (++ (Shp (+ l1 l2)) c) Int))))

c = (Shp 2) Major axis append c = (Shp) Lifted row-wise append

139

slide-140
SLIDE 140

Multiple solutions?

(append [[1 2] [3 4]] [[5 6] [7 8]])

(Pi ((l1 Dim) (l2 Dim) (c Shape)) (Arr (Shp) (-> ((Arr (++ (Shp l1) c) Int) (Arr (++ (Shp l2) c) Int)) (Arr (++ (Shp (+ l1 l2)) c) Int))))

c = (Shp 2) Major axis append c = (Shp) Lifted row-wise append Established convention: Operate along major axis

14

slide-141
SLIDE 141

Multiple solutions?

(append [[1 2] [3 4]] [[5 6] [7 8]])

(Pi ((l1 Dim) (l2 Dim) (c Shape)) (Arr (Shp) (-> ((Arr (++ (Shp l1) c) Int) (Arr (++ (Shp l2) c) Int)) (Arr (++ (Shp (+ l1 l2)) c) Int))))

c = (Shp 2) Major axis append c = (Shp) Lifted row-wise append Established convention: Operate along major axis Require scalar frame shape

141

slide-142
SLIDE 142

Remaining work

142

slide-143
SLIDE 143

Remaining work

143

slide-144
SLIDE 144

Remaining work

Generating

144

slide-145
SLIDE 145

Remaining work

Generating Solving

145

slide-146
SLIDE 146

Remaining work

Solving Largely done (not by me — Makanin, 1977; Karhumäki, et al, 2000) ILP modulo theories (Manolios & Papavasileiou, 2013)

146

slide-147
SLIDE 147

Remaining work

Generating In progress

147

slide-148
SLIDE 148

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

Questions?

148