designing extensible, domain-specific languages for...

205
Designing extensible, domain-specific languages for mathematical diagrams Katherine Ye with Keenan Crane Jonathan Aldrich Josh Sunshine Source: “An Algorithm to Generate Impossible Art?”, Danny Tarlow 1 Off the Beaten Track ‘17

Upload: others

Post on 17-Oct-2020

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

Designing extensible, domain-specific languages for mathematical diagrams

Katherine Ye

with Keenan Crane Jonathan Aldrich

Josh Sunshine

Source: “An Algorithm to Generate Impossible Art?”, Danny Tarlow 1Off the Beaten Track ‘17

Page 2: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

Motivation

2

Page 3: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

sin ✓ =opposite

hypotenuse

cos ✓ =

adjacent

hypotenuse

3

Page 4: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

4

Page 5: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

5

Page 6: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

6

Page 7: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

7

Sometimes people do illustrate mathematics beautifully.

Page 8: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

8

Page 9: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

9

Source: Algebraic Topology Hatcher

illustrating groups (with their notations)

Page 10: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

Source: Visual Group Theory 10

composing different types of diagrams

Page 11: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

Problem:

Drawing good diagrams requires a tremendous amount of effort and expertise.

11

Page 12: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

People have very powerful facilities for taking in information visually… and thinking spatially.

On the other hand, they do not have a very good built-in facility for inverse vision, that is, turning an internal spatial understanding back into a two-dimensional image.

Consequently, mathematicians usually have fewer and poorer figures in their papers and books than in their heads.

William Thurston Fields medalist

12

Page 13: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

People have very powerful facilities for taking in information visually… and thinking spatially.

On the other hand, they do not have a very good built-in facility for inverse vision, that is, turning an internal spatial understanding back into a two-dimensional image.

Consequently, mathematicians usually have fewer and poorer figures in their papers and books than in their heads.

William Thurston Fields medalist

13

Page 14: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

People have very powerful facilities for taking in information visually… and thinking spatially.

On the other hand, they do not have a very good built-in facility for inverse vision, that is, turning an internal spatial understanding back into a two-dimensional image.

Consequently, mathematicians usually have fewer and poorer figures in their papers and books than in their heads.

William Thurston Fields medalist

14

Page 15: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

15

What if mathematicians had more and richer figures in their papers and books than in their heads?

Page 16: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

Penrose

Source: “An Algorithm to Generate Impossible Art?”, Danny Tarlow 16

Page 17: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

Source: https://sallyarjoon.wordpress.com/2013/04/01/enzymes/

Penrose

17

Page 18: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

80% 20%

Casual users

18

Page 19: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

“Let A and B be sets, and p be a point in A.”

… …A

Bp

A

B

p

A

B

p

10 seconds

19

Page 20: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

80% 20%

Power users

20

Page 21: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

“Let A and B be sets, and p be a point in A.”

… …A

Bp

A

B

p

A

B

p

2 hours

21

Page 22: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

Existing solutions for diagramming

22

Page 23: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

Factors in choosing a tool:

Programmatic, direct manipulation, domain knowledge

23

Page 24: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

The design space

24

more programmatic

more direct

more domain knowledge

Page 25: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

Writing a program for a diagram

25

Page 26: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

26

K4 =⌦a, b | a2 = b2 = (ab)2 = e

Page 27: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

27

K4 =⌦a, b | a2 = b2 = (ab)2 = e

Page 28: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

%nodestylecirc/.style={circle,draw=black!60,fill=green!10,minimumsize=7mm}],

%nodes\node[circ](gen_bl){};\node[circ](gen_tl)[above=ofgen_bl]{};\node[circ](gen_br)[right=ofgen_bl]{};\node[circ](gen_tr)[above=ofgen_br,right=ofgen_tl]{};

%\node[circ](gen_bl);%\node[circ](gen_tl)[above=ofgen_bl];%{2}label%\node[circ](gen_tr)[above=ofgen_br,right=ofgen_tl];%\node[circ](gen_br)[right=ofgen_bl];

