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

Experience from countries vs capitals #61

Open
bvssvni opened this issue Oct 6, 2020 · 0 comments
Open

Experience from countries vs capitals #61

bvssvni opened this issue Oct 6, 2020 · 0 comments

Comments

@bvssvni
Copy link
Contributor

bvssvni commented Oct 6, 2020

I find that Avatar Logic is capable of capturing nuances that otherwise might be hard to reason about:

  • Most countries have a distinct city as capital
  • Some countries have themselves as capital (e.g. Luxembourg)
  • Some countries have multiple capitals (e.g. South-Africa)

When a country has a capital, the capital has the country, but by using pairs one can automatically get "is" when possible in addition to "has":

(X, Y) :- (Y, X), Y : country, X : capital.

When a distinct city is a capital, I use the role:

<city> : capital

When a country has itself as capital:

uniq capital
capital'(<city>) : capital

This does not collide with capital as a role, because capital(x) does not imply a unique value. It is the pair (x, capital'(y)) which implies a unique value.

When a country has multiple capitals, I use another non-unique 1-avatar capitals:

capitals'(<city>) : capital

There is also a country (Switzerland) that claims to have no capital, but which has a "de facto" capital. One can use a unique 1-avatar de_facto_capital'(<capital>) such that capital(<country>) = de_facto_capital'(<capital>) but not capital(<country>) = <capital>. However, (<capital>, <country>) works by lifting out of the 1-avatar:

uniq de_facto_capital
(X, Y) :- (de_facto_capital'(X), Y), Y : country.

When two countries claim the same capital, one can use a non-unique 1-avatar territory'(<country>) with a lifting of the equality, not the pair, to make capital(<country>) substitute with the capital:

capital(X) = Y :- capital(territory'(X)) = Y.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant