Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Background information about variants #36

Open
heatherleaf opened this issue Mar 8, 2019 · 0 comments
Open

Background information about variants #36

heatherleaf opened this issue Mar 8, 2019 · 0 comments
Labels
wontfix This will not be worked on

Comments

@heatherleaf
Copy link
Member

Note: this is not an issue per se, but instead background information about the semantics of variants. I will reference this issue in some later issues which contain actual suggestions.

There are two possible formal semantics for the disjunction (called variants in GF). In sections 5.2 and 5.3 of my thesis I call them "intensional" and "extensional" disjunction (https://gup.ub.gu.se/file/207628):

1. Intensional disjunction

Intensional disjunction is formally just a shorthand for defining a number of GF functions. This means that we can "push out" variants to the top-level of a linearization. So this definition:

lin f = {a = "a"; b = variants{"b1" ; "b2"}}

becomes the same as this:

lin f = variants{ {a="a"; b="b1"} ; {a="a"; b="b2"} }

which is semantically equivalent to this:

lin f1 = {a="a"; b="b1"}
lin f2 = {a="a"; b="b2"}

This is the disjunction that is implemented in GF since a couple of years.

  • The main advantage is of course that the current parser works for this semantics.

  • One drawback is that the size of the grammar can explode - for each disjunction the number of linearizations for that function doubles, so if you have a function with 10 constituents (i.e., a record with 10 labels), and every constituent contains one disjunction (i.e., variants{s1;s2}), then the function will have 210 = 1000 different linearizations. (With 20 record label, the function will have 220 = 1 million linearizations)

  • Another drawback is that variants{} becomes practically useless - as soon as you put it anywhere in you linearization, the function will have no linearizations at all. This is because {a = "a"; b = variants{}} is the same as variants{} according to the intensional semantics.

2. Extensional disjunction

Extensional disjunction is set union. This requires that GF linearizes syntax trees to sets of linearizations. The effect of this is that disjunctions cannot be pushed to the top-level (at least not in all cases). The formal difference with intensional disjunction is that reduplication behaves differently -- read more in my thesis if you want to know why.

  • The main drawback is that GF's current parsing algorithm (implemented by Krasimir) cannot handle extensional disjunction correctly. I don't know how difficult it is to change.

  • But the main advantage is that variants{} becomes useful: Formally, under this semantics variants{} is equivalent to a dummy element of the correct type.

Actually, this was the semantics that was implemented in GF until some years ago.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

1 participant