%drawlinesbetweennodes\draw[-][red,thick](gen_tl.south)--(gen_bl.north);\draw[-][blue,thick](gen_tl.east)--(gen_tr.west);\draw[-][blue,thick](gen_bl.east)--(gen_br.west);\draw[-][red,thick](gen_tr.south)--(gen_br.north);

TikZ

28

K4 =⌦a, b | a2 = b2 = (ab)2 = e

Page 29: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

%nodestylecirc/.style={circle,draw=black!60,fill=green!10,minimumsize=7mm}],

%nodes\node[circ](gen_bl){};\node[circ](gen_tl)[above=ofgen_bl]{};\node[circ](gen_br)[right=ofgen_bl]{};\node[circ](gen_tr)[above=ofgen_br,right=ofgen_tl]{};

%\node[circ](gen_bl);%\node[circ](gen_tl)[above=ofgen_bl];%{2}label%\node[circ](gen_tr)[above=ofgen_br,right=ofgen_tl];%\node[circ](gen_br)[right=ofgen_bl];

%drawlinesbetweennodes\draw[-][red,thick](gen_tl.south)--(gen_bl.north);\draw[-][blue,thick](gen_tl.east)--(gen_tr.west);\draw[-][blue,thick](gen_bl.east)--(gen_br.west);\draw[-][red,thick](gen_tr.south)--(gen_br.north);

TikZ

node style

29

K4 =⌦a, b | a2 = b2 = (ab)2 = e

Page 30: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

%nodestylecirc/.style={circle,draw=black!60,fill=green!10,minimumsize=7mm}],

%nodes\node[circ](gen_bl){};\node[circ](gen_tl)[above=ofgen_bl]{};\node[circ](gen_br)[right=ofgen_bl]{};\node[circ](gen_tr)[above=ofgen_br,right=ofgen_tl]{};

%\node[circ](gen_bl);%\node[circ](gen_tl)[above=ofgen_bl];%{2}label%\node[circ](gen_tr)[above=ofgen_br,right=ofgen_tl];%\node[circ](gen_br)[right=ofgen_bl];

%drawlinesbetweennodes\draw[-][red,thick](gen_tl.south)--(gen_bl.north);\draw[-][blue,thick](gen_tl.east)--(gen_tr.west);\draw[-][blue,thick](gen_bl.east)--(gen_br.west);\draw[-][red,thick](gen_tr.south)--(gen_br.north);

TikZ

node style

node positions

30

K4 =⌦a, b | a2 = b2 = (ab)2 = e

Page 31: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

%nodestylecirc/.style={circle,draw=black!60,fill=green!10,minimumsize=7mm}],

%nodes\node[circ](gen_bl){};\node[circ](gen_tl)[above=ofgen_bl]{};\node[circ](gen_br)[right=ofgen_bl]{};\node[circ](gen_tr)[above=ofgen_br,right=ofgen_tl]{};

%\node[circ](gen_bl);%\node[circ](gen_tl)[above=ofgen_bl];%{2}label%\node[circ](gen_tr)[above=ofgen_br,right=ofgen_tl];%\node[circ](gen_br)[right=ofgen_bl];

%drawlinesbetweennodes\draw[-][red,thick](gen_tl.south)--(gen_bl.north);\draw[-][blue,thick](gen_tl.east)--(gen_tr.west);\draw[-][blue,thick](gen_bl.east)--(gen_br.west);\draw[-][red,thick](gen_tr.south)--(gen_br.north);

TikZ

node style

node positions

line style + positions

31

K4 =⌦a, b | a2 = b2 = (ab)2 = e

Page 32: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

The design space

32

more programmatic

more direct

more domain knowledge

TikZ

Page 33: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

33

Creating a diagram via a GUI

Page 34: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

Source: Keenan Crane 34

curvature of a polyhedron

Page 35: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

35

curvature of a polyhedron

Page 36: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

36

curvature of a polyhedron

Page 37: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

37

curvature of a polyhedron

Page 38: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

Source: Keenan Crane 38

curvature of a polyhedron

5 hours of painstaking clicking and dragging

Page 39: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

39

Page 40: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

40

no style reuse!

Page 41: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

The design space

41

more programmatic

more direct

more domain knowledge

Illustrator

Page 42: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

Burn it all down and write your own software or DSL?

42

Page 43: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

Group Explorer KnotPlot

strid

BayesNet

JaxoDraw

43

Page 44: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

Group Explorer KnotPlot

strid

BayesNet

JaxoDraw

44

Page 45: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

The design space

45

more programmatic

more direct

more domain knowledge

Custom DSLs

Page 46: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

Penrose

Source: “An Algorithm to Generate Impossible Art?”, Danny Tarlow 46

Page 47: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

“Let A and B be sets, and p be a point in A.”

47

Page 48: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

“Let A and B be sets, and p be a point in A.”

Notation

Set A

Set B

Point p

p 2 A

48

Page 49: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

“Let A and B be sets, and p be a point in A.”

Penrose architecture

49

Page 50: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

“Let A and B be sets, and p be a point in A.”

Penrose architecture

Substance View Style

50

Page 51: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

SetASetBPointpInpA

“Let A and B be sets, and p be a point in A.”

Penrose architecture

Substance View Style

51

Page 52: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

“Let A and B be sets, and p be a point in A.”

Dimension2CoordinatesNone

Penrose architecture

Substance View Style

52

SetASetBPointpInpA

Page 53: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

“Let A and B be sets, and p be a point in A.”

ShapeSetCircleColorABlueColorBOrangeShapePointCircleLabelAllAuto

Penrose architecture

Substance View Style

53

SetASetBPointpInpA

Dimension2CoordinatesNone

Page 54: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

“Let A and B be sets, and p be a point in A.”

Penrose architecture

Intermediate representations

Sampling and optimization

Substance View Style

54

SetASetBPointpInpA

ShapeSetCircleColorABlueColorBOrangeShapePointCircleLabelAllAuto

Dimension2CoordinatesNone

Page 55: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

“Let A and B be sets, and p be a point in A.”

Penrose architecture

Intermediate representations

Sampling and optimization

Substance View Style

… …A

Bp

A

B

p

A

B

p

55

SetASetBPointpInpA

ShapeSetCircleColorABlueColorBOrangeShapePointCircleLabelAllAuto

Dimension2CoordinatesNone

Page 56: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

“Let A and B be sets, and p be a point in A.”

Penrose architecture

Intermediate representations

Sampling and optimization

Substance View Style

… …A

Bp

A

B

p

A

B

p

56

SetASetBPointpInpA

ShapeSetCircleColorABlueColorBOrangeShapePointCircleLabelAllAuto

Dimension2CoordinatesNone

Page 57: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

The design space

57

more programmatic

more direct

more domain knowledge

Penrose

Page 58: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

58

…plus extensibility!

Page 59: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

The design space

59

more programmatic

more direct

more domain knowledge

Penrose

prodirect manipulation

Sketch-n-Sketch (Chugh et al, PLDI ’16)

Page 60: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

An example of our vision

60

Page 61: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

I’m demonstrating a mockup of a workflow that I hope to demo live in a few months.

61

Page 62: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

We have a very simple prototype for set theory, which I won’t demo.

62

Page 63: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

Domain: Set theory → Point-set topology

63

Page 64: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

64

Phases: Implementing the DSL → using the DSL

Page 65: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

Implementing the DSL

65

Page 66: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

Declarations

dataSubDecl=DeclObjectdataObject=OSSet|OPPointdataSet=Set’StringSetTypedataSetType=Open|Closed|UnspecifieddataPt=Pt’String

Constraints

dataConstraint=SubsetStringString|PointInStringString

66

Implementing a set theory DSL

Page 67: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

Declarations

dataSubDecl=DeclObjectdataObject=OSSet|OPPointdataSet=Set’StringSetTypedataSetType=Open|Closed|UnspecifieddataPt=Pt’String

Constraints

dataConstraint=SubsetStringString|PointInStringString

67

Implementing a set theory DSL

Page 68: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

Declarations

dataSubDecl=DeclObjectdataObject=OSSet|OPPointdataSet=Set’StringSetTypedataSetType=Open|Closed|UnspecifieddataPt=Pt’String

Constraints

dataConstraint=SubsetStringString|PointInStringString

68

Implementing a set theory DSL

Page 69: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

Declarations

dataSubDecl=DeclObjectdataObject=OSSet|OPPointdataSet=Set’StringSetTypedataSetType=Open|Closed|Clopen|UnspecifieddataPt=Pt’String

Constraints

dataConstraint=SubsetStringString|PointInStringString

69

Implementing a set theory DSL

Page 70: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

70

Implementing a set theory DSL

Declarations

dataSubDecl=DeclObjectdataObject=OSSet|OPPointdataSet=Set’StringSetTypedataSetType=Open|Closed|Clopen|UnspecifieddataPt=Pt’String

Constraints

dataConstraint=SubsetStringString|PointInStringString

Page 71: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

Declarations

dataSubDecl=DeclObjectdataObject=OSSet|OPPointdataSet=Set’StringSetTypedataSetType=Open|Closed|Clopen|UnspecifieddataPt=Pt’String

Constraints

dataConstraint=SubsetStringString|PointInStringString

71

Implementing a set theory DSL

Page 72: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

Declarations

dataSubDecl=DeclObjectdataObject=OSSet|OPPointdataSet=Set’StringSetTypedataSetType=Open|Closed|Clopen|UnspecifieddataPt=Pt’String

Constraints

dataConstraint=SubsetStringString|PointInStringString

72

Implementing a set theory DSL

Page 73: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

SetASetBPointpInpA

Dimension2CoordinatesNone

ShapeSetCircleColorABlueColorBOrangeShapePointCircleLabelAllAuto

Substance View Style

73

Set theory DSL

Page 74: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

Declarations

dataSubDecl=DeclObjectdataObject=OSSet|OPPoint|OMMapdataSet=Set’StringSetTypedataSetType=Open|Closed|Clopen|UnspecifieddataPt=Pt’StringdataMap=Map’StringStringString

Constraints

dataConstraint=SubsetStringString|PointInStringString

74

Extending the set theory DSL

Page 75: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

Using the DSL

75

Page 76: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

Open sets, closed sets, continuous maps

76

Page 77: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

77

Page 78: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

An open ball in R2

A

A=Or(p,Rn)

p

r

78

Page 79: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

An open ball in R2

A

OpenBallA

79

Page 80: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

An closed ball in R2

A

ClosedBallA

80

Page 81: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

An open set in R2

OpenSetU

81

Page 82: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

An open set in R2, simplified

OpenSetU

U

82

Page 83: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

An closed set in R2

ClosedSetU now contains boundary

83

Page 84: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

U

ClosedSetU

84

An closed set in R2, simplified

Page 85: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

Continuous maps

85

Page 86: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

86

Anti-example: discontinuous map

Page 87: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

87

Anti-example: discontinuous map

function “tears” domain

Page 88: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

88

Anti-example: discontinuous map

interval in function’s co-domain is open

Page 89: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

89

Anti-example: discontinuous map

inverse image of open interval is not open!

Page 90: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

90

inverse image of open interval is not open!

Anti-example: discontinuous map

Page 91: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

91

Generalizing the intuition

Page 92: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

92

Generalizing the intuition

Picture this!

Page 93: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

SetASetBSetR^nSetR^mSubsetAR^nSubsetBR^mMapfABOpenSetUSubsetUBSetf^{-1}(U)Subsetf^{-1}(U)A

Substance

93

Page 94: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

SetASetBSetR^nSetR^mSubsetAR^nSubsetBR^mMapfABOpenSetUSubsetUBSetf^{-1}(U)Subsetf^{-1}(U)A

Substance

94

declarations

Page 95: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

SetASetBSetR^nSetR^mSubsetAR^nSubsetBR^mMapfABOpenSetUSubsetUBSetf^{-1}(U)Subsetf^{-1}(U)A

Substance

95

constraints

Page 96: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

StyleAllAuto

Substance Style

96

SetASetBSetR^nSetR^mSubsetAR^nSubsetBR^mMapfABOpenSetUSubsetUBSetf^{-1}(U)Subsetf^{-1}(U)A

