|
6 | 6 | "source": [ |
7 | 7 | "## Quantifiers and scope tutorial\n", |
8 | 8 | "\n", |
9 | | - "### Kyle Rawlins 11/16\n", |
| 9 | + "### Kyle Rawlins 11/16/18, updated 10/27/2021\n", |
10 | 10 | "\n", |
11 | 11 | "This notebook walks through several basic techniques for handling quantifier scope, together with how to implement them in the Lambda Notebook." |
12 | 12 | ] |
|
56 | 56 | "source": [ |
57 | 57 | "### Quantifiers in object position via QR\n", |
58 | 58 | "\n", |
59 | | - "The \"standard\" approach is to move an object position quantified DP so it scopes over its immediate TP. The lambda notebook currently has no explicit syntax beyond order of composition, so this isn't done automatically for you (feel free to submit a pull request...). However, it is easy to do \"by hand\". We will need traces and binders. A version of Predicate Abstraction (PA) is already present as a composition operation in the default system." |
| 59 | + "The \"standard\" approach is to move an object position quantified DP so it scopes over its immediate TP. The lambda notebook doesn't automate QR yet (feel free to submit a pull request...). However, it is easy to construct the trees \"by hand\". This notebook does so by bottom-up composition. We will need traces and binders. A version of Predicate Abstraction (PA) is already present as a composition operation in the default system." |
60 | 60 | ] |
61 | 61 | }, |
62 | 62 | { |
|
65 | 65 | "metadata": {}, |
66 | 66 | "outputs": [], |
67 | 67 | "source": [ |
68 | | - "trace = lang.Trace(index=2, typ=tp(\"e\"))\n", |
| 68 | + "trace = lang.Trace(2)\n", |
69 | 69 | "trace" |
70 | 70 | ] |
71 | 71 | }, |
|
75 | 75 | "metadata": {}, |
76 | 76 | "outputs": [], |
77 | 77 | "source": [ |
78 | | - "binder = lang.Binder(index=2)\n", |
| 78 | + "binder = lang.Binder(2)\n", |
79 | 79 | "binder" |
80 | 80 | ] |
81 | 81 | }, |
|
88 | 88 | "lang.get_system()" |
89 | 89 | ] |
90 | 90 | }, |
| 91 | + { |
| 92 | + "cell_type": "code", |
| 93 | + "execution_count": null, |
| 94 | + "metadata": {}, |
| 95 | + "outputs": [], |
| 96 | + "source": [ |
| 97 | + "# use svgling to at least produce some nice diagrams -- some day this can be auto-generated!\n", |
| 98 | + "import svgling, svgling.figure\n", |
| 99 | + "qrtree2 = (\"TP\", (\"DP\", (\"D\", \"every\"), (\"NP\", (\"N\", \"doctor\"))),\n", |
| 100 | + " (\"TP\", \"3\", (\"TP\", (\"DP\", (\"D\", \"Alfonso\")),\n", |
| 101 | + " (\"VP\", (\"V\", \"saw\"), (\"DP\", \"t(3)\")))))\n", |
| 102 | + "out2 = svgling.draw_tree(qrtree2)\n", |
| 103 | + "out2.movement_arrow((1,1,1,1), (0,))\n", |
| 104 | + "out2.box_constituent((0,))\n", |
| 105 | + "out2 = svgling.figure.Caption(out2, \"Object position QR, referential subject\")\n", |
| 106 | + "out2" |
| 107 | + ] |
| 108 | + }, |
91 | 109 | { |
92 | 110 | "cell_type": "code", |
93 | 111 | "execution_count": null, |
|
106 | 124 | "((every * doctor) * (binder * (alfonso * (saw * trace)))).tree()" |
107 | 125 | ] |
108 | 126 | }, |
| 127 | + { |
| 128 | + "cell_type": "code", |
| 129 | + "execution_count": null, |
| 130 | + "metadata": {}, |
| 131 | + "outputs": [], |
| 132 | + "source": [ |
| 133 | + "import svgling, svgling.figure\n", |
| 134 | + "qrtree2 = (\"TP\", (\"DP\", (\"D\", \"every\"), (\"NP\", (\"N\", \"doctor\"))),\n", |
| 135 | + " (\"TP\", \"3\", (\"TP\", (\"DP\", (\"D\", \"someone\")),\n", |
| 136 | + " (\"VP\", (\"V\", \"saw\"), (\"DP\", \"t(3)\")))))\n", |
| 137 | + "out2 = svgling.draw_tree(qrtree2)\n", |
| 138 | + "out2.movement_arrow((1,1,1,1), (0,))\n", |
| 139 | + "out2.box_constituent((0,))\n", |
| 140 | + "out2 = svgling.figure.Caption(out2, \"Object position QR, quantificational subject\")\n", |
| 141 | + "out2" |
| 142 | + ] |
| 143 | + }, |
109 | 144 | { |
110 | 145 | "cell_type": "code", |
111 | 146 | "execution_count": null, |
|
128 | 163 | "metadata": {}, |
129 | 164 | "outputs": [], |
130 | 165 | "source": [ |
131 | | - "trace5 = lang.Trace(index=5, typ=tp(\"e\"))\n", |
132 | | - "binder5 = lang.Binder(index=5)\n", |
133 | | - "(someone * (binder5 * ((every * doctor) * (binder * (trace5 * (saw * trace))))))" |
| 166 | + "import svgling, svgling.figure\n", |
| 167 | + "qrtree3 = (\"TP\", (\"DP\", (\"D\", \"every\"), (\"NP\", (\"N\", \"cat\"))),\n", |
| 168 | + " (\"TP\", \"5\", (\"TP\", (\"DP\", (\"D\", \"someone\")),\n", |
| 169 | + " (\"TP\", \"2\", (\"TP\", (\"DP\", \"t(5)\"), (\"VP\", (\"V\", \"likes\"), (\"DP\", \"t(2)\")))))))\n", |
| 170 | + "out3 = svgling.draw_tree(qrtree3)\n", |
| 171 | + "out3.movement_arrow((1,1,1,1,0), (0,))\n", |
| 172 | + "out3.box_constituent((0,))\n", |
| 173 | + "out3.movement_arrow((1,1,1,1,1,1), (1,1,0))\n", |
| 174 | + "out3.box_constituent((1,1,0))\n", |
| 175 | + "out3 = svgling.figure.Caption(out3, \"QR object then subject\")\n", |
| 176 | + "out3" |
| 177 | + ] |
| 178 | + }, |
| 179 | + { |
| 180 | + "cell_type": "code", |
| 181 | + "execution_count": null, |
| 182 | + "metadata": {}, |
| 183 | + "outputs": [], |
| 184 | + "source": [ |
| 185 | + "(someone * (lang.Binder(5) * ((every * doctor) * (binder * (lang.Trace(5) * (saw * trace))))))" |
| 186 | + ] |
| 187 | + }, |
| 188 | + { |
| 189 | + "cell_type": "markdown", |
| 190 | + "metadata": {}, |
| 191 | + "source": [ |
| 192 | + "Here's another example illustrating the other QR order that is possible, where first the subject QRs and then the object. This is equivalent to interpreting the subject in situ." |
| 193 | + ] |
| 194 | + }, |
| 195 | + { |
| 196 | + "cell_type": "code", |
| 197 | + "execution_count": null, |
| 198 | + "metadata": {}, |
| 199 | + "outputs": [], |
| 200 | + "source": [ |
| 201 | + "%%lamb\n", |
| 202 | + "||every|| = L f_<e,t> : L g_<e,t> : Forall x_e : f(x) >> g(x)\n", |
| 203 | + "||cat|| = L x_e : Cat(x)\n", |
| 204 | + "||dog|| = L x_e : Dog(x)\n", |
| 205 | + "||some|| = L f_<e,t> : L g_<e,t> : Exists x_e : f(x) & g(x)\n", |
| 206 | + "||likes|| = L x_e : L y_e : Likes(y,x)" |
| 207 | + ] |
| 208 | + }, |
| 209 | + { |
| 210 | + "cell_type": "code", |
| 211 | + "execution_count": null, |
| 212 | + "metadata": {}, |
| 213 | + "outputs": [], |
| 214 | + "source": [ |
| 215 | + "import svgling, svgling.figure\n", |
| 216 | + "qrtree3 = (\"TP\", (\"DP\", (\"D\", \"every\"), (\"NP\", (\"N\", \"cat\"))),\n", |
| 217 | + " (\"TP\", \"1\", (\"TP\", (\"DP\", (\"D\", \"some\"), (\"NP\", (\"N\", \"dog\"))),\n", |
| 218 | + " (\"TP\", \"3\", (\"TP\", (\"DP\", \"t(3)\"), (\"VP\", (\"V\", \"likes\"), (\"DP\", \"t(1)\")))))))\n", |
| 219 | + "out3 = svgling.draw_tree(qrtree3)\n", |
| 220 | + "out3.movement_arrow((1,1,1,1,1,1), (0,))\n", |
| 221 | + "out3.box_constituent((0,))\n", |
| 222 | + "#out3.movement_arrow((1,1,1,1,1,1), (1,1,0))\n", |
| 223 | + "out3.movement_arrow((1,1,1,1,0), (1,1,0))\n", |
| 224 | + "out3.box_constituent((1,1,0))\n", |
| 225 | + "out3 = svgling.figure.Caption(out3, \"QR subject then object\")\n", |
| 226 | + "out3" |
| 227 | + ] |
| 228 | + }, |
| 229 | + { |
| 230 | + "cell_type": "code", |
| 231 | + "execution_count": null, |
| 232 | + "metadata": {}, |
| 233 | + "outputs": [], |
| 234 | + "source": [ |
| 235 | + "(every * cat) * (lang.Binder(1) * ((some * dog) * (lang.Binder(3) * (lang.Trace(1) * (likes * lang.Trace(3))))))" |
| 236 | + ] |
| 237 | + }, |
| 238 | + { |
| 239 | + "cell_type": "code", |
| 240 | + "execution_count": null, |
| 241 | + "metadata": {}, |
| 242 | + "outputs": [], |
| 243 | + "source": [ |
| 244 | + "((every * cat) * (lang.Binder(1) * ((some * dog) * (lang.Binder(3) * (lang.Trace(3) * (likes * lang.Trace(1))))))).tree()" |
| 245 | + ] |
| 246 | + }, |
| 247 | + { |
| 248 | + "cell_type": "markdown", |
| 249 | + "metadata": {}, |
| 250 | + "source": [ |
| 251 | + "Summary figure showing a complete QR process. This figure is adapted directly from the svgling gallery (https://nbviewer.org/github/rawlins/svgling/blob/master/svgling%20Gallery.ipynb)." |
| 252 | + ] |
| 253 | + }, |
| 254 | + { |
| 255 | + "cell_type": "code", |
| 256 | + "execution_count": null, |
| 257 | + "metadata": {}, |
| 258 | + "outputs": [], |
| 259 | + "source": [ |
| 260 | + "import svgling, svgling.figure\n", |
| 261 | + "qrtree0 = (\"TP\", (\"DP\", (\"D\", \"every\"), (\"NP\", (\"N\", \"cat\"))),\n", |
| 262 | + " (\"VP\", (\"V\", \"likes\"), (\"DP\", (\"D\", \"some\"), (\"NP\", (\"N\", \"dog\")))))\n", |
| 263 | + "out0 = svgling.figure.Caption(svgling.draw_tree(qrtree0), \"LF input (= Surface Structure)\")\n", |
| 264 | + "\n", |
| 265 | + "qrtree1 = (\"TP\", (\"DP(1)\", (\"D\", \"every\"), (\"NP\", (\"N\", \"cat\"))),\n", |
| 266 | + " (\"VP\", (\"V\", \"likes\"), (\"DP(3)\", (\"D\", \"some\"), (\"NP\", (\"N\", \"dog\")))))\n", |
| 267 | + "out1 = svgling.draw_tree(qrtree1)\n", |
| 268 | + "out1.box_constituent((0,))\n", |
| 269 | + "out1.box_constituent((1,1))\n", |
| 270 | + "out1 = svgling.figure.Caption(out1, \"Step 1: free indexing of DPs (1 of 2 indexings)\")\n", |
| 271 | + "\n", |
| 272 | + "qrtree2 = (\"TP\", (\"DP\", (\"D\", \"some\"), (\"NP\", (\"N\", \"dog\"))),\n", |
| 273 | + " (\"TP\", \"3\", (\"TP\", (\"DP(1)\", (\"D\", \"every\"), (\"NP\", (\"N\", \"cat\"))),\n", |
| 274 | + " (\"VP\", (\"V\", \"likes\"), (\"DP\", \"t(3)\")))))\n", |
| 275 | + "out2 = svgling.draw_tree(qrtree2)\n", |
| 276 | + "out2.movement_arrow((1,1,1,1), (0,))\n", |
| 277 | + "out2.box_constituent((0,))\n", |
| 278 | + "out2.box_constituent((1,1,0))\n", |
| 279 | + "out2 = svgling.figure.Caption(out2, \"Step 2: QR an indexed DP (choosing the object)\")\n", |
| 280 | + "\n", |
| 281 | + "qrtree3 = (\"TP\", (\"DP\", (\"D\", \"every\"), (\"NP\", (\"N\", \"cat\"))),\n", |
| 282 | + " (\"TP\", \"1\", (\"TP\", (\"DP\", (\"D\", \"some\"), (\"NP\", (\"N\", \"dog\"))),\n", |
| 283 | + " (\"TP\", \"3\", (\"TP\", (\"DP\", \"t(1)\"), (\"VP\", (\"V\", \"likes\"), (\"DP\", \"t(3)\")))))))\n", |
| 284 | + "out3 = svgling.draw_tree(qrtree3)\n", |
| 285 | + "out3.movement_arrow((1,1,1,1,0), (0,))\n", |
| 286 | + "out3.box_constituent((0,))\n", |
| 287 | + "out3.movement_arrow((1,1,1,1,1,1), (1,1,0))\n", |
| 288 | + "out3.box_constituent((1,1,0))\n", |
| 289 | + "out3 = svgling.figure.Caption(out3, \"Step 3: QR an indexed DP (choosing the subject).\")\n", |
| 290 | + "\n", |
| 291 | + "svgling.figure.Caption(svgling.figure.RowByRow(svgling.figure.SideBySide(out0, out1), svgling.figure.SideBySide(out2,out3)), \"Trees illustrating a QR (Quantifier Raising) derivation in the Heim & Kratzer 1998 style\")" |
134 | 292 | ] |
135 | 293 | }, |
136 | 294 | { |
|
139 | 297 | "source": [ |
140 | 298 | "### Quantifiers in object position via type shifting\n", |
141 | 299 | "\n", |
142 | | - "An alternative approach is to type-shift the DP to a type where it can take a transitive predicate and ignore the external argument position.\n", |
| 300 | + "An alternative approach to the object-position puzzle is to type-shift the DP to a type where it can take a transitive predicate and ignore the external argument position.\n", |
143 | 301 | "\n", |
144 | | - "This would need to be generalized for n-ary predicates." |
| 302 | + "This would need to be generalized for n-ary predicates, e.g. the indirect object of \"introduce\"." |
145 | 303 | ] |
146 | 304 | }, |
147 | 305 | { |
|
406 | 564 | "name": "python", |
407 | 565 | "nbconvert_exporter": "python", |
408 | 566 | "pygments_lexer": "ipython3", |
409 | | - "version": "3.5.1" |
| 567 | + "version": "3.7.6" |
410 | 568 | } |
411 | 569 | }, |
412 | 570 | "nbformat": 4, |
413 | | - "nbformat_minor": 0 |
| 571 | + "nbformat_minor": 4 |
414 | 572 | } |
0 commit comments