I am trying to express into formal semantics the first programming problem of 2019 ICPC contest (https://icpc.global/worldfinals/problems) and this problem contains text: The first line of input contains an integer n (1 ≤ n ≤ 5 · 105, I specifically trying to express phrase The first line of input contains an integer.

My solution is that there are separate noun phrase The first line which can be expressed as is_in_order(line, 1) and separate noun phrase NP of input, which is simple relation belongs(NP, input) and the combination leads to the final code:

Exists.l: is(l, line) & is_in_order(l, 1) & belongs(l, input)

But I am uneasy about this solution, because it seems to me that first (is_in_order) should somehow already establish relation to input. But such combination of meanings can be processed in the (next) pragmatic layer of processing, and let the semantic processing do the grammatical things only.

So - my question is about the semantics of ordinal numbers - are they form the simple noune phrase in which the ordinal number acts as adjective (The first line), or the grammatical syntac and the formal semantics requires the specification of the context as well, i.e. this is more like ternary function semantically belongs_to_the_ordered_list(line, 1, input), that grammatically is ternary (3-ary) function as well?

I don't know whether there exists already established practice of grammatical and semantical handling of ordinal number phrases in English, or this is open for discussion. So, what is the right way to semanticall parse the phrase with ordinal number The first line of input.

  • 3
    I no nothing about the formal process your describing, but I would have assumed "first line of input" would be processed as "first ( (line) of input )", with the "of input" applied before first, not alongside or after it. After all, we don't want "the first line, but discard if it's not input"; we want "the first line, having filtered to only input lines".
    – IMSoP
    Nov 20, 2021 at 10:39


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.