Page 97: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

A

97

Page 98: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

A

Rn

98

Page 99: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

A

Rn

B

99

Page 100: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

A

Rn

B

Rm

100

Page 101: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

A

Rn

B

Rm

f

101

Page 102: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

A

Rn

B

U

Rm

f

102

Page 103: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

A

f -1(U)

Rn

B

U

Rm

f

103

Page 104: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

A

f -1(U)

Rn

B

U

Rm

f

104

Page 105: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

StyleAllAutoShapeR^nSquareShapeR^mSquareColorR^nYellowColorR^mYellow

Substance Style

105

SetASetBSetR^nSetR^mSubsetAR^nSubsetBR^mMapfABOpenSetUSubsetUBSetf^{-1}(U)Subsetf^{-1}(U)A

Page 106: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

A

f -1(U)

Rn

B

U

Rm

f

106

Page 107: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

A harder definition…

107

Page 108: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

108

Page 109: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

109

Picture this!

Page 110: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

110

Picture this!

Page 111: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

111

SetASetBSetR^nSetR^mSubsetAR^nSubsetBR^mMapfABOpenSetUSubsetUB

Substance Style

PointpInpAPointf(p)Inf(p)UOpenSetVSubsetVAInpVSetf(V)Subsetf(V)UInf(p)f(V)

underline denotes implicit in notation. f(V) might not be open but is depicted as such

StyleAllAutoShapeR^nSquareShapeR^mSquareColorR^nYellowColorR^mYellow

Page 112: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

A

Rn

B

Rm

112

Page 113: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

A

Rn

B

Rm

f

113

Page 114: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

A

Rn

B

Rm

p

f

114

Page 115: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

A

Rn

B

Rm

p

f

U

115

Page 116: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

A

Rn

B

Rm

p

f

U

116

f(p)

Page 117: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

A

Rn

B

V

Rm

p

f

U

f(p)

117

Page 118: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

A

Rn

B

V

Rm

p

f

U

f(p)

f(V)

118

Page 119: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

119

A

Rn

B

V

Rm

p

f

U

f(p)

f(V)

Page 120: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

How do the two definitions relate?

120

Page 121: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

121

A

Rn

B

V

Rm

p

f

U

f(p)

f(V)

A

f -1(U)

Rn

B

U

Rm

f

Page 122: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

Can prove (1) → (2) via diagram! (omitted)

122

Page 123: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

123

A

Rn

B

V

Rm

p

f

U

f(p)

f(V)

(2)

Prodirect manipulation: center a point

Page 124: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

124

StyleAllAutoShapeR^nSquareShapeR^mSquareColorR^nYellowColorR^mYellow

Substance Style

SetASetBSetR^nSetR^mSubsetAR^nSubsetBR^mMapfABOpenSetUSubsetUB

PointpInpAPointf(p)Inf(p)UOpenSetVSubsetVAInpVSetf(V)Subsetf(V)UInf(p)f(V)

A

Rn

B

V

Rm

p

f

U

f(p)

f(V)

(2)

Page 125: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

125

A

Rn

B

V

Rm

f

U

f(p)

f(V)

(2) p

StyleAllAutoShapeR^nSquareShapeR^mSquareColorR^nYellowColorR^mYellow

Substance Style

SetASetBSetR^nSetR^mSubsetAR^nSubsetBR^mMapfABOpenSetUSubsetUB

PointpInpAPointf(p)Inf(p)UOpenSetVSubsetVAInpVSetf(V)Subsetf(V)UInf(p)f(V)

Page 126: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

126

A

Rn

B

V

Rm

f

U

f(p)

f(V)

(2)

StyleAllAutoShapeR^nSquareShapeR^mSquareColorR^nYellowColorR^mYellow

Substance Style

p

SetASetBSetR^nSetR^mSubsetAR^nSubsetBR^mMapfABOpenSetUSubsetUB

PointpInpAPointf(p)Inf(p)UOpenSetVpSubsetVAInpVSetf(V)Subsetf(V)UInf(p)f(V)

infer code

