Properly constrain the length of the append list

How do I properly say that the length of an append list is at most 1? (That’s possible, isn’t it?)

I tried:

clause :+ [ SYNSEM.NON-LOCAL.QUE.LIST 0-1-list ].

But this led to a bug (which makes sense because @guyemerson had said using these types will lead to bugs in append lists, I think) .

Update: While I’d still be interested in an answer to the question in the first post, what I will actually do instead (after talking to Emily) is not constrain clause and deal with the filler-gap and the in situ question phrases separately. I think that the solution with the 0-1-list was in fact not working correctly anyway, and in fact was preventing some of good trees from materializing.

Yes, it’s fine to use 0-1-list. The value of LIST is just list, so you can use whatever subtypes of list you want.

The bug comes not from constraining the length, but from trying to append to that list. Note the error message: “Unification of LIST-COPY and 1-LIST failed”. So there is no common subtype of list-copy and 1-list. This is an oversight on my part – when I wrote the wrapper-type grammar, I didn’t check all list subtypes.

The general solution is: if you have a special subtype of list (such as 0-1-list and 1-list), then you need to create additional subtypes so that these can be unified with list-copy, cons-copy, or null-copy, as appropriate. In this case, the simplest fix is to add:

; Minimal bug fix
1-list-copy := 1-list & cons-copy.

I say “simplest fix”, because it’s only one line – but this will require some glb types. To help with debugging lists, I think it’s best to write all the glb types explicitly, so that they are nicely named. The normal list hierarchy including 0-1-list is the following (where I’m suppressing type constraints):

; normal list hierarchy
list := avm.
cons := list & [...].
0-1-list := list.
1-list := 0-1-list & cons & [...].
null := 0-1-list.

So we need a -copy subtype of each of these, as shown below. In each case, the additional supertypes mirror the hierarchy above – e.g. 1-list has two supertypes (0-1-list and cons), so 1-list-copy has two additional supertypes (0-1-list-copy and cons-copy):

; -copy subhierarchy
list-copy := list & [...].
cons-copy := cons & list-copy & [...].
0-1-list-copy := 0-1-list & list-copy.
1-list-copy := 1-list & 0-1-list-copy & cons-copy.
null-copy := null & 0-1-list-copy & [...].

So a more careful bugfix means adding two additional types (0-1-list-copy and 1-list-copy above), and modifying the supertypes of null-copy (changing list-copy to 0-1-list-copy).

1 Like