Friday, May 13, 2016

Language Without the Clause

Having been playing for a while with WSL (which has no verbs) and Valaklusha, which I have not yet blogged about, which has no nouns, I had a realization that there are some linguistic concepts even more fundamental than the noun/verb distinction which are nevertheless still not essential to communication.

In particular, every language I have ever heard of has something that can be reasonably called a clause (some syntactic structure which describes a particular event, state, or relation) which is usually (though not always) recursively nestable with other clauses to make more complex sentences.

Predicate logic, however, does not have to be analyzed in terms of nicely-bounded clauses in the linguistic sense. (There are things in logic called "clauses", but they're not the same thing.) Predicates describing the completely independent referents of completely independent linguistic clauses can be mixed together in any order you like with no loss of meaning, due to the availability of an effectively infinite number of possible logical variables that you can use to keep things straight. In fact, we can not only get rid of clauses- we can get rid of recursive phrase structure entirely.

There are, of course, practical problems with trying to use an infinite set of possible pronouns in a speakable language. If there weren't, creating good loglangs wouldn't be hard! But even with a relatively small finite set of pronouns representing logical variables, it's possible to create unambiguous logical structures that overlap elements from what would normally be multiple clauses. Thus, we could come up with a language which, rather than using recursive nesting, uses linear overlapping, with no clear boundaries that be used to delimit specific clauses.

After thinking of that, I realized that Gary Shannon's languages Soaloa and Pop are examples of exactly that kind of language, although (as described on that page) they do have an analysis in terms of nested clauses. Eliminating the possibility of a clausal analysis requires something a little more flexible.

A better example is Jeffrey Henning's Fith. It works completely differently from Pop- which should not be surprising! It would be quite surprising to discover that there are only two ways of structuring information, using clauses and not-using-clauses, but that's not how it is. This is not a dichotomy, which means there is a huge unexplored vista of untapped conlanging potential in the organizational territory outside of recursive clause structure land.

Fith is inspired by the programming language FORTH, and is supposed to be spoken by aliens who have a mental memory stack. Some words (nouns) add concepts to the stack, and other words (verbs and such) manipulate the items already on the stack and replace them with new, more complex concepts. If that were all, Fith would look like a simple head-final language, and the stack would be irrelevant- but that is not all! There are also words, called "stack conjunctions" or "stack operators", which duplicate or rearrange (or both) the items already on the stack. Because it can duplicate items on the mental stack, Fith has no need for pronouns, and every separate mention of a common noun can be assumed to refer to a different instance of it- if you meant the same one, you'd just duplicate the existing reference! But more importantly, the existence of stack operators means that components of completely independent semantic structures can be nearly-arbitrarily interleaved, as long as you are willing to put in the effort to use the right sequence of stack operators to put the right arguments in place for each verb when it comes. One can write a phrase-structure grammar that describes all syntactically valid Fith utterances... but it's meaningless. Surface syntax bears no significant relation to semantics at all, beyond some simple linear ordering constraints.

In fact, Fith is a perfect loglang- it can describe arbitrarily complex predicate-argument structures with no ambiguity, and it doesn't even require an arbitrary number of logical variables to do it! Unfortunately, it's also unusable by humans; Fith doesn't eliminate memory constraints, it just trades off remembering arbitrarily-bound pronouns with keeping track of indexes in a mental stack, which is arguably harder. Incidentally, this works for exactly the same reason that combinator calculus eliminates variables in equivalent lambda calculus expressions.

(Side note: the stack concept is not actually necessary for evaluating Fith or combinator calculus- it's just the most straightforward implementation. Some of Lojban's argument-structure manipulating particles actually have semantics indistinguishable from some stack operators, but Lojban grammar never references a stack!)

Having identified two varieties of languages that eschew traditional clauses, here's a sketch of a framework for a third kind of clauseless language:

The basic parts of speech are Pronouns, Common Verbs, Proper Verbs, and Quantifiers; you can throw in things like discourse particles as well, but they're irrelevant to the basic structure. This could be elaborated on in many ways.

Pronouns act like logical variables, but with a twist: just like English has different pronouns for masculine, feminine, and non-human things ("he", "she", and "it"), these pronouns are not arbitrarily assigned, but rather restricted to refer to things in a particular semantic domain, thus making them easier to keep track of when you have a whole lot of them in play in a single discourse. Unlike English pronouns, however, you'd have a lot of them, like Bantu languages have a large number of grammatical genders, or like many languages have a large number of classifiers for counting different kinds of things. In this way, they overlap a bit with the function of English common nouns as well.
In order to allow talking about more than one of a certain kind of thing at the same time, one could introduce things like proximal/distal distinctions.

Verbs correspond to logical predicates, and take pronouns as arguments with variable arity. There might be a tiny bit of phrase structure here, but at least it would be flat, not recursively nestable- and one could treat pronouns as inflections to eliminate phrase structure entirely.
These aren't quite like normal verbs, though- they do cover all of the normal functions of verbs, but also (since they correspond to logical predicates) the functions of nouns and adjectives, and some adverbs. Essentially, they further constrain the identity of the referents of the pronouns that they take as arguments, beyond the lexical semantic restrictions on the pronouns themselves. Common verbs are sort of like common nouns- they restrict the referents of their arguments to members of a certain generic class. Proper verbs, on the other hand, restrict at least one of their arguments to refer to exactly one well-known thing.

Quantifiers re-bind pronouns to new logical variables. They cover the functional range of articles, quantifiers, and pronouns in English. The simplest way for quantifiers to work would be a one-to-one mapping of predicate logic syntax, where you just have a quantifier word combined with a pronoun (or list of pronouns) that it binds. A bit more interesting, however, might be requiring quantifiers to attach to verbs, implicitly re-binding the arguments of the modified verb to the referents which are the participants in the event described by the verb. If that is not done, it might be useful to have "restrictive" vs. "non-restrictive" inflections of verbs, where restrictive verbs limit the domain of the binding quantifiers for their arguments, and non-restrictive verbs merely provide extra information without more precisely identifying (like English restrictive vs. non-restrictive relative clauses).

For very simple sentences, this wouldn't look too weird, except for the pre-amble where you quantify whatever pronouns you intend to use first. But the first thing to notice is that, just like in predicate logic, there is no need for all of the verbs describing the same referent to be adjacent to each other. A sentence in English which has two adjectives describing two nouns could be translated with the translation-equivalent of the nouns all at the front and the translation-equivalent of the adjectives all at the end, with the translation-equivalent of the verb in between. But hey, if you have a lot of agreement morphology, normal languages can sometimes get away with similar things already; although it's not common, separating adjectives from nouns can occur in, e.g., Russian.

Where it gets really weird is when you try to translate a complex sentence or discourse with multiple clauses.
When multiple English clauses share at least one referent, this relation is not indicated by nesting sentences within each other, or conjoining them in series, but by stringing on more verbs to the end, re-using the same pronouns as many times as you like. Occasionally, you stick in another quantifier when you need to introduce a new referent to the discussion, possibly discarding one that is no longer relevant. But, since this can be done re-binding one pronoun at a time while leaving others intact, the discourse can thus blend continuously from one topic into another, each one linked together by the overlap of participants that they have in common, with no clear boundaries between clauses or sentences. If you were very careful about your selection of pronouns, and made sure you had two non-conflicting sets, you could even arbitrarily interleave the components of two totally unrelated sentences without ambiguity!

Note that this does not describe a perfect loglang- the semantic structures it can unambiguously encode are different from those accessible to a language with tree-structured, recursively nested syntax, but they are still limited, due to the finite number of pronouns available at any one time. This has the same effect on limiting predicate logic as limiting the maximum stack depth does in Fith.

When discussing this idea on the CONLANG-L mailing list, some commenters thought that, like Fith, this style of language sounded incredibly difficult to process. But, I am not so certain of that. It definitely has pathological corner cases, like interleaving sentences, but then, so does English- witness garden path sentences, and the horrors of center embedding (technically "grammatical" to arbitrary depth, but severely limited in practice). Actual, cognitively-limited, users would not be obligated to make use of every structure that is theoretically grammatical! And even in the case of interleaved sentences, the ability of humans to do things like distinguishing multiple simultaneous voices, or separate note trains of different frequencies, makes me think it might just be possible to handle, with sufficient practice. Siva Kalyan compared the extremely free word order to hard-to-process Latin poetry, but Ray Brown (although disagreeing that my system sounded much at all like Latin poetry) had this to say on processability:
If it really is like Latin poetry then it certainly is not going to be beyond humans to process in real-time. In the world of the Romans, literature was essentially declaimed and heard. If a poet could not be understood in real-time as the poem was being declaimed, then that poet's work would be no good. It was a world with no printing; every of a work had to be done by hand. Whether silent reading ever occurred is debatable. If you you had the dosh to afford expensive manuscripts, you would have an educated slave reading them to you. What was heard had to be processed in real-time. The fact that modern anglophones, speaking a language that is poor in morphology and has to rely to a large extent on fairly strict word-order, find Latin verse difficult to process in real time is beside the point. Those brought up with it would certainly do so.
And being myself a second-language speaker of Russian, I have to say I am fairly optimistic about the ability of the human mind to deal with extremely free word-order. If I, a native Anglophone, can handle Russian without serious difficulty, I see no reason why the human mind should not be able to handle something even less constrained, especially if it is learned natively. Furthermore, if I think of pronouns like verb agreement inflections in a somewhat-more-complicated-than-usual switch-reference system, where the quantifiers act like switch-reference markers, then it starts to feel totally doable.

There are several devices speakers could use to reduce the load on listeners, like repeating restrictive verbs every once in a while to remind listeners of the current referents of the relevant pronouns. This wouldn't affect the literal meaning of the discourse at all, but would reduce memory load. This is the kind of thing humans do anyway, when disambiguating English pronouns starts to get too complicated.

This system also allows "floating" in the style of Fith, where one binds a pronoun and then just never actually uses it; unlike Fith, though, if the class of pronouns is small enough, it would quickly become obvious that you were intentionally avoiding using one of them, which should make the argument-floating effect more obvious to psychologically-human-like listeners.

Now, to be clear, what I have described thus far is not really a sketch for one single language, but rather a sketch for a general structure that could be instantiated in numerous different ways, in numerous different languages. As mentioned above, pronouns could exist as separate words, or as verb inflections. The components that I've packaged into Pronouns, Quantifiers, and Verbs could be broken up and re-packaged in slightly different ways, cutting up the syntactic classes into different shapes while still maintaining the overall clauseless structure. One could introduce an additional class of "common nouns" which mostly behave like pronouns, and represent logical variables, but have more precise semantics like verbs. This is potentially very fertile ground for developing a whole family of xenolangs with as much variation in them as we find between clause-full human natlangs! And I am feeling fairly confident that a lot of them would end up as something which, sort of like WSL, is still comprehensible by humans even if it could never arise as a human language naturally.

Friday, May 6, 2016

A Programming Language for Magic

Or, The Structure and Interpretation of Demonic Incantations, Part II.

As previously mentioned, a great deal of the training for a magician in the animist, demon-magic world consists of developing the mental discipline to compose precise and unambiguous instructions. Natural human languages are terrible at both precision and disambiguation; legalese is a direct result of this fact, and it still fails. In order to summon demons safely, therefore, a specialized formal language will be required- a programming (or "incantation") language.

Many people criticize FORTH and related languages for being hard to follow when data is passed implicitly on the program stack, but that's not an indictment of the concatenative style- it's an indictment of point-free (or, less charitably "pointless") style; i.e., the avoidance of explicit variable names. Concatenative programs can use explicit variables for convenience, and applicative languages can be written in point-free style as well. This is in fact quite common in Haskell and various LISPs, though the syntax of most mainstream languages makes it less convenient.

Despite both being called "languages", programming languages aren't much like human languages. That is, after all, why we need them- because human languages don't do the job. Conversely, programming languages tend to not play nice with humans' natural language abilities. Nobody likes trying to speak a programming language, or even to write fluently in one. When working out ideas on a whiteboard, or describing an algorithm in a paper, real-world programmers and computer scientists frequently avoid real programming languages and fall back on intuitive "pseudo-code" which sacrifices rigor in exchange for more easily communicating the essential ideas to other humans (or themselves 10 minutes later!), with careful translation into correct, computer-interpretable code coming later.

Now, magicians could work in a similar way, and it makes sense that they frequently would: laboriously working out correct spells in a written incantation language ahead of time, and then executing them by summoning a demon with the simple instruction "perform the task described on this paper". One can even go farther and imagine that, given the effort involved in creating such a spell, that they might be compiled into books for frequent re-use, stored in a university library, such that from then on magicians could execute common useful spells by instructing a demon to, e.g., "execute the incantation on page 312 of volume 3 of the Standard Encyclopedia of Spells as stored on shelf 4A of the Unseen University Library".

But, this is not a universal solution. For many simple spells, the description of where to find them may well be longer and more error-prone than simply reciting the spell itself. And, as any sysadmin could tell you, sometimes it's not worth writing a stored program for one-off tasks; you just need to be able to write a quite bash script on the command-line. For magical purposes, therefore, we'll want a programming language that is optimized for speaking, while retaining the precision of any other programming language.

After some discussion on the CONLANG-L mailing list, I think I have a pretty good idea of (one possibility for) what a "magical scripting language" might look like.

The major problem that I see needing to be solved is parenthesization; one can't be expected to properly keep track of indentation levels in speech, and explicit brackets around everything can get really hard to
keep track of even when you can look at what you're doing on a screen (which is why we have special editors that keep track of bracket-matching for us!)

Ideally, the language would not require explicit parenthesization anywhere, and other "syntactic noise" and boilerplate code would be minimized, so that every token of the language carries as much semantic weight as possible, to make them easier to memorize. This leads me to think that a concatenative, combinator-based language (like FORTH, or the non-programming-language conlang Fith) would be the best base, on top of which "idiomatic" flourishes could be added. Concatenative languages are often called "stack based", but they don't have to be implemented with a stack. They are in fact isomorphic to applicative languages like LISPs (i.e., there is a purely mechanical method for transforming any concatenative program into a fully-parenthesized applicative program and vice-versa), and can equally well be thought of as "data flow" languages, specifying how the outputs of one operation connect up with the inputs of another, and this is in fact a topic I have written about on this blog before.

There is a trade-off between being able to keep track of complex data flow without any explicit variable names, which can get very difficult if certain items are used over and over again, and being required to keep track of lots of temporary or bookkeeping variables (like loop indices). A concatenative language that allows you to define variables when you want, but minimizes extra variables whenever they would constitute "syntactic noise" with minimal semantic value, seems to me the best of both worlds. This should make simple incantations relatively easy to compose on-the-fly, and easy to memorize, as they would be mostly flat lists of meaningful words, similar to natural language.

Once you introduce re-usable variables, however, you have to decide the question of how variables are scoped. Letting all variables have the same meaning everywhere ("global scope") is an extremely bad idea; it makes it very dangerous to try re-using existing spells as components of a new spell, because variable names might be re-used for very different purposes in different sub-spells. If we want to be able to define and re-use sub-spells (i.e., functions, subroutines, procedures, or blocks, in terms of real-world programming languages), there are two major approaches to scoping rules available: dynamic scoping, and static scoping.

Loosely speaking, dynamic scoping means that any variables that are not defined in a function (or block) are the same as variables with the same name that are in-scope at the place where the function was called. This can only be figured out when a function is actually run, hence "dynamic". Static scoping means that any variables not defined in a function (or block) are the same as variables with the same name that are in-scope at the place where the function was defined. This can be figured out by looking at the text of a program without running it, hence "static".

Dynamic scope is generally easier to implement in (some kinds of) interpreters, while static scope is generally easier to implement in compilers, which early on in CS history led to a split between some languages using dynamic scope and some using static scope just because it was easier to implement the language that way. The modern concensus, however, is that dynamic scope is almost always a Bad Idea, because it makes it harder to analyze a program statically and prove that it is correct, whether with an automatic analysis tool or just in terms of being able to look at it and easily understand how the program works, without running it. Nevertheless, dynamic scope does have some legitimate use cases, and some modern languages provide work-arounds to let you enforce dynamic scoping where you really need it.

Scala, for example, simulates dynamic scoping with "implicit arguments", and this really highlights a good argument for dynamic scoping in a spoken programming language. One pain point with most programming languages, which would only be exacerbated in a spoken context, is remembering the proper order for long lists of function arguments. This can be ameliorated by named (rather than positional) arguments, but having to recite the names of every argument every time one calls on a sub-spell seems like a lot of boilerplate that it would be nice to be able to eliminate.

With dynamic scoping, however, you get the benefits of named arguments without having to actually list them either in a function definition (although that might well be a good idea for documentary purposes when spells are written down!) or when calling them. Just use reasonable names in the body of a sub-spell for whatever object that sub-spell is manipulating, and as long as variables with the appropriate names have already been defined when you wish to use a sub-spell, that's all you need. Making sure that those names refer to the correct things each time the sub-spell is called is taken care of automatically.

Examples

So, what might this incantation language actually look/sound like? Let's look first a simple script to do your dishes after a meal:

loop [more-than COUNT-DISHES 0] [let DISH [NEXT-DISH] DISH pickup DISH SINK move WATER DISH use SOAP DISH use DISH CABINET move]

Things that are assumed to built-in to the language are in lower case, while things that are assumed to be magician-defined are in upper case. If every "verb" has fixed arity (so you always know exactly how many arguments it will need- there are no ambitransitives) then you don't need brackets around arguments or special delimiters between statements/expressions. We only need them to delimit "complement clauses"- i.e., blocks of code that are themselves arguments to other operators (in this, case "loop" and "let").

If magicians want to create their own higher-order spells which take other spells as arguments, there's not much to be done about eliminating those brackets. There are transformations in combinator calculus that can be used to remove them, but the results are extremely difficult for a human to follow, and no one would compose them on-the-fly for anything task of significant complexity. We could introduce a macro metaprogramming system that would let magicians define their own clause-delimiter syntax to eliminate cruft or enhance memorability, but then you might have to remember separate syntax for every sub-spell, which could get even worse than having to remember a single set of brackets. This is, in fact, a real problem that the LISP community (among others) deals with- if your language is too powerful, and too expressive, you get fragmentation problems, and end up with extra memory burden trying to keep track of what ridiculous things your co-workers decided to use that power for. It's often easier to enforce consistency.

Still, we can achieve some improvement by adding some "flourishes" to some of the basic, built-in operators in the language, replacing generic brackets with special construct-specific keywords. This is in fact a strategy taken by many real-world programming languages, which use block keywords like "while...wend" or "if...endif" rather than generic brackets for everything. With that alteration made, the spell might look something like this:

while more-than COUNT-DISH 0 loop let DISH be NEXT-DISH in DISH pickup DISH SINK move WATER DISH use SOAP DISH use DISH CABINET move wend

Now there's a lot of distance between the "loop" and the "wend", which could, in a more complicated spell, make it easy to lose track of, even with the specialized keywords. To help with that, we can do some aggressive let-abstraction- assigning blocks to variables, and then using the short variable name in place of the long literal block definition. That gets us a spell like

let WASHING be let DISH be NEXT-DISH in DISH pickup DISH SINK move WATER DISH use SOAP DISH use DISH CABINET move in
while more-than COUNT-DISH 0 loop WASHING wend


In some ways, that's better, but now we have the potentially-confusing sequence of nested "let"s ("let ... be let ... be ... in ... in"), and we can't move the second "let" outside the definition of "WASHING" because it actually needs to be re-evaluated, redefining "DISH", every time "WASHING" is called. This wouldn't be a big problem in a written programming language, but it's seriously annoying in speech. There are a few ways it could be fixed; one solution I like is allowing cataphoric variables (which refer to a later definition) in addition to anaphoric variables (which refer to an earlier definition), so we can switch up which structure to use to avoid repetition, and make a choice about which structure is more conceptually appropriate in different kinds of spells. Cataphoric variables are not terribly common in real-world programming languages, but they do exist, as in Haskell's "where"-clauses. Implementing "where" in out magic language, we can write the spell as

while more-than COUNT-DISH 0 loop WASHING wend
where WASHING is let DISH be NEXT-DISH in DISH pickup DISH SINK move WATER DISH use SOAP DISH use DISH CABINET move done


We might also take advantage of dynamic scoping to write the algorithm in a more functional style, mapping over the collection of dishes, like so:

for DISH in DISHES loop WASHING rof
where WASHING is DISH pickup DISH SINK move WATER DISH use SOAP DISH use DISH CABINET move done


or

let WASHING be DISH pickup DISH SINK move WATER DISH use SOAP DISH use DISH CABINET move in
for DISH in DISHES loop WASHING rof


In either case, the nested "let" to define the DISH variable is eliminated by binding a DISH variable in a for-in construct over a collection of DISHES, and relying on dynamic scope to make that variable available in the body of WASHING. Note that this avoids the need for spoken function parameter definitions, although it would be relatively easy to add syntax for them in cases where they do turn out to be useful.

Now, this looks like a pretty straightforward spell, but note that it only works if we assume that things like "pickup", "NEXT-DISH", "use", and so forth have all been rigorously and safely defined ahead of time! These are all actually pretty complex concepts, and in practice demon magic would probably not be used for relatively low-effort, high-descriptive-complexity tasks like washing dirty dishes. But, for magical scripting to be useful, we would a lot of these kinds of everyday things to be pre-defined. And just as *NIX users tend to have opinions about what things they individually want to have available in their command-line environment, and maintain custom .bash_profile/.bashrc files per login account, I imagine that perhaps working magicians carry around phylacteries containing written copies of personally-preferred spells, and begin each incantation by referring to them to establish the appropriate execution environment.

Monday, February 22, 2016

The Structure & Interpretation of Demonic Incantations

Some day, I shall get back to finishing up my thoughts on formal semantics and small languages; and some other day, I shall write more on programming language design. But today, I open up a new topic that I have not addressed on my blog before: creative writing! More specifically, hard-fantasy worldbuilding.

I like magic with rules. I like fantasy stories in which magic isn't "magic"- it's just the way the world works, part of physics that just happens to be different from ours. As a programmer myself, I'm also fond of fantasy stories with computers in them- things like The Silicon Mage and parts of the Castle Perilous books. The astute reader may recognize the title as a play on Structure and Interpretation of Computer Programs. And I'm certainly not the first to invent a magic system based on computer programming, but I think I've got a pretty fun personal take on the concept.

The Background

Several years ago, Eliezer Yudkowsky published a short story called Initiation Ceremony, a followup to the essay "To Spread Science, Keep it Secret"; the central idea here is that people like knowing secrets and being part of conspiracies- so if we want to increase scientific literacy and respect for science, maybe the best route would actually be to keep it secret! Or, put on a show of doing so, at least.

That got me thinking- what if there was a real practical reason why some particular science had to be kept secret?

Maybe the universe itself is programmable, and that fact needs to be hidden from malicious hackers (not terribly unique yet).

Maybe the universe is programmable, and it's ridiculously easy to do, if you know the trick. So easy that literally anybody can access the super-user interface with 5 minutes instruction to tell them how; but if you don't know what you're doing, an improperly educated person could accidentally destroy the world....

That's something worth keeping as a very carefully controlled secret. Plausibly, that would be very difficult to do indefinitely. So perhaps we're looking at a world that has undergone multiple cycles of civilization and destruction, whenever the secret gets into the wrong hands.

So, how does the programming interface work? Why, by giving instructions to demons of course! Humans acquiring magical powers by making deals with supernatural creatures- demons, angels, or what-have-you- is an old and respectable fantasy trope; we just need to set up some rules that make it more like computer programming, and less like Dr. Faustus. If demons are really good at following directions, but natively really stupid, like computers....

In more detail: Presume that the universe is animist, down to the very lowest levels. Basically, it works like our world, but the thing that "breathes fire into the equations and makes a universe for them to describe" is that every particle is actually an animist intelligence which has been instructed in the rules of physics that it is meant to follow (by whom!?). Additional intelligences exercise hierarchical control over various higher levels of organization- most notably, there's a primordial intelligence, or spirit, behind every living organism, including every human, and a lot of inanimate objects too, a fact which would be objectively, scientifically verifiable to a properly-trained thaumatologist. If you could talk to the intelligence behind an electron, or anything else, and tell it to behave differently, it would, just like you can talk to a person and convince them to do things- but how do you talk to an electron? You need some kind of intermediary, someone or something that can communicate directly with the fundamental intelligences of the animist world, but which can also understand you, the magician.

Now we get into some theology- an empirical science in this world, even if not everyone believes in precisely the same religion! Clearly, someone had to give the electrons and such their initial instructions; the world was formed out of a chaos of primordial intelligences at all levels of advancement by a Creator, who picked the simplest intelligences for the jobs of being fundamental particles, and also instructed them to obey certain kinds of commands under certain circumstances from more advanced intelligences, thus providing a mechanism for the intelligences selected to serve as human spirits (and those of other animals) to exercise free will over their bodies. This implies two things: first, that even really simple primordial intelligences must be aware of each other and capable of communicating with each other, and also capable of solving fairly complicated mathematical problems extremely rapidly; and second, that, given the finite number of animals in the world, that there is still an infinite number of advanced intelligences left in the primordial chaos outside the world.

Some of that infinite sea of left-out intelligences would probably like very much to have the chance to interact with Creation.

Since there is a Creator who told the world how to work in the first place, miracles are easily performed if that Creator just decides to give some updated instructions every once in a while; or, alternatively to instruct the animist world to understand and obey commands from certain delegated servants- priests of the one true religion. That's one kind of "magic" that would exist in this world, but so far it just looks like a monotheistic religion in a world indistinguishable from our own. In order to turn "magic" into a reproducible, objective science, we presume that, having set up humans as lords over his Creation, this Creator has also given every human the authority to allow additional intelligences from the infinite chaos permission to interact with the world, and give them delegated authority over some material domain to serve as their "body".

The only requirements are that a human
a) be "sane" (another fiddly concept which would suddenly have an objective, verifiable test in this world!)
b) genuinely want such an intelligence to enter the world.
c) genuinely believe that it will work

That gets you the most basic, simplest possible "magic spell"- the equivalent of "uum" from Sam Hughes's serial novel Ra, a spell that "works" but does nothing, as no instructions are provided to the summoned intelligence.

Once you add the intention that the summoned intelligence have permission to interact with the material world in any way, however, that's when things get dangerous! Before you meet them (and remember, they exist in the infinite chaos outside the world- where are you going to get the chance?), there's no way to select a specific intelligence to summon; whichever random one you get might be fairly smart, or insufferably stupid; and it might be naturally benevolent, or excessively malevolent, or simply ignorant- a state often indistinguishable for malevolence! If your instructions are either impossible to carry out, or insufficiently precise, you might get lucky with having summoned an "angel"- a benevolent, reasonably smart intelligence- but much more likely, the results will be some level of disastrous. Hence, the common name for summoned intelligences: Demons. It's just safer to assume that they're all dangerous and malevolent, and make sure you know how to control them properly.

The requirements for doing magic- believe that it will work, and wish for a demon to show up with a particular set of instructions- are so simple that they could be easily rediscovered by just about anyone with a sufficiently open mind. "Fortunately", much like the sparks from Girl Genius, most people who independently rediscover demon summoning without proper training are likely to accidentally kill themselves, or at least get scared off it, well before they can do any large-scale damage. But, to really maintain a stable society would require a massive over-arching conspiracy and disinformation campaign about the true nature of magic, such that people do not actually believe that they are capable of it, rather like the situation in Shin Sekai Yori, where all humans possess powerful telekinesis.