changes!

Page 127: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

127

Penrose takeaways

• Easily implement and extend DSLs • Easily reuse styles • Expertise encoded! Substantial

benefits accrue with each new diagram

• Just throw in notation; get a useful illustration

Page 128: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

128

Penrose takeaways

• Easily implement and extend DSLs • Easily reuse styles • Expertise encoded! Substantial

benefits accrue with each new diagram

• Just throw in notation; get a useful illustration

Page 129: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

129

Penrose takeaways

• Easily implement and extend DSLs • Easily reuse styles • Expertise encoded! Substantial

benefits accrue with each new diagram

• Just throw in notation; get a useful illustration

Page 130: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

130

Penrose takeaways

• Easily implement and extend DSLs • Easily reuse styles • Expertise encoded! Substantial

benefits accrue with each new diagram

• DSL users can just throw in notation; get a useful illustration

Page 131: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

Language design challenges

131

Page 132: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

Penrose provides an extensible visual semantics for mathematical notation.

132

Page 133: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

“Let A and B be sets, and p be a point in A.”

… …A

Bp

A

B

p

A

B

p

133

Page 134: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

Where are the semantics?

134

Page 135: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

Notation

Set A

Set B

Point p

p 2 A

“Let A and B be sets, and p be a point in A.”

135

Page 136: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

SetASetBPointpInpA

“Let A and B be sets, and p be a point in A.”

Dimension2CoordinatesNone

ShapeSetCircleColorABlueColorBOrangeShapePointCircleLabelAllAuto

Substance View Style

136

Page 137: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

SetASetBPointpInpA

“Let A and B be sets, and p be a point in A.”

Dimension2CoordinatesNone

ShapeSetCircleColorABlueColorBOrangeShapePointCircleLabelAllAuto

Substance View Style

137

… …A

Bp

A

B

p

A

B

p

Page 138: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

138

Another way to give semantics to mathematical notation…

Page 139: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

Once formalized as a procedure, a mathematical idea becomes a tool that can be used directly to compute results.

139

Another way to give semantics to mathematical notation…

Page 140: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

Modularity, compositionality

140

Page 141: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

Source: Visual Group Theory 141

Page 142: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

Dynamic Symbols in Illustrator

142

Page 143: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

Interoperability

143

Page 144: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

how to design the common IR / substrate / host language?

group theory sub-DSL

permutation sub-DSL

other sub-DSLs

144

Page 145: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

1 2

3 4

1 2 3 4

1 2 3 4

1 2 3 4

1 2 3 4

Cayley diagram for K4 Permutation group

* 2

* 2

* 3 * 3

145

Cayley’s theorem

Page 146: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

Extensibility

146

Page 147: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

“Let A and B be sets, and p be a point in A.”

…for each component of Penrose

Intermediate representations

Sampling and optimization

Substance View Style

… …A

Bp

A

B

p

A

B

p

147

SetASetBPointpInpA

ShapeSetCircleColorABlueColorBOrangeShapePointCircleLabelAllAuto

Dimension2CoordinatesNone

Page 148: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

“Let A and B be sets, and p be a point in A.”

Penrose architecture

Intermediate representations

Sampling and optimization

Substance View Style

… …A

Bp

A

B

p

A

B

p

148

SetASetBPointpInpA

ShapeSetCircleColorABlueColorBOrangeShapePointCircleLabelAllAuto

Dimension2CoordinatesNone

Page 149: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

“Let A and B be sets, and p be a point in A.”

Penrose architecture

Intermediate representations

Sampling and optimization

Substance View Style

… …A

Bp

A

B

p

A

B

p

149

SetASetBPointpInpA

ShapeSetCircleColorABlueColorBOrangeShapePointCircleLabelAllAuto

Dimension2CoordinatesNone

Page 150: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

“Let A and B be sets, and p be a point in A.”

Penrose architecture

Intermediate representations

Sampling and optimization

Substance View Style

… …A

Bp

A

B

p

A

B

p

150

SetASetBPointpInpA

ShapeSetCircleColorABlueColorBOrangeShapePointCircleLabelAllAuto

