-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpolymorphism.txt
163 lines (134 loc) · 4.02 KB
/
polymorphism.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
Composition with polymorphic types
multiple letter identifiers
multiple reductions on
### Combinatorial Rules ###
use rule function application
use rule non-branching nodes
use rule predicate modification
use rule lambda abstraction
### Type Conventions ###
variables of type e: x y z
constants of type e: j m b
#
variables of type v: e
variables of type i: t
constants of type v: meeting1 game1
constants of type i: now today
#
variables of type <e,t>: P
constants of type <e,t>: boy man woman american win
#
variables of type <v,t>: V
#
variables of type <e,e>: f g
constants of type <e,e>: the-mother-of the-dog-of the-paycheck-of the-mistress-of the-wife-of
#
variables of type <e,<e,t>>: R
constants of type <e,<e,t>>: love hate meet lose
#
variables of type <<e,t>,t>: Q
#
constants of type <e,<e,<e,t>>>: give
constants of type <e,<e,<v,t>>>: love2 meet2
#
variables of type <t,<e,t>>: T
constants of type <t,<e,t>>: think said
variables of type <t,<e,<v,t>>>: T2
constants of type <t,<e,<v,t>>>: think2
#
variables of type t: p
## Polymorphic Variable Abbreviations ##
variables of type 'a: a
variables of type <'a,'b>: B
variables of type <'b,'c>: C
variables of type <'b,<'a,'c>>: D
variables of type <'a'r,'r>: M
variables of type <<'a'b,'r>,'r>: N
### Lexical Entries ###
## Polymorphic Combinators ##
define g: LC.LB.La.C(B(a))
define z: LD.LB.La.D(B(a))(a)
define id: La.a
define id2,ap: LB.La.B(a)
define flip: La.LB.B(a)
define w: LR_<'b,<'b'c>>Lb_'b.R(b)(b)
define true,const: La.Lb.a
define false,zero: La.Lb.b
define slash: LM.LN.Lk_<'b,'r>.M(La.N(LB.k(B(a))))
define bslash: LN.LM.Lk_<'b,'r>.N(LB.M(La.k(B(a))))
## Content Words ##
define John,john: j
define Mary,mary: m
define Bill,bill: b
#
define the-meeting: meeting1
define the-game: game1
define now: now
define today: today
#
define boy: Lx.boy(x)
define win,wins,won: Lx.win(x)
define american,American: Lx.american(x)
#
define dancer2: La.dancer2(a)
#
define love,loves,loved: Ly.Lx.love(x)(y)
define hate,hates,hated: Ly.Lx.hate(x)(y)
define meet,meets,met: Ly.Lx.meet(x)(y)
define lose,loses,lost: Ly.Lx.lose(x)(y)
#
define give,gives,gave: Lz.Ly.Lx.give(x)(z)(y)
#
define him,her,he,she,it,He,She,It,himself,herself: Lx.x
#
define his-mother: Lx.the-mother-of(x)
define his-paycheck: Lx.the-paycheck-of(x)
define his-wife: Lx.the-wife-of(x)
define his-mistress: Lx.the-mistress-of(x)
define his-dog: Lx.the-dog-of(x)
#
define say,says,said: Lp.Lx.said(p)(x)
define think,thinks,thought: Lp.Lx.think(p)(x)
#
define every,Every: LP'.LP.Ay.[P'(y)->P(y)]
define some,Some: LP'.LP.Ey.[P'(y) & P(y)]
define everybody,Everybody,everyone,Everyone: LP.Ax.P(x)
define Everyyear,everyyear: LP_<it>.At[year(t) -> P(t)]
## Polymorphic Content Words ##
define is1: La.a
define is2: LB.La.B(a)
#
define beautiful: La.beautiful(a)
define dancer: La.dancer(a)
#
define k-john: Lk_<et>.k(j)
define k-mary: Lk_<et>.k(m)
define k-boy: Lk_<et,t>.k(boy)
define k-hates: LK_<<e,et>,t>.K(Ly.Lx.hate(x)(y))
###################################################################################################
exercise tree
title polymorphic sandbox
instructions John is a boy
[ John boy ]
instructions John is a boy
[ John [ id boy ] ]
instructions John loves himself
[ John [ loves w ] ]
instructions John thinks he won
[ John [w [ [g thinks] [ he [g won] ] ] ] ]
instructions John thinks he won
[ John [ [z thinks] [ he [g won] ] ] ]
instructions John is an American boy
[ John [ boy american ] ]
instructions John is a beautiful dancer
[ John [ beautiful dancer ] ]
# The types of the predicates are compatible with either PM or FA. The
# calculator will ask how the teacher wants to combine them. Via PM, they
# result in a coherent, polymorphic VP. FA, on the other hand, predicates
# beauty of the polymorphic function 'dancer', and then throws an error when
# the user attempts to compose in the subject (since there are no argument
# slots left to saturate).
instructions John is a boy (CPS)
[ [ [ slash k-john ] k-boy ] id ]
instructions John hates Mary (CPS)
[ [ [ slash k-john ] [ [ bslash k-hates ] k-mary ] ] id ]