And, if initiates to the conspiracy want to be able to actually use magic at all safely, it would be necessary for them to develop something very like our computer science, in order to ensure that they can provide absolutely precise instructions to obviate any possible differences in the personality or intelligence level of any summoned demon, and ensure that they will all behave precisely the same, predictably and reproducibly- and safely- for any given spell.

Additional Restrictions

If demons can be used to re-instruct any matter arbitrarily, as the Creator of the World could do, that's a little over-powered- not to mention difficult for humans to practically figure out how to use. Magic systems are made interesting not so much by what they can do, but what they can't do- and how characters manage to exercise their creativity to get around those restrictions anyway.

First, the low-level limitations: demons can produce effects equivalent to applying arbitrary forces, or manipulating statistical outcomes, but they are not permitted to violate certain fundamental invariants of the universe, such as:
  1. No effects that would violate conservation of energy or momentum.
  2. No transmission of information faster than light.
  3. No exact cloning of quantum information.
etc. That last one means you better not ask a demon to "make an exact copy" of something, even given the necessary raw materials to work with. After all, an exact copy would require duplicating a quantum state. Duplication spells are going to be a little more complicated than that! These rules would be enforced by the original instructions given by the Creator to the animist intelligences that form the physical world. Understanding and command of magic in this world will, therefore, go hand-in-hand with advancing knowledge of physics to explain what exactly demons can do, and why they can't do certain things.