Dimension2CoordinatesNone

Page 151: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

Our broader vision

151

Page 152: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

Automatically parse and visualize mathematics

152

Page 153: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

153

Page 154: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

154

Page 155: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

155

A

Rn

B

V

Rm

p

f

U

f(p)

f(V)

A

f -1(U)

Rn

B

U

Rm

f

Page 156: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

Source: https://www.reddit.com/r/math/comments/5i845f/mathpix_a_phonecamera_powered_3d_grapher 156

Page 157: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

Next time you want to illustrate your paper or talk…

157

Page 158: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

158

…reach for Penrose!

Page 159: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

“Testimonials”

159

(from real people!)

Page 160: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

I would certainly be an eager user of such a system.

The current state of the art for my workflow is a lot of copy-pasting and tweaking of TikZ code.

Edward Morehouse category theorist

160

Page 161: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

This looks fabulous! (…)

I'd love to use it to rewrite Group Explorer for the web!

Nathan Carter author of Visual Group Theory

161

Page 162: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

Thanks! Questions?

162

Page 163: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

Gallery

163

Page 164: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

164

Source: Visual Group Theory

illustrating a theorem by example

Page 165: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

165

Source: Visual Group Theory

illustrating an algorithm

Page 166: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

Source: https://arxiv.org/pdf/1610.06204.pdf 166

illustrating an algorithm

Page 167: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

167

Source: A first course in geometric topology

more geometric diagrams

Page 168: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

Source: Keenan Crane 168

geometric diagram described by notation

Page 169: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

169

Source: A first course in geometric topology

illustrating maps (functions) between objects

Page 170: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

170Source: Keenan Crane

illustrating maps (functions) between objects

Page 171: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

Source: Algebraic Topology Hatcher 171

function composition

Page 172: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

Source: “Understanding LSTM Networks,” Chris Olah 172

circuit-type diagrams for equations

Page 173: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

Source: NIST 800-90A 173

circuit-type diagrams for equations

Page 174: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

Source: Graphical Linear Algebra 174

math done via diagrams

Page 175: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

175

Source: Visual Group Theory

sometimes we don’t know what we want to draw…

Page 176: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

FAQ

176

Page 177: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

How will you evaluate the effectiveness of Penrose?

How does Penrose compare to Asymptote, TikZ, Ipe, etc.?

How does Penrose compare to Mathematica, Wolfram Alpha, GeoGebra, graphing calculators, etc.?

What other domains of math might you target?

How will Penrose deal with continuous domains?

How much of the system have you actually implemented so far?

Do you plan to put Penrose on the web, or integrate it with TeX?

What rendering backend will you use?

Have you considered <related work>?

Can I use Penrose right now? No? Then when??

177

Page 178: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

How much about mathematics does Penrose need to “know”?

Have you considered hooking it up to a system for formal reasoning, such as a theorem prover (e.g. Coq)?

What about programs that represent invalid, incorrect, or inconsistent diagrams?

How can Penrose enable counterfactual or nonconstructive reasoning?

How will you deal with quantifiers (e.g. for all, there exists) and their nesting and ordering?

How will you separate Substance from Style? I don’t find HTML/CSS to be very convincing.

Should all branches of mathematics be illustrated? Some seem more amenable to illustration than others.

How easy would it be for you to extend Penrose to do interactive diagrams, animated diagrams, sequential diagrams, algorithmic diagrams, or parameterized diagrams? What about illustrating theorems and proofs?

178

Page 179: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

Bonus slides

179

Page 180: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

Runtime and layout challenges

180

Page 181: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

“Let A and B be sets, and p be a point in A.”

Penrose architecture

Intermediate representations

Sampling and optimization

Substance View Style

… …A

Bp

A

B

p

A

B

p

181

SetASetBPointpInpA

ShapeSetCircleColorABlueColorBOrangeShapePointCircleLabelAllAuto

Dimension2CoordinatesNone

Page 182: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

80% 20%

Casual users Power users

182

Page 183: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

pinAAandBdonotintersectcurve2isnothomotopicto0Biscontainedinthepreimageoff

Constraints

183

