Inference#

A very simple example of a Meson script (not the simplest possible, but close) is as follows:

A, so B.

and the graph produced by this first example looks like this:

../../_images/AsoB.png

In fact, the punctuation symbols ,;. have no effect in Meson, and neither does capitalisation of the keywords. This is so you can make a Meson script look like it’s written in proper sentences, but the interpreter doesn’t care.

Punctuation is meaningless in Meson. So is capitalisation of Meson keywords (but not of node names). Punctuation and capitalisation should be used only to improve human readability.

If we omit punctuation then our first example looks even simpler:

A so B

Throughout this tutorial, you can try writing meson scripts yourself, which is the best way to learn. For a first go, try writing the “A, so B.” script:

The so keyword belongs to the inf or “inference” keyword category because, as the first example shows, it creates an inference from one node to another, i.e. it creates a deduction arrow.

You can also chain several inferences together, like this:

A so B so C so D
../../_images/AsoBsoCsoD.png

Using the keyword so alone you could create all the deduction arrows in your proof, but this would be hard (unpleasant) for a human being to read. Meson provides two ways to improve readability:

  • variation of word choice, and

  • variation of sentence structure.

To begin with, there are many words in the inf keyword category, so for example you could write:

A, so B, therefore C, hence D.

producing the very same graph:

../../_images/AsoBsoCsoD.png

In general, all keywords belonging to the same category in Meson are synonyms: they have the exact same effect.

Table 4 inf keywords#

so

thus

implies

then

get

whence

therefore

infer

whereupon

hence

find

A few of these (like get) only make sense to an English speaker when used in combination with another keyword which we cover later (namely from, which belongs to the roam keyword category), but to the Meson interpreter they are all the same.

You can also say that several things follow directly from A:

A so B1 and B2 and B3
../../_images/AsoB123.png

or that B follows from several things used in conjunction:

A1 and A2 and A3 so B
../../_images/A123soB.png

Here we’ve used the keyword and, which belongs to the conj or “conjunction” class.

Table 5 conj keywords#

and

plus

In the next section we examine another keyword category which helps improve readability of Meson scripts by varying sentence structure.