Additionally, the source of magic (essentially, delegation of creative power to humans by divine fiat) suggests a few other higher-level rules:
  1. A demon cannot directly alter any part of a human's body without explicit consent of that human.
  2. A demon acting on its own cannot intentionally kill a human.
But, that doesn't mean a demon can't be instructed to do something else that the magician knows will end up killing someone, nor that a demon taking malicious or ignorant advantage of unclear instructions can't make life incredibly unpleasant, and perhaps accidentally fatal, for the summoner and those nearby. Perhaps they simply find it amusing to replace all of the air in the room with jello.... But they do prevent accidental world-wide catastrophes due to malicious demons summoned by untrained magicians. These rules would be actively enforced by some of the higher-level controlling intelligences of the world- "guardian angels", if you wish.

A Specific Magical Society

Under this framework, there are still all kinds of different societies that could develop. That's part of what makes for an interesting world, in which all kinds of different stories could be told about different people in different places. Here's one that I find interesting:

As previously noted, this world has probably gone through several catastrophes, where some rogue magician has had the power to "destroy the world". The last disaster left behind a slew of magical artifacts from the previous civilization- things which, on a purely physical level, are unremarkable, but which have demons attached to them running complicated "software" and just waiting around for someone to activate the programmed user interface appropriately. These provide for a rich source of ad-hoc folk magic beliefs, given that they don't behave according to any necessary logical rules- merely according to the whim of the ancient magician who created them, and whatever they thought "made sense". They would also be intriguing objects of study for specialists in reverse-engineering, attempting to use the ancient objects to advance the state of modern thaumatology.