Page 184: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

layitoutlefttorightcentersets,butkeepthemawayfromeachotherpositionlabelsclosetotheirobjectbutfarfromothers’smartlinebreaks

Objectives

184

Page 185: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

importExpertise

185

Page 186: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

Proof by picture, continued

186

Page 187: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

What’s the difference?

187

Page 188: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

188

Page 189: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

189

Page 190: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

190

A

Rn

B

V

Rm

p

f

U

f(p)

f(V)

A

f -1(U)

Rn

B

U

Rm

f

Page 191: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

191

A

f -1(U)

Rn

B

U

Rm

f

A

Rn

B

V

Rm

p

f

U

f(p)

f(V)

(1)

(2)

(1) -> (2)

A

Rn Rm

p

f

U

f(p)

Page 192: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

192

A

f -1(U)

Rn

B

U

Rm

f

A

Rn

B

V

Rm

p

f

U

f(p)

f(V)

(1)

(2)

(1) -> (2)

A

Rn Rm

f

U

f(p)p

f -1(U)

Page 193: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

193

A

f -1(U)

Rn

B

U

Rm

f

A

Rn

B

V

Rm

p

f

U

f(p)

f(V)

(1)

(2)

(1) -> (2)

A

Rn Rm

f

U

f(p)p

f -1(U)

V

open ball centered at p

Page 194: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

recall: an open set in R2

OpenSetU

194

Page 195: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

195

A

f -1(U)

Rn

B

U

Rm

f

A

Rn

B

V

Rm

p

f

U

f(p)

f(V)

(1)

(2)

(1) -> (2)

A

Rn Rm

f

U

p

f -1(U)

f(p)

Vf(V)

open ball centered at f(p)

Page 196: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

196

A

f -1(U)

Rn

B

U

Rm

f

A

Rn

B

V

Rm

p

f

U

f(p)

f(V)

(1)

(2)

(1) -> (2)

A

Rn Rm

f

U

p

f -1(U)

f(p)

Vf(V)

open ball centered at f(p)

Page 197: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

197

A

f -1(U)

Rn

B

U

Rm

f

A

Rn

B

V

Rm

p

f

U

f(p)

f(V)

(1)

(2)

(1) -> (2)

A

Rn Rm

f

U

p

f -1(U)

f(p)

Vf(V)

not centered!

Page 198: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

198

A

Rn

B

V

Rm

p

f

U

f(p)

f(V)

(2)

Prodirect manipulation: center the points

Page 199: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

199

A

Rn

B

V

Rm

p

f

U

f(p)

f(V)

(2)

Prodirect manipulation: center the points

Page 200: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

200

StyleAllAutoShapeR^nSquareShapeR^mSquareColorR^nYellowColorR^mYellow

Substance Style

SetASetBSetR^nSetR^mSubsetAR^nSubsetBR^mMapfABOpenSetUSubsetUB

PointpInpAPointf(p)Inf(p)UOpenSetVSubsetVAInpVSetf(V)Subsetf(V)UInf(p)f(V)

A

Rn

B

V

Rm

p

f

U

f(p)

f(V)

(2)

Page 201: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

201

A

Rn

B

V

Rm

f

U

f(p)

f(V)

(2)

StyleAllAutoShapeR^nSquareShapeR^mSquareColorR^nYellowColorR^mYellow

Substance Style

p

SetASetBSetR^nSetR^mSubsetAR^nSubsetBR^mMapfABOpenSetUSubsetUB

PointpInpAPointf(p)Inf(p)UOpenSetVpSubsetVAInpVSetf(V)Subsetf(V)UInf(p)f(V)

infer code

changes!

Page 202: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

A

f -1(U)

Rn

B

U

Rm

f

202

animation, interactivity, fuzzing

Page 203: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

A

f -1(U)

Rn

B

U

Rm

f

203

animation, interactivity, fuzzing

definition holds for the “edge case” of empty sets

Page 204: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

204

Page 205: Designing extensible, domain-specific languages for ...kqy/resources/Penrose_OBT_slides_original.pdf · information visually… and thinking spatially. On the other hand, they do

205