Have an account? Sign in

Last updated 2 months ago

Contents

The purpose of an term is to compute pairs that constitute a relation. We use operators to assemble terms from smaller terms, to express in formal language precisely what is meant in the natural language of the business. The smallest term is a single relation.

An term is a combination of operators and relations. Its meaning is a set of pairs, which is in fact a newly created relation.

`owner`

`r;s~`

`I /\ goalkeeper;goalkeeper~`

`destination;"Algarve" |- spoken;"Portugese"`

Every term is built out of relations, which are combined by operators. An term has one of the following 8 syntactic structures

<Term> <BinaryOperator> <Term><UnaryOpPre> <Term><Term> <UnaryOpPost><RelationRef> <signature>?I <signature>?V <signature>?<atom>( <Term> )

The operators come in families. We advise novices to study only the rule operators, boolean operators and relational operators. There is a wealth of things you can express with just these operators. The residual operators seem a lot harder to learn and the Kleene operators are not fully implemented yet. You can click the hyperlink to navigate to the semantics of each family.

Family | binary operators | binding power | unary operators | binding power |

rules | â€‹$=$ and â€‹ | 1 (weakest) | â€‹ | â€‹ |

â€‹booleanâ€‹ | â€‹$\cup$, $\cap$, and $-$â€‹ | 2 | â€‹â€‹ | 5 |

â€‹relationalâ€‹ | â€‹$;$, $\times$, and $\dagger$â€‹ | 4 | â€‹$\smallsmile$â€‹ | 5 |

â€‹residualâ€‹ | â€‹$\backslash$, $/$, and $â™¢$â€‹ | 3 | â€‹ | â€‹ |

Kleene | â€‹ | â€‹ | â€‹$âˆ—$ and $+$â€‹ | 5 |

Operators with different binding power may be used in the same term without brackets, because the binding power tells how it is interpreted. For example $r\cap s;t$ means $r\cap(s;t)$ because $;$ has a higher binding power than $\cap$.

Operators with the same binding power must be used unambiguously. For example: $r\cap(s-t)$ means something different than $(r\cap s)-t$. In such cases Ampersand insists on the use of brackets, so readers without knowledge of the binding powers of the operators can read a term unambiguously.

Repeated uses of an associative operator does not require brackets. So $r\cap s \cap t$ is allowed because $\cap$ is associative.

When coding in Ampersand, these operators are typed with characters on the keyboard. The following table shows the operators in math and their equivalent in code:

operator name | code | math | remark | â€‹ |

equivalence (equal) |
| â€‹$=$â€‹ | â€‹ | â€‹ |

inclusion | ` | -` | â€‹$\subseteq$â€‹ | â€‹ |

intersect |
| â€‹$âˆ©$â€‹ | associative | â€‹ |

union |
| â€‹$âˆª$â€‹ | associative | â€‹ |

difference (minus) |
| â€‹$-$â€‹ | â€‹ | â€‹ |

complement |
| â€‹â€‹ | in code: Prefix; in math: Overline | â€‹ |

compose |
| â€‹$;$â€‹ | associative | â€‹ |

converse (flip) |
| â€‹$\smallsmile$â€‹ | postfix | â€‹ |

left residual |
| â€‹$/$â€‹ | â€‹ | â€‹ |

right residual |
| â€‹$\backslash$â€‹ | â€‹ | â€‹ |

diamond |
| â€‹$â™¢$â€‹ | â€‹ | â€‹ |

relational product |
| â€‹$â€$â€‹ | associative | â€‹ |

cartesian product |
| â€‹$\times$â€‹ | â€‹ | â€‹ |

reflexive transitive closure |
| â€‹$âˆ—$â€‹ | postfix | â€‹ |

transitive closure |
| â€‹$+$â€‹ | postfix | â€‹ |