The conspiracy and practice of magic is controlled by a Guild of Magicians, who do not publicly reveal the source of magical power, but are very clear on the fact that it's extremely difficult to explain or make use of, certainly not something that just anybody can do, although they are happy to welcome anyone willing to go through the necessary many years of preliminary training. In order to create a supply of adepts who are appropriately trained in the mental discipline of composing precise and unambiguous instructions, they accredit and control Colleges of Thaumaturgy in universities through the country, one of whose departments is of course Algorithmics- of which the basic reference work is, of course, The Structure and Interpretation of Demonic Incantations. Demons, of course, are purely theoretical constructs- oracles that one may assume have no real intelligence but will follow any instructions given them quickly and precisely, and whose operation can be approximated by certain useful algorithmic devices studied in the College of Engineering. Unlike most CS programs in our world, however, courses in Algorithmics would focus heavily on formal provability of incantation (program) correctness and security.

An accredited degree in algorithmics, plus some study of physics, qualify a student to apply for entrance to the Guild, to assist a practical magician. Those who prove sufficiently skilled and trustworthy are eventually advanced to the rank of Licensed Magician via a private initiation ceremony in which the secret is revealed- that demons are real, and your incantations will become effective (i.e., your programs will run) if you believe it, and wish it. After that point, they may begin to work as practical magicians in some field of engineering, or as academic researchers.

Occasionally, of course- every couple of years or so- someone rediscovers the secret anew anyway, or some disgruntled magician really does leak it to their friends despite their extensive training, and a little bit of havoc ensues. When that happens, the Guild must spring into action to effect containment of the disaster, and construct a cover story about how the secret of magic was leaked, and reiterating to the public just how dangerous it is outside of the hands of the Guild, and only the Guild.

Of course, there are other countries in the world, not all of which are under control of the Guild of Magicians, but that's no worry- all of the ones that still exist clearly have their own effective means of keeping the secret under control, and if they don't tip off their own citizens, they certainly won't tip off ours....

Tuesday, September 22, 2015

A Progressive Model of WSL Syntax & Interpretation: Part 3

Last time we saw how to introduce generalized quantifiers and arbitrary specifier positions into our model of WSL; but, in the process, we lost any recognition of the scoping effects between quantifiers. Figuring out how scoping effects work for generalized quantifiers represented by sets-of-sets can get pretty complicated and confusing, so we're gonna really slow and step-by-step.

First, let's revise and review our model of the syntax so far. The complete syntactic model that I'll be using for the rest of this post is given by the following grammar:

S  → P AP
AP → RP AP | 0
RP → QP R | QP e
QP → Q NP
NP → N NP | 0

Where an S is a Sentence, an AP is a Argument Phrase, an RP is a Role Phrase, an R is a Role, a QP is a Quantifier Phrase, a Q is a Quantifier, an NP is a Noun Phrase, and N is a Noun.

Next, let's look at some examples to get a better grasp on how scope should work. Consider the English sentence

"Everybody loves somebody."

This has several possible translations into WSL; two of them are:

1) Ka ves anz i siru jest anz jo.

and

2) Ka jest anz jo siru ves anz i.

Sentence (1) states that, for every person, there is someone whom that person loves- but not every lover necessarily loves the same lov-ee. Sentence (2), on the other hand, states that there is some single person whom everybody else loves, because the existentially-quantified patient is now outside the scope of the universally quantified agent.

Additionally, sentence (1) allows that every agent might be participating in a totally separate instance of "loving", while sentence (2) indicates that there is only one instance of "loving" going on, and every person is a simultaneous agent in it. This is because of differences in the scope of the existentially-quantified specifier ("siru", with a phonologically-null quantifier). Moving "siru" to different positions produces more subtly-different interpretations; e.g., taking (2) and moving the specifier to the end would indicate that there is one person who is separately and independently loved by everyone- possibly at different times. And adding multiple conjoined specifiers would make things even more complicated.

Now let's take a look at how Roles get assigned to QPs inside Role Phrases, as of last time:

[|RP: QP R|] = λx. {y : ∃z. z ∈ x & [|R|](z)(y)} ∈ [|QP|]

What we're doing here is constructing the set of all things that bear a particular relation to some element of the specifier set, and then asserting that that is the same as one of the potential referent sets from the Quantifier Phrase. This implicitly imposes some constraints on the identity of the specifier set as well. A Role Phrase containing a specifier works a little differently:

[|RP: QP e|] = λx.∃Y. Y ∈ [|QP|] & Y ⊆ x

This just imposes an explicit constraint on the identity of the specifier set. (Note that I have chosen here to use an upper-case Y for the referent set in the rule for specifiers, to distinguish it from the lowercase y used for an element of the referent set for normal Role Phrases.)

In order to respect quantifier scoping, we need to arrange things so that we can reconstruct all lower-scope quantifier sets and select the relevant constraints independently for every element y of the referent set that we're constructing for the current RP.

In order to do that, we first have to make the denotations of all lower-scoped RPs available during the interpretation of any given RP. That means modifying our interpretation rules for APs as follows:

[|AP|] = λx.[|RP|](x)([|AP|])

such that the denotation of next-lower-scope Argument Phrase (which contains all the remaining Role Phrases) is filtered through the current Role Phrase as a parameter. That will, of course, require updating the rules for RPs to take multiple arguments, and doing the right thing with them:

[|RP: QP R|] =
        λx.λa. {y : ∃z. z ∈ x & [|R|](z)(y) & a(x)} ∈ [|QP|]

[|RP: QP e|] =
        λx.λa. ∃Y. Y ∈ [|QP|] & Y ⊆ x & a(x)


This places the evaluation of each Argument Phrase inside the scope of the variable y bound by the next higher Argument Phrase. Although y itself is not accessible in the lower scopes (we only pass along the shared specifier set as a parameter to a), this means that lower quantifiers are re-evaluated for every y. Thus, in "Ka ves anz i siru jest anz jo.", it is possible in the evaluation of "jest anz jo" to select a different existentially-quantified referent to correspond to every member of the universally-quantified referent set of "ves anz i". This is obvious in the semantics for specifiers, where we're still cheating a little bit by using the "∃" symbol to bind the variable Y and borrowing its scoping behavior.

