arrow-left

All pages
gitbookPowered by GitBook
1 of 5

Loading...

Loading...

Loading...

Loading...

Loading...

Boolean operators in natural language

hashtag
Purpose of boolean operators

To say things such as pair ("peter","macbook") is either in relation ownsa or wantsa, requires us to use boolean operators ∪\cup ∪, ∩\cap∩, and −- − .

hashtag
Meaning

Let us explain the meaning of relational operators , , and by means of examples.

Assume we have a relation, ownsa[Person*LaptopType], which contains the persons who own a particular type of laptop. A fact "peter" ownsa "macbook" means that Peter owns a MacBook.

Also assume another relation wantsa[Person*LaptopType], which contains the persons who want a particular type of laptop. A fact "peter" wantsa "macbook" means that Peter wants a MacBook.

hashtag
Union

The sentence: "Peter owns a MacBook or Peter wants a MacBook." is represented as "peter" (ownsa wantsa) "macbook".

hashtag
Intersection

The sentence: "Peter owns a MacBook and Peter wants a MacBook." is represented as "peter" (label colour) "macbook".

hashtag
Difference

The sentence: "Peter owns a MacBook and Peter does not want a MacBook." is represented as "peter" (label colour) "macbook".

hashtag
Natural language templates

There is a pattern to this. A computer can generate a literal translation from the formula to natural language. However, that translation looks clumsy, verbose and elaborate. It is up to you to turn that in normal language. For examples . The systematic translation is given in the following table:

hashtag
Other explanation

Would you like a different explanation of the relational operators? explains the boolean operators in terms of set theory. An explanation in logic is given . for some algebraic rules about boolean operators. If you want to see it explained visually in Venn-diagrams, .

∪\cup ∪
∩\cap∩
−- −
∪\cup∪
∩\cap∩
−-−

Formally

Natural language template

a (r∪s) ba\ (r\cup s)\ ba (r∪s) b

a r b or a s b.

a (r∩s) ba\ (r\cap s)\ ba (r∩s) b

a r b and a s b.

a (r−s) ba\ (r-s)\ ba (r−s) b

a r b and nota s b.

click herearrow-up-right
This page
here
Click here
click here

Relational operators in natural language

hashtag
Purpose of relational operators

To say things such as "the name of the owner", we want to string together multiple relations (viz. name and owner). Relational operators allow us to make such statements.

hashtag
Meaning

The meaning of relational operators and is best explained by means of examples.

Assume we have a relation, label[Contract*Colour], which contains the colour of labels on contracts. A fact "1834" label "blue" means that contract 1834 has a blue label.

Also assume another relation stored[Contract*Location], which gives the location where a contract is stored. Fact "1834" store "cabinet 42" means that contract 1834 is stored in cabinet 42.

hashtag
Converse

A relation can be altered by swapping the elements of every pair in the relation. Mathematically, is a different from . In natural language, however, the meaning does not change. So if"1834" label "blue" means that contract 1834 has a blue label, "blue" label~ "1834" also means that contract 1834 has a blue label.

  • The sentence: "All contracts with a blue label are stored in cabinet 42." is represented as "blue" (label\stored) "cabinet 42". Literally it says: For every contract, if it has a blue label, then it is stored in cabinet 42.

hashtag
Composition

The sentence "A contract with a blue label is stored in cabinet 42." can be represented as "blue" (label~;stored) "cabinet 42". Literally it says: There is a contract that has a blue label and is stored in cabinet 42.

hashtag
Natural language templates

There is a pattern to this. A computer can generate a literal translation from the formula to natural language. However, that translation looks clumsy, verbose and elaborate. It is up to you to turn that in normal language. For examples . The systematic translation is given in the following table:

The natural language translation for b r~ ais the same as language translation for a r b.

hashtag
Other explanation

Would you like a different explanation of the relational operators? explains the relational operators in terms of set theory. An explanation in logic is given . for some algebraic rules about relational operators.

⌣\smallsmile⌣
;;;
(a,b)(a, b)(a,b)
(b,a)(b,a)(b,a)

Formally

Natural language template

a (r;s) b

There exists an x : if a r xthen x s b.

b r~ a

a r b.

click herearrow-up-right
This page
here
Click here

Semantics in natural language

Primitive terms in natural language

hashtag
Relations

When a relation is used in a term, it stands for a set of facts that are assumed true on the current time in the current context. Those facts (also referred to as the contents or the population of the relation) can change over time as users add or delete facts from it.

When a relation is used in a term, we can simply use its name if that is unambiguous. For instance the name owner refers to RELATION owner[Person*Building] if that is the only relation the ampersand-compiler can link it to. In some cases, however the name alone is ambiguous. For example if there are two relations with the same name and different signatures. In such cases Ampersand will try to infer the type from the context. That however does not always succeed. In such cases, Ampersand generates an error message that asks you to remove the ambiguity by adding the correct type.

If a pair is an element of a relation , we write to denote the fact. It means that we consider to be true (within the current context).

hashtag
Identity

Every atom in a concept identifies itself. If for example concept "Person" contains atoms {"Ann", "Bob", "Cecil"}, "Ann" identifies "Ann", "Bob" identifies "Bob", and "Cecil" identifies "Cecil". This makes "Ann" and "Bob" different atoms (unequal).

hashtag
Other explanation

Would you like a different explanation of the primitive terms? explains the primitive terms in logic. for the explanation in set theory.

(a,b)(a,b)(a,b)
rrr
a r ba\ r\ ba r b
a r ba\ r\ ba r b
CCC
This page
Click here

Residual operators in natural language

The meaning of residual operators ///, \\backslash\, and â‹„\diamondâ‹„ is best explained by means of examples.

Assume we have a relation, label[Contract*Colour], which contains the colour of labels on contracts. A fact "1834" label "blue" means that contract 1834 has a blue label.

Also assume another relation stored[Contract*Location], which gives the location where a contract is stored. Fact "1834" store "cabinet 42" means that contract 1834 is stored in cabinet 42.

  • The sentence: "All contracts with a blue label are stored in cabinet 42." is represented as "blue" (label\stored) "cabinet 42". Literally it says: For every contract, if it has a blue label, then it is stored in cabinet 42.

  • The sentence: "All contracts that are stored in cabinet 42 have a blue label." is represented as "blue" (label~/stored~) "cabinet 42". Literally it says: For every contract, if it is stored in cabinet 42, then it has a blue label.

  • The sentence: "All blue labeled contracts and no others are stored in cabinet 42." is represented as "blue" (label~<>stored) "cabinet 42". Literally it says: For every contract, if it has a blue label, then it is stored in cabinet 42 and if it is stored in cabinet 42, then it has a blue label.

hashtag
Natural language templates

There is a pattern to this. A computer can generate a literal translation from the formula to natural language. However, that translation looks clumsy, verbose and elaborate. It is up to you to turn that in normal language. For examples . The systematic translation is given in the following table:

hashtag
Other explanation

Would you like a different explanation of the residual operators? explains them in logic. for visualized examples about residual operators.

Formally

Natural language template

a (r\s) b

For every x: if x r athen x s b.

a (r/s) b

For every x: if b s x then a r x.

a (r<>s) b

For every x: if a r x then x s b and if x s b then a r x.

click here
This page
Click here