Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Logic of "all" + verbs + relative clauses, for a class at Indiana University
Inference using all, verbs, and relative clauses:
A worksheet on the semantics and the proof system.
by Lawrence S. Moss
Enter the line below to get started.
To enter any of the gray boxes, click on the box, hold down the shift key and then enter 'return'.
If the Haskell kernel dies during your session, you will need to re-enter this line.
Syntax of the fragment
category | construction |
---|---|
noun n | dogs, cats, birds, skunks, mammals, animals, chordates, sneetches, boys, girls |
verb v | admire, hate, help, love, see |
term t | n, v all t |
sentence s | all t u |
Sentences in this notebook have to be constructed according to the syntax above. But to make things more readable, you can add the words who, are, and also anywhere you like. In other words, those words are dropped by the parser. You also can make the verb singular or plural.
To help you see if an input sentence is ok for this fragment, you can enter it in the box below. If you get a red error, it's seriously out of range.
Semantics of the fragment
We next present the main semantic definition for our language.
The language is interpreted in models. A model is a set , together with interpretations of the basic nouns (the animal names) as subsets of and the basic verbs as sets of pairs of elements of .
Here are two models, called testModel1
and testModel2
. Start by either entering the cell below. You also may enter your own models by copying and modifying the box below.
You also may define your own models, by inserting a new cell, copying the box above into it, changing the names of the interpretation functions for the nouns, the verbs, and the model.
Here is a function which displays models.
In every model , we have an interpretation of each term .
For atomic, the model itself tells us the interpretation.
And given , we define ParseError: KaTeX parse error: Unexpected end of input in a macro argument, expected '}' at end of input: [\![\mbox{rtParseError: KaTeX parse error: Expected 'EOF', got '}' at position 1: }̲]\!] by
$$[\![\mbox{$rtParseError: KaTeX parse error: Expected 'EOF', got '}' at position 1: }̲]\!] = \{ x\in…y\in [![t]!](x,y)\in [![r]!]ParseError: KaTeX parse error: Expected 'EOF', got '}' at position 1: }̲\}.$
Notice that this is an inductive definition.
The next function termEval
takes two arguments, a term and then a model.
The term be a legal term in the current fragment.
The function termEval
gives the interpretation of this term in the model.
You can enter or change the arguments to termEval
. And again, you can also change make your own models and then test them.
We have just seen the interpretation of a term in a given model . And then we can define what it means for a sentence All to be true in . Of course, it means that .
The next function evaluate
takes two arguments, a sentence and a model. The sentence must be a legal sentence in the current fragment. The function evaluate
tells whether the input sentence is True or False in the model.
Examples of derivations in the logical system
The rules of the logical system:
$$\frac{}{\mbox{all $xxParseError: KaTeX parse error: Expected 'EOF', got '}' at position 1: }̲}\quad Axiom $
$$\frac{\mbox{all $xyParseError: KaTeX parse error: Expected 'EOF', got '}' at position 1: }̲ \qquad \mbox{a…yzParseError: KaTeX parse error: Expected 'EOF', got '}' at position 1: }̲}{\mbox{all xzParseError: KaTeX parse error: Expected 'EOF', got '}' at position 1: }̲}\quad Barbara $
$$\frac{\mbox{all $xyParseError: KaTeX parse error: Expected 'EOF', got '}' at position 1: }̲}{\mbox{all (ryrxParseError: KaTeX parse error: Expected 'EOF', got '}' at position 2: )}̲}\quad Anti $
Examples of counter-models
The main function that shows off the proof system and the counter-model algorithm is followsInARC
.
We are going to illustrate it first, and then afterwards we'll turn to some explanation.
You can click on the examples, and also modify them.
The first argument to
followsInARC
must be a list of sentences. (Lists in Haskell are enclosed by brackets[
and]
, and the items are separated by commas.) These sentences are the assumptions. The second argument is a single sentence. It is the conclusion.