<jupyter_start><jupyter_text>Relative clauses Author: <NAME>This notebook goes through the analysis of relative clauses in Heim & Kratzer (1998), "Semantics in generative grammar".<jupyter_code>reload_lamb()
composition_system = lang.hk3_system.copy()
lang.set_system(composition_system)
composition_system
%%lamb reset
||gray|| = lambda x_e : Gray(x)
||cat|| = lambda x_e : Cat(x)
||bill|| = Bill_e
||likes|| = lambda x_e : lambda y_e : Likes(y,x)
gray * cat<jupyter_output><empty_output><jupyter_text>What is needed for variable binding?  This takes two parts: * specialized Item classes for the binder and the traces/variables. * code to actually perform predicate abstraction. Both of these are provided as part of `lamb.lang`, in the form of the classes `Binder`, `Trace`, and `IndexedPronoun`, as well as several version of predicate abstraction.  The current composition system is using `lamb.lang.tree_pa_metalanguage_fun`, if you are curious.  (Side note: PA rules in the lambda notebook may not work as you expect; they operate by using variables named with a particular syntax and assignment functions in the metalanguage, rather than assignments for the object language.) Now let's use these things.  Binders and traces can easily be constructed around numeric indices, and used anywhere you would use a regular lexical item:<jupyter_code>b = lang.Binder(5)
t = lang.Trace(5)
t
(b * t).paths()
bill * (likes * t)<jupyter_output><empty_output><jupyter_text>A simple relative clause like "that Bill likes" can be represented as follows:<jupyter_code>r = b * (bill * (likes * t))
r<jupyter_output><empty_output><jupyter_text>This would compose with a NP via Predicate Modification.<jupyter_code>r = gray * (cat * (b * (bill * (likes * t))))
r
r.paths()<jupyter_output><empty_output><jupyter_text>Now for a very complicated example.  This is one of the more challenging examples from Heim and Kratzer, the such-that relative "the man such that Mary reviewed a book that he wrote".<jupyter_code>he = lang.IndexedPronoun("he", 2, types.type_e)
he
%%lamb
||mary|| = Mary_e
||man|| = L x_e : Man(x)
||book|| = L x_e : Book(x)
||wrote|| = L x_e : L y_e : Wrote(y,x)
||reviewed|| = L x_e : L y_e : Reviewed(y,x)
||that|| = L p_t : p
||such|| = L p_t : p
||a|| = L f_<e,t> : L g_<e,<e,t>> : L y_e : Exists x_e : f(x) & g(x)(y)
(lang.Binder(2) * (such * (that * (mary * (reviewed * (a * (book * (lang.Binder(1) * (he * (wrote * lang.Trace(1)))))))))))
r = man * (lang.Binder(2) * (such * (that * (mary * (reviewed * (a * (book * (lang.Binder(1) * (he * (wrote * lang.Trace(1)))))))))))
r.paths()<jupyter_output><empty_output><jupyter_text>Using presuppositional pronounsThe partiality calculation process in this case is somewhat buggy, resulting in redundant partiality conditions being multiplied.<jupyter_code>from lamb.meta import Partial
lang.set_system(lang.td_presup)
lang.get_system()
male_prop = %te L x_e : Male_<e,t>(x)
hei = lang.PresupPronoun.index_factory("he", male_prop)
hei(2)
%%lamb
||mary|| = Mary_e
||man|| = L x_e : Man(x)
||book|| = L x_e : Book(x)
||wrote|| = L x_e : L y_e : Wrote(y,x)
||reviewed|| = L x_e : L y_e : Reviewed(y,x)
||that|| = L p_t : p
||such|| = L p_t : p
||a|| = L f_<e,t> : L g_<e,<e,t>> : L y_e : Exists x_e : f(x) & g(x)(y)
||the|| = lambda f_<e,t> : Iota x : f(x)
r = man * (lang.Binder(2) * (such * (that * (mary * (reviewed * (a * (book * (lang.Binder(1) * (hei(2) * (wrote * lang.Trace(1)))))))))))
the * r<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15208034433285508, 'fraction_numerical': 0.0054519368723099, 'mean_word_length': 5.169911504424779, 'pattern_counts': {'":': 0, '<': 34, '<?xml version=': 0, '>': 34, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '649866', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 1311, 'n_tokens_neox': 1258, 'n_words': 407, 'path': 'notebooks/fragments/Relative clauses.ipynb', 'repo_name': 'poetaster-org/lambda-notebook', 'size': '3491'}