Converting MRS output to a logical form

OK, I’m really new to Linguistics and NL* (but not software engineering in general), so I’m sorry if this is naive: I’m trying to do a logic based analysis on English sentences using the MRS output of the ERG.

Currently, I’m just trying to convert the MRS output for a sentence into any logical (or semi-logical) form to get my head around the problem. I would appreciate any pointers to docs that describe how to do this, or how someone did it, in any domain.

Here’s where I’ve gotten and some issues I’ve had to illustrate what I’m looking for:

Producing Valid Trees from the MRS
I believe I am now currently putting together all valid forms of an MRS tree, in a predicate logic “ish” form:

Where are you?

pronoun_q(x5, which_q(x4, place_n(x4), pron(x5)), loc_nonsp(e3, x5, x4))
which_q(x4, place_n(x4), pronoun_q(x5, pron(x5), loc_nonsp(e3, x5, x4)))
which_q(x4, pronoun_q(x5, pron(x5), place_n(x4)), loc_nonsp(e3, x5, x4))
pronoun_q(x5, pron(x5), which_q(x4, place_n(x4), loc_nonsp(e3, x5, x4)))

First Issue: Logical form of General Qualifier Predicates
I’m now trying to drill down on implementing the predicates. What I really need is a definition of what each quantifier predicate is doing logically. I.e. the classic “Everyone” predicate might be defined like this:

Everyone -> {X : a ∈ X}

My assumption (probably wrong) is that the quantifier predicates (the ones with RSTR and BODY) each represent a Generalized Quantifier which has a formal logic function of some kind and the people writing the rules of the grammar are effectively converting utterances into a structure that uses these to represent the logical form of the utterance.

Maybe all of these predicates just represent Generalized Quantifier forms that are “just known” in the linguistics community and listed in a bunch of academic publications? If so, I’d love any pointers you have to a good source that might compile them up as a reference…

Second Issue: evaluating Generalized Quantifier predicates
My (possibly very naive) confusion is in understanding how the scoping of quantifiers works. For a statement like this:

pronoun_q(x5, pron(x5), which_q(x4, place_n(x4), loc_nonsp(e3, x5, x4)))

I believe I should process the “pronoun_q” predicate (conceptually) like this:

  1. Start with the entire universe of things in x5.
  2. Restrict x5 down to be just those that have the property “pron”.
  3. Run the quantifier “pronoun_q” on that set to produce a quantified set by doing…whatever pronoun_q does…and place that into x5
  4. Finally, use the value of x5 in the body of the quantifier wherever that variable is specified.

If I’m just way off base with this, I’d love any pointers that will help me understand better.

Assuming I’m basically on the right track, I’m struggling with how to process the “which_q” predicate of this one:

pronoun_q(x5, which_q(x4, place_n(x4), pron(x5)), loc_nonsp(e3, x5, x4))

For this case, processing the restriction, place_n(x4), and the predicate, which_q, proceeds as before. But: I don’t understand how to think about the body since it doesn’t include the x4 variable in it at all. Does that mean it is simply not affected by the RSTR?

Again, could be way off track here, I’m swapping in a lot of background…

Sorry for the long post, appreciate any pointers in the right direction!

Hi Eric – part of what’s going on here is that every x-type variable must be bound by some quantifier. This means we have to put in quantifiers for pronouns, which is what pronoun_q is. You can think of it as a species of existential quantifier. which_q goes with wh question words (here where) and indicates that this is a parameter of a wh question.

