|
penrose.cs.cmu.edu/
一个集合论的例子:
它由以下 Domain, Substance, Style programs 指定
setTheory.domain:
- type Set
- predicate Not(Prop p1)
- predicate Intersecting(Set s1, Set s2)
- predicate IsSubset(Set s1, Set s2)
复制代码
tree.substance:
- Set A, B, C, D, E, F, G
- IsSubset(B, A)
- IsSubset(C, A)
- IsSubset(D, B)
- IsSubset(E, B)
- IsSubset(F, C)
- IsSubset(G, C)
- Not(Intersecting(E, D))
- Not(Intersecting(F, G))
- Not(Intersecting(B, C))
- AutoLabel All
复制代码
venn.style:
- canvas {
- width = 800
- height = 700
- }
- forall Set x {
- x.icon = Circle {
- strokeWidth : 0
- }
- x.text = Equation {
- string : x.label
- fontSize : "25px"
- }
- ensure contains(x.icon, x.text)
- encourage sameCenter(x.text, x.icon)
- x.textLayering = x.text above x.icon
- }
- forall Set x; Set y
- where IsSubset(x, y) {
- ensure smallerThan(x.icon, y.icon)
- ensure disjoint(y.text, x.icon, 10)
- ensure contains(y.icon, x.icon, 5)
- x.icon above y.icon
- }
- forall Set x; Set y
- where Not(Intersecting(x, y)) {
- ensure disjoint(x.icon, y.icon)
- }
- forall Set x; Set y
- where Intersecting(x, y) {
- ensure overlapping(x.icon, y.icon)
- ensure disjoint(y.text, x.icon)
- ensure disjoint(x.text, y.icon)
- }
复制代码 |
|