The interpretation for the internal structure of a QP, containing a Q and an NP, remain unchanged. If we round things out with an explicit rule for null APs, we get the following completed model for the syntax-semantics interface:

[|S|]  = [|P|]([|AP|])

[|AP: RP AP|] = λx.[|RP|](x)([|AP|])
[|AP: 0|]     = λx. true

[|RP: QP R|] =
        λx.λa. {y : ∃z. z ∈ x & [|R|](z)(y) & a(x)} ∈ [|QP|]

[|RP: QP e|] =
        λx.λa. ∃Y. Y ∈ [|QP|] & Y ⊆ x & a(x)


[|QP|] = [|Q|]([|NP|])

[|NP: N NP|] = [|N|] ∩ [|NP|]
[|NP: 0|]    = U

[|P|] = G[P]
[|R|] = G[R]
[|Q|] = G[Q]
[|N|] = G[N]

This gets us the ability to model a pretty big chunk of all WSL declarative sentences. Still to come: non-intersective Nouns, modality, alternative Projectors, subordinate clauses, and controlling semantic projection.

Monday, September 21, 2015

A Compositional "yes" and Other Discoveries

Since WSL is radically everything-drop, it recently occurred to me that a complementizer (or "projector" in WSL-specific terminology) and a modal particle with no other content words nevertheless constitute a complete sentence (in fact, just a bare complementizer should constitute a complete sentence, but I decided that would be pragmatically weird in every case, and just Not Done).

So, of course, I had to set out to figure out what all the combinations would actually mean. Not as an exercise in formal semantics, but idiomatically; how would native speakers of WSL actually use these short phrases in everyday life?

The four basic modal particles are

es - normal realis mood
miy - approximately equivalent to "could be" or "might, for all I know".
bi - logical possibility
pek - roughly equivalent to "should" or "it better be"