It looks like we haven’t yet drafted the Quantifiers page of the ERG Semantics documentation (, but that’s where this information should be.

One quick point: x4 is in the body. It’s the third argument of loc_nonsp. There is a bit of documentation for that one:

Very helpful, thanks @ebender. To your last point, I was confused about how to evaluate the “which_q” quantifier, not the “pronoun_q” quantifier. I.e.:

pronoun_q(x5, which_q(x4, place_n(x4), pron(x5)), loc_nonsp(e3, x5, x4))

            which_q(x4, place_n(x4), pron(x5))

x4 isn’t in the body of “which_q”, so I’m trying to wrap my head around how to evaluate it. Maybe I’m messing up the order of operations in how I’m interpreting things?

You are not enumerating the scoped MRS trees correctly. One of the requirements of any logical formula (and made explicit in the MRS paper’s discussion of the relationship between MRS and scope-resolved LFs) is that any appearance of a variable in a (sub)formula must be outscoped by the quantifier that binds that variable. This does not hold for two of your LFs, namely the ones in which you put the second quantifier inside the restriction of the first quantifier. The main assertion of the sentence (loc_nonsp) refers to both x4 and x5, and so it has to be outscoped by both quantifiers. As you already noticed, the interpretation is somewhat clearer for the other two LFs, which are the valid ones.

The actual interpretation of the generalized quantifiers that the ERG produces is considered beyond the scope of the grammar. ERG considers its main job to be describing and operationalizing the relationship between surface form and predicate-argument structure, rather than lexical semantics, so you will find quantifiers like most_q, no_q, every_q, some_q, and a host of others, of which some have “generally accepted” interpretations among semanticists and many don’t.

Ahhh. Perfect. Thank you! I thought that filling unbound handles (holes) with top level “floating” handles when they fulfilled the hcons was enough to guarantee a valid tree. I guess i missed that extra step. Or maybe i just have a bug in my code.

Also thanks for clarifying the approach to predicates.

If you are doing this yourself, I want to make sure you’re aware of the LKB’s ability to do this as well. If you parse something with the LKB then from a parse tree select “Scoped MRS”, you’ll get exactly the 2 (valid) scopes that you listed (in exactly the same format, too, which makes me surprised if you aren’t already using the LKB for this). There’s also a “FOL approximation” option but it is not currently working for me (with LKB-FOS).

And if you happen to be coding in Python and want to see your code merged into PyDelphin, I’d be happy to help with that process. There’s a scope module, but it doesn’t enumerate fully-scoped MRSs yet. I had a partially working scope resolver some time ago, then my wife and I had twins and priorities were shifted. I have some notes in issues #241 and #221.

1 Like

I’m afraid I don’t know what’s wrong with the LKB’s “FOL approximation”. I’m seeing the same behaviour in the ‘classic’ LKB as LKB-FOS. Some sentences do get some sort of output, e.g. “Every farmer owns a donkey.” but others don’t. It seems there are problems if a sentence contains pronouns, proper names, bare NPs, or numerals as determiners.

I don’t believe the FOL approximation could ever have worked for
arbitrary sentences - lots of examples don’t have a FOL
interpretation. One could push this further - e.g., simply by
making the udef_q that one finds in bare NPs (and numerals as
determiners) equivalent to an existential, as well as pronoun_q
But this presupposes that the FOL has a structure on the variables
similar to that proposed by Link, so it’s not any version of
classical FOL. And obviously this isn’t the correct analysis for
many cases of bare plurals. As far as I remember, when I did it
originally, I didn’t want to introduce any complications of that
sort - it was just an illustration for the classical FOL examples.

All best,


1 Like

Yes, I see. The code in src/tproving/qq-to-fol.lsp doesn’t attempt to deal with udef_q, pronoun_q or proper_q. Perhaps I could add a warning to the FOL approximation if any of these are encountered. If one wanted to hack around this, then the functions to look at are gq-quantifier-exp-p and convert-gq-quantifier.

1 Like

No, of course, there are many more quantifiers that are not processed than just the three I mentioned, so any check would have to be more sophisticated.

I am doing this myself @goodmami, in Python using PyDelphin at the moment. Once I get it working I’ll write up a blog entry on it and see if there is any code worth putting into PyDelphin. Thanks for the offer to help!

I haven’t installed and messed around in the LKB yet. That’s in the queue…

Hi @AnnC, what is that? What is Link? I wonder if we may have a possible interpretation in high order logics such as Or… something in the opposite direction, to a less expressive language such as description logics (as somehow suggested by D. Crouch, C. Condoravdi, V. de Paiva, R. Stolle, and D. G. Bobrow, “Entailment, Intensionality and Text Understanding,”, 2003)

Do you know about any work exploring those alternatives?

Hi Alexandre,

I’m afraid I have no time at the moment, so can only respond briefly and generally. MRS isn’t a logic in its own right. I’d call it a metalanguage, though others might object. It is designed to do composition naturally and to be very close to natural language structure. In principle, it can be translated into many actual logics. If you’re interested in doing this for a particular logic, you could just have a look at some examples in that logic and in MRS and see how they work. The point would be to see whether it can be translated fully automatically, if one has the right rules, and perhaps to look at alternative syntaxes that might make things easier.

To cut a very very long story ridiculously short - there is no existing logic which is adequate for all the phenomena of natural language - I think there may be individual logics that can potentially capture all the individual phenomena that have been studied (though the semantics journals are basically full of papers of the type: here’s phenomena X, this translation into some logic has been suggested but doesn’t work, here’s my translation - these days they often give up on compositionality, which is sad …). But these logics don’t work out as a single well-behaved logic. So we’re always going to lose something when we move from natural language to a logic, whether via MRS or not. If you use a description logic, you’ll lose a lot more because you can’t say anything about individuals - that may or may not matter for what you’re trying to do.

In terms of examples of translation of MRS into something else - I did it for FOPC for a fragment, and Dan and colleagues must have done that much more extensively, I assume. David Schlangen did it for DRT in his thesis (which was a long time ago - can’t remember when). I don’t know whether anyone else has tried it.

One of the most fundamental issues about logics is whether one assumes any structure on the individuals or not. We implicitly assume that we do have structure in MRS - it’s not to say that one couldn’t translate to a logic that didn’t do it, but there would be lots of machinery. Link is known as the person who did this for plurals - the classic paper is Link (1983) but it’s almost completely incomprehensible, so if you want to look this stuff up, look at a textbook - it’s discussed in the DRT book for instance (Kamp and Reyle).

But maybe someone else can recommend a better starting point? Perhaps the Bender and Lascarides book, which I am afraid I have not looked at yet?

All this said - if I were to work on this again, I would start from DMRS. This captures the compositional aspects without imposing any variables. This matters for event(uality) variables in particular - I tried to indicate that in a talk at DELPH-IN in Paris (I guess).

Best wishes,


1 Like

In Bender & Lascarides, we don’t have anything like a tutorial on how to take MRS or other underspecified meaning representations into logical forms, but I think that reading it might help situate MRS with respect to logic and with respect to other aspects of meaning…

This is the book Ann is referring to:

For those affiliated with academic institutions, always check your library first. The publisher’s model is that if a library subscribes, their members can download a copy to keep (for free).

1 Like

Thank you @AnnC and @ebender! The “…captures the compositional aspects without imposing any variables…” part is still a mystery for me. We have already discussed them in other threads… but it is still not clear to me why variables are so unwanted! But I found

Easier than packing (R)MRS because no variables, so no variable (re)naming.

in the @AnnC presentation So maybe in the end it is a manner of efficiency, not expressivity or adequacy.

But I will wait for making more questions about the (failure?!) of logic-based representations after reading Emily’s book.

in thie context of this discussion, it’s just more flexible if one doesn’t have variables, since one can perfectly well express semantic compositionality without them and different approaches to representation make different assumptions, for instance about event variables. If *MRS is a meta-language, it’s better to be as non-commital as possible.

1 Like

Very timely @arademaker! I am just getting ready to post a few blog posts on the approach that I ended up using to execute the output of MRS in Prolog. I’ll put a link here when it is ready (ETA end of this week). As a teaser: It’ll have a prototype that you can try out to evaluate how well you think it works in practice too!

@arademaker, it took me a bit longer than expected but I finally published the demo and writeup of the approach I used to logically execute the MRS predicates. Let me know if you have questions!

@AnnC and @EBender: I’d be very curious on your thoughts on what I’ve done. Is it anything like other attempts to “run the MRS meta-language”?

1 Like