There are ten projectors, so that gives a total of 40 possible combinations. 16 of them (plus two more we'll consider later) can be complete sentences on their own:

k'es (ka+es): an assertion that some contextually-provided proposition is true. I.e., "yes". But not all the time! We'll come back to this later....
ka miy: "Sure, if you say so."
ka bi: "That is definitely a logical possibility." (I expect this one is typically used sarcastically, with the implication of  "no, I don't really think so".
k'pek (ka+pek): "If not, we got problems."

tc'es: "No". But again, not all the time....
tce miy: "That is probably wrong"
tce bi: "Not necessarily"
tce pek: "I hope not"

em es: "Is it?"
e'miy: "Could it (for all you know)?"
em bi: "Could it ever?"
em pek: "Should it?"

mi's: "Ain't it?"
mi miy: "Couldn't it?"
etc, You can guess the last two.

While figuring those out, I also came up with this bonus phrase, which includes an extra third word:

ka ves bi: "This is an obvious logical necessity in all possible worlds".
Or, more colloquially: "Well, duh!"
(This sentence, small as it is, is actually structurally ambiguous, but the alternate reading
is the very weird "it is a logical possibility that everything is that thing". Not something you'd need to say very often!)

The next 16 combinations are not complete sentences, but are valid nominal clauses:

vr'es (vor+es): Something. Anything. I'm thinking this might end up getting used as a generic indefinite pronoun for when you really don't care what (cf. "mek", which is the indefinite pronoun "one", but frequently gets used as a  cataphor for dislocated nominal clauses)
vor miy: a hypothetical entity which you posit to exist, but might not
vor bi: any hypothetical entity, whose actual existence is irrelevant
vor pek: that which darn well ought to be. Like flying cars.
Em intc mot "flying cars" jesihu!? K'ajnu vor pek es!
Where are my flying cars!? We should have those by now!

votc es: a nonexistent thing. I'm thinking this might be an idiom comparable to "unicorn"
votc miy: a thing which you are really darn sure does not exist. The emphatic "rainbow-vomiting nuclear unicorn", for example.
votc bi: a logical impossibility
votc pek: that which darn well oughtn't to be. Like social spiders... ick!
Ka votc peku "social spiders" es!
Social spiders are a thing which should not be!

vm'es (vem+es): "whether it is"
ve'miy (vem+miy): "whether it could be, as far as you know"
vem bi: "whether it's logically possible"
vem pek: "whether it should be"

vmi's (vmi+es): "whether it isn't"
vmi'y (vmi+miy): "whether it isn't, as far as you know"
etc.

Finally, the following combinations can be either complete stand-alone sentences, or nominal clauses:

s'es (sa+es): "Yes, they are" or "the fact that they are", asserting that a predicative relationship holds.
satc es: "No, they aren't" or "the fact that they aren't"

You can probably fill in the remaining 6 combinations for the other moods.

So, not only have I discovered the WSL words for "yes" and "no, we've also found that there are two different ways of saying "yes" (k'es and s'es) and two different ways of saying "no" (tc'es and satc es), conditioned on whether the question you are responding to is about a predicative relationship or not.

Additionally, the internal structure of a compositional "yes" or "no" parallels the syntactic structure of the question. So, if somebody asks you a negative question, like "Aren't you going?" responding with "Tc'es" means "No, I'm not"- confirming that the negative that the questioner used was
appropriate. If, however, you respond with "K'es", that actually means "Yes, I am"- contradicting the questioner's use of a negative. Thus, there is no confusion over "was that a 'yes, I'm not', or a
yes-like-'no, I am'?", and no need for yet another word like the French "si" just to take care of answering negative question unambiguously.

A Progressive Model of WSL Syntax & Interpretation: Part 2

Last time, I ended with the note that properly modelling specifier phrases would require splitting the interpretation of argument phrases in half; in particular, I had in mind the idea that variable bindings for noun phrases would need to be moved around to ensure that the specifier variable would be in-scope in the semantics for every argument phrase.

It turns out that the solution is actually much simpler. First, we will introduce a very simple change to the syntax rule for a sentence to account for sentential Projectors (a part of speech which heads independent clauses in WSL):

S  → P QP e AP

Next, we'll stop treating the specifier phrase separately, and account for it as a special case of an argument phrase:

S  → P AP
AP → A AP | 0
A  → QP R | QP e

We could also choose to treat the specifier clitic as a kind of Role, which would be slightly simpler, but this formulation better reflects my own psychological perception of what a specifier is (and thus presumably reflects the intuition of the fictional native speakers of WSL as well). Note that this allows a single clause to contain multiple specifiers, as well as putting them in arbitrary positions with respect to the other arguments; that situation is accounted for in the WSL Primer, which says that the semantics of multiple specifier phrases is the same as that of multiple conjoined specifiers, except that using multiple specifiers allows you to place them all in different quantifier scoping levels- the same as the interpretation for repeated roles.

The semantics for these bits of syntax is as follows:

[|S|]  = [|P|]([|AP|])
[|AP|] = λx.[|A|](x) & [|AP|](x)
[|A: QP R|] = λx.[|QP|](λy. [|R|](x)(y))
[|A: QP e|] = λx.[|QP|](λy. y ⊆ x)

To summarize: the denotation of a sentence is the denotation of the argument phrase chain filtered through the denotation of the Projector; the denotation of an argument phrase is the denotation of the argument given an entity variable x conjoined with the denotation of the remaining argument phrase given x; and the denotation of an argument is the denotation of a relation on the shared entity variable x and the phrase-specifier entity variable z filtered through the denotation of the quantifier phrase (which for the moment is unchanged from last time).

The case of an argument containing a QP and specifier clitic instead of a QP and a Role just contains the explicit relation that the phrasal entity z is a subset of x. Note that this requires interpreting z and x not as representing single referents, but as sets of possible referents- an idea I introduced earlier in the series on semantics for a monocategorial language.

For now, we'll only deal with a single Projector: "ka", which indicates a simple declarative sentence. It's semantics are very simple:

[|P|] = G["ka"] = λy.∃x. y(x)

This just says that some x (which now refers to a set) exists, and its identity will be constrained by y (which is bound to the denotation of the argument phrase chain). We could build this into the interpretation of an S directly, but we will have to deal with the semantics of Projectors at some point, so we might as well start here.

We now have the ability to intersperse specifiers and other arguments in any order, with the members of the specifier set constrained by the specifier phrases, and the scope of all quantifiers corresponding exactly to their surface order!


Generalizing Quantifiers

The next step in building our model of WSL semantics is to improve the handling of quantifiers. As described in this article, the denotation of a Quantifier phrase will be represented not by a proposition in predicate logic, but by a set of sets of possible referents- all those sets of referents which contain the appropriate quantity of the type of referent identified by a given Noun phrase. This helps our model conform to the intuition that a bare noun or quantifier phrase does not correspond to a logical assertion- i.e., that a given entity exists- but merely to a possible entity itself. The semantics for any individual quantifier are given by a function which takes in the denotation of a Noun phrase and uses it to construct the appropriate set of sets. The new interpretation rule for QPs is as follows:

[|QP|] = G[Q]([|N|])

And some examples of Quantifier semantics are as follows:

G["ves"] = λy. {x ⊆ U : y ⊆ x} ("every" or "all"; i.e, the set of all sets in the universe U that contain the entire set y)

G["jest"] = λy. {x ⊆ U : |y ∩ x| > 0} ("some"; i.e, the set of all sets in the universe that contain at least on element of y)

G["hiq"] = λy. {x ⊆ U : |y ∩ x| = 5} ("five"; i.e, the set of all sets in the universe that contain exactly some five elements of the set y)

This of course also requires a new formulation of the semantics for Noun phrases that produces the basis set of "referents of the right type". The new Noun rule is as follows:

[|N: n N|] = G[n] ∩ [|N|]
[|N: 0|]   = U

Rather than binding a new entity variable which we assert to satisfy a given predicate, or to be a member of a given set (given by looking up the Noun n in the lexicon), we simply directly construct the intersection of all of the sets that are the denotations of individual Nouns.
Finally, we have to update the interpretation rules for arguments (again) to handle the new kind of denotation for QPs:

[|A: QP R|] = λx. {y : ∃z. z ∈ x & [|R|](z)(y)} ∈ [|QP|]
[|A: QP e|] = λx.∃y. y ∈ [|QP|] & y ⊆ x

This says that a normal argument containing a role marker asserts that the set of all entities y which satisfy a particular relation with some element of the specifier set x is in the denotation of the QP; or, that an argument containing the specifier clitic asserts that some element y of the the denotation of the QP is a subset of the specifier set x.

Unfortunately, we've just undone our progress in allowing for the correct quantifier scopes! I constructing a compositional semantics for quantifiers in terms of sets, we have thrown out the conventions for establishing variable scopes in predicate logic- because we eliminated the variables! In order to recover the proper quantifier scopes, we're going to have to find a way to take into account the constraints imposed in lower scopes while constructing the sets for higher-scoped quantifiers.

We'll take a look at that problem in the next post in the series.

Sunday, September 13, 2015

Non-intersective Nouns & Negative Scopes

This post is a follow-up to several prior discussion on formal semantics for a minimalistic monocategorial language. If you aren't familiar with them already, you may want to read part one and part two before proceeding.

Non-intersective Nouns

There is a class of adjectives called "non-intersective adjectives" because the set of referents of a noun phrase that includes them does not intersect the set of referents for the same noun phrase without.
This concept is best explained with examples: "a short basketball player" is also "a basketball player", so "short" is an intersective adjective--the set of "short things" intersects the set of "basketball players", and the meaning of the whole phrase is the intersection of those two sets.
On the other hand, "a former basketball player" is not "a basketball player", so "former" is non-intersective. The meaning of "former basketball player" is not a subset of "basketball player", and isn't formed by intersecting it with anything. It's a completely disjoint set, but one that does have a logical relationship to the set of "basketball players".

Similarly, if you "almost finish", then you do not "finish", so "almost" is a non-intersective adverb.

My formal education in formal semantics only really exposed me to one way of modelling non-intersective adjectives/adverbs: as higher-order functions that take predicates as arguments and produce new, different predicates. Thus, the predicate logic notation for a "former player" is former(player')(x) (vs. player(x)) , for some entity x.

But this model is not very compositional (i.e., if a "former player" is former(player')(x), a "former basketball player" is... what exactly?), and results in icky complicated interpretation rules. As a result, I have so far mostly avoided them in WSL, and the few times I've needed them I've punted
and just decided that they are taken care of by morphological affixes. That works as long as you just want to say something like "a former player", and leave the "basketball" (or any other additional descriptors) out of it.

Contemplating the programming language Prolog, however, provides a way out of this mess. Basic versions of Prolog do not have functions that can compute arbitrary values--just predicates that can be true or false. A Prolog system can, however, simulate functions by allowing you to query it about what the possible values are that would need to be plugged in to one or more argument positions of any given predicate in order to make it evaluate to "true". You can specify "input" values for whatever arguments you want, and for whatever arguments you leave unspecified, the Prolog system will give you a set of all possible values of those variables that satisfy the predicate as "output". Since Prolog is based on first-order logic, the exact same transformation for simulating functions works for modelling non-intersective adjectives in a predicate logic model for formal semantics.

So, non-intersective adjectives can be modeled as two-place predicates (with one input argument and one output argument) that specify the relation between the actual final referent of a noun phrase and the thing-that-it-isn't. Plus some mathematical machinery to glue it all together. That insight will allow us to add the capacity for translating non-intersective adjectives into our monocategorial language. I say "translate" because, being monocategorial, the language does not have a distinct class of "adjectives" to add non-intersective members to. Instead, it will have "non-intersective nouns" (or "non-intersective noun-jectives").

Introducing that machinery into our monocategorial language requires a little bit of updating to the existing interpretation rules. The altered syntactic rules are as follows:

[|P: w P|] = λx.λy.λz.[|w|](x, y, z, [|P|])
[|P: w ,|] = λx.λy.λz. [|w|](x, y, z, λx.λy.λz. y ⊆ z & ∃r. y ⊆ {z : ∃e. e ∈ x & r(e, z)})

Essentially, rather than immediately evaluating the denotation of the current word and the rest of the phrase with the same arguments, we pass the denotation of the rest of the phrase into the semantic function for the current word, which will allow the lexical semantics of a word to control what arguments are given to the rest of the phrase. At the end of the phrase, we pass in the "default" expressions that account for the possibility that no explicit quantifier or relation words were present. Note also that I have introduced the comma-separated argument list notation as "sugar" for repeated application of a curried function, since the large number of parameters to our lexical semantic level has started to become unwieldy.

Of course, since we've changed the lexical semantic interface in the syntactic interpretation rules, we have to also update the templates for our lexical semantic classes. The existing classes are updated as follows:

a) λx.λy.λz.λp. z ⊆ red & p(x, y, z)
b) λx.λy.λz.λp. y ⊆ {w : ∃e. e ∈ x & ag(e, w)} & p(x, y, z)
c) λx.λy.λz.λp. x ⊆ run & p(x, y, z)
d) λx.λy.λz.λp. x = y & p(x, y, z)
e) λx.λy.λz.λp. |y| > |z - y| & p(x, y, z)

In every case, we simply pass along all the original arguments directly to the semantic function for the remainder of the phrase, and logically conjoin it to the original lexical semantic expression. However, we now have the option of messing with those arguments if we so please; thus, we can introduce an additional semantic class for non-intersectives:

f) λx.λy.λz.λp.
        y ⊆ z & ∃r. y ⊆ {z : ∃e. e ∈ x & r(e, z)} &
        ∃x'.∃y'.∃z'. z ⊆ {a : ∃b. b & ∈ y' & former(a, b)} &
        p(x', y', z')

There's a lot going on here, but most of it is just book-keeping boilerplate. Let's break it down:
First, we cleanly terminate the description of the current referent; by the time we get to the end of the phrase, we won't be talking about the same thing anymore, so we have to throw in all the "just-in-case" assertions (that the referent set is some subset of the quantifier base and that it is has some relation to the sentential event) in here as well. In the next line, we assert the existence of a new quantifier base and a new referent set (z' and y', respectively) and, crucially, a new event x'--because if we're talking about a "former basketball player", then the "basketball player" which-he-isn't doesn't have any relation to this clause's event, so we have to replace it with something else. We then assert that all members of the current quantifier base have a specific relationship (in this case, "former") to some member of the new referent set. And finally, we use the rest of the phrase, denoted by p, to describe the new referent and new event.

The addition of this mechanism to the language has a few interesting long-range consequences. The most obvious is that word order actually matters. Up until now, we could've cheated on the phrase-structure rule and just said P → w w* , using the Kleene star operator for arbitrary repetition, instead of P → w P | w ,; but now, the fact that later words are in smaller phrase embedded at a lower syntactic level than previous words is very significant. Changing the ordering of words around a non-intersective noun can change which referent those words are actually describing. Similar effects are present in English; a "former blue car", for example, is not necessarily the same thing as a "blue former car". The first one may still be a car, but of a different color, while the second is definitely no longer a car, but definitely is blue.

Note that while syntax now encodes new information in word order about referent scope, the syntactic rules no longer encode information about logical connectives; the implicit conjunction of all lexical items is now a function of lexical semantics instead. We could consider this an accidental artifact of the formal framework we're using, but we might also come back to it later and exploit the lexification of logical connectives to come up with some new lexical semantic classes.

The second long-range consequence is that class-c words now have a real essential function; in the beginning of a phrase, prior to any non-intersectives, they are essentially adverbs, unconnected to the phrasal referent, which can float between phrases with no change in sentential meaning. After an intersective, however, they no longer act on the clausal event. Instead, they describe some event that the new referent is a participant in. The same applies to class-b and -d relation words.

Negative Scopes

Most non-intersectives have an implicit "not" built in to them. A "former basketball player" is not a "basketball player", a "fake Picasso" is not a "Picasso", and while an "alleged thief" might be a "thief", he also might not. And it turns out that with the interpretive machinery we've built so far, we can actually translate "not" as a non-intersective noun with the following lexical semantics:

not: λx.λy.λz.λp.
        y ⊆ z & ∃r. y ⊆ {z : ∃e. e ∈ x & r(e, z)} &
        ∃x'.∃y'.∃z'. z ∪ y' = {} &
        p(x', y', z')

I.e., "the relation between the quantifier base for the current referent set and the new referent set is that they have no elements in common".[1]

We can thus expect all non-intersectives to behave somehow similarly to negatives in the behavior they trigger in lower scopes.[2] This gives us a possible use for semantically-significant stress focus, in addition to the rising-falling intonation patterns that are used to denote phrase and sentence boundaries. We can use stress focus to indicate the specific reason that a referent "is not" something else. Referring to a previous example, the ambiguity of "former blue car" can be resolved by stating that it is either a "former blue car" or a "former blue car"--indicating that the reason the item in question is "former" is because it is no longer "blue" in the first case and no longer a "car" in the second.

More traditionally, we might want to make some special accommodations for phrases that are described by monotone-decreasing quantifiers, like "no" or "few", which are also "negative", in a slightly different way. Perhaps the "reason" for a decreasing quantifier can also be indicated by stress focus (do "few men work" or do "few men work"?) The practical impact of that level of ambiguity ("does this instance of focus refer to the quantifier or the non-intersective scope?") is likely to be minimal.

In either case, this will already be a very long blog post, so updating the syntax to recognize focused items is left as an exercise for the reader.

The Weird Ones

Non-intersective nouns, it turns out, don't have to be used only to translate what English encodes as non-intersective adjectives. They're just words that specify some arbitrary not-necessarily-intersecting relationship between the quantifier base for one referent set, and some other referent set. Y'know what else acts like that? Adnominal adpositions. E.g., prepositions that describe noun phrases. Also, genitives (for which English can use the preposition "of", but doesn't always).

Wanna say "Bob's cat climbs trees" in monocategorial form? "Cat agent of Bob, tree theme, climb event." The word "of" ends up as a non-intersective noun! Crazy! Incidentally, its semantics are as follows:

of: λx.λy.λz.λp.
        y ⊆ z & ∃r. y ⊆ {z : ∃e. e ∈ x & r(e, z)} &
        ∃x'.∃y'.∃z'. z ⊆ {a : ∃b. b & ∈ y' & ∃r. r(a, b)}
        p(x', y', z')

I.e., "all members of this quantifier base have some kind of relation with some member of the new referent set".

And there are all sorts of normal English nouns that entail a relationship to some other unspecified referent. "Father", for example. A "father" cannot exist without a child, so the concept of "father is naturally expressed in terms of a two-place predicate... which will be embedded inside the machinery for non-intersectives to allow describing both halves of the relationship, should you so desire[3]. So, "Bob's father build's houses"? In monocategorial form, it's "Agent father Bob, many house patient, build event". Note that in this case, the word order in the phrase "Agent father Bob" is critical. If we swap things around, we get the following different readings:

"father agent Bob": "Bob-who-does-something's father is somehow involved"
"Bob father agent": "Bob, who is the father of someone who does something, is somehow involved"
"Bob agent father": "Bob, who is a father, is the agent (builds houses)"

And if we want to cover both sides of the relationship at the same time: "John agent father Bob, many house patient, build event" ("Bob's father, John, builds houses.")

[1] Note that this is not the same as a translation for "no", the negative quantifier, which is addressed a little further down the page. This sort of "not" means "I'm talking a referent that is identified by not being that other thing", as opposed to saying "no referents of this description are involved in the action".
[2] While similar, this is actually not the same thing as the "negative scopes" that license negative polarity items like "anymore" in English. Those are a feature of the behavior of certain quantifiers, like the negative quantifier "no" described in [1].
[3] WSL encodes these kinds of nouns as Roles. When we get back to the semantic model for WSL in a later post, we'll see the utility of a productive morphological derivation system to turn Roles into non-intersective Nouns and vice-versa.