Open in CoCalc

# Reasoning about the sizes of sets

## A worksheet on the semantics and the proof system.

You need to enter each of the grey cells below by clicking and they pressing shift-enter.

In [1]:
load ("sizesLM.py")


Welcome to our evaluator of some syllogistic arguments.

The basic syntax which we handle includes the standard syllogistic repertoire: 'All x are y', 'Some x are y', and 'No x are y'. We allow negation on nouns. We extend the system to include 'There are at least as many x as y' and 'There are more x than y'. The semantics for these are what one would expect. The goal is to study semantic consequence on finite models, to do proof search and counter-model construction.

Type 'examples( )' for examples of queries. You might want to copy them into text boxes and then enter them to get an answer.

Type 'syntax( )' for the general syntax of queries and other things you can enter.

Type 'rules( )' for the full set of proof rules of the system.

## Syntax of the fragment

category construction
noun n a, b, c, d, e, . . . , x, y, z
polarized noun p, q n, non-n
sentence s All p are q,
Some p are q,
No p are q,
There are at least as many p as q,
There are more p than q

The semantics for this fragment is what one would expect. We restrict attention to finite models in this notebook; it is possible to handle inference on infinite sets, but the rules of proof would be different.

The goal is to study the semantic consequence relation on finite models, and to do proof search and counter-model construction.

## Examples of queries

You can start a box below to copy and modify these, or to make up your own.

In [4]:
follows(['Some x are x','No y are y'], 'There are more x than y')


The conclusion follows from the assumptions.

Here is a formal proof in our system:

1 No y are y Assumption 2 All y are x Zero 1 3 No y are y Assumption 4 No x are y One 3 5 Some x are x Assumption 6 Some x are non-y Darii 4 5 7 There are more x than y More 2 6
In [5]:
follows([], 'All x are x')


The conclusion follows from the assumptions.

Here is a formal proof in our system:

1 All x are x Axiom
In [6]:
follows(['Some x are x','No y are y'], 'There are more x than y')


The conclusion follows from the assumptions.

Here is a formal proof in our system:

1 No y are y Assumption 2 All y are x Zero 1 3 No y are y Assumption 4 No x are y One 3 5 Some x are x Assumption 6 Some x are non-y Darii 4 5 7 There are more x than y More 2 6
In [7]:
follows(['All non-x are x', 'Some non-y are z'],'There are more x than y')


The conclusion follows from the assumptions.

Here is a formal proof in our system:

1 All non-x are x Assumption 2 All y are x One 1 3 All non-x are x Assumption 4 All non-y are x One 3 5 Some non-y are z Assumption 6 Some non-y are non-y Some Rule 5 7 Some non-y are x Darii 4 6 8 Some x are non-y Conversion 7 9 There are more x than y More 2 8
In [2]:
assumptions= ['All non-e are b',
'There are more d than non-b', 'There are more non-e than non-b',
'There are at least as many non-d as non-a', 'Some a are d']
conc = 'All d are non-b'
follows(assumptions,conc)


The conclusion does not follow from the assumptions.

Here is a counter-model.

We take the universe of the model to be {0, 1, 2, 3, 4, 5, 6, 7}.

noun semantics complement
a {2, 5, 6, 7} {0, 1, 3, 4}
b {0, 1, 3, 4, 5, 6, 7} {2}
d {0, 2, 3, 4} {1, 5, 6, 7}
e {2} {0, 1, 3, 4, 5, 6, 7}
In [ ]:
assumptions = ['All non-a are a', 'There are at least as many non-h as h',
'Some b are b']
conc = 'There are more a than h'
follows(assumptions,conc)

In [2]:
hypotheses = ['There are more a than b',
'There are more non-b than non-c', 'There are more non-c than d']
conclusion = 'Some non-b are non-a'
follows(hypotheses,conclusion)


The conclusion does not follow from the assumptions.

Here is a counter-model.

We take the universe of the model to be {0, 1, 2, 3}.

noun semantics complement
a {0, 1, 3} {2}
b {2} {0, 1, 3}
c {1, 3} {0, 2}
d {} {0, 1, 2, 3}
In [4]:
follows([
'There are more d than a',
'There are at least as many non-b as c',
'There are more non-e than b',
'Some non-b are non-f',
'No a are b',
'There are more c than non-d',
'There are at least as many non-a as f'
],
'All x are y')


The conclusion does not follow from the assumptions.

Here is a counter-model.

We take the universe of the model to be {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}.

noun semantics complement
a {} {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
b {} {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
c {8, 9, 3, 6, 7} {0, 1, 2, 4, 5}
d {0, 3, 6, 7, 8, 9} {1, 2, 4, 5}
e {} {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
f {} {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
x {4, 5} {0, 1, 2, 3, 6, 7, 8, 9}
y {} {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
In [8]:
follows([
'There are more non-f than a',
'There are at least as many non-b as c',
'There are more non-e than b',
'Some non-b are non-f',
'Some a are b',
'There are more c than non-d',
'There are at least as many non-a as f',
'There are more non-g than e',
'There are at least as many non-k as c',
'There are more non-w than c',
'Some non-b are non-g',
'All g are f',
'Some e are f',
'No r are b',
'There are more r than non-d',
'There are at least as many non-w as f'
],
'There are at least as many y as g')


The conclusion does not follow from the assumptions.

Here is a counter-model.

We take the universe of the model to be {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52}.

interpretation of a: {3, 13}

size of interpretation: 2

complement: {0, 1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52}

size of complement: 51

interpretation of b: {3, 13}

size of interpretation: 2

complement: {0, 1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52}

size of complement: 51

interpretation of c: {4, 14, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52}

size of interpretation: 18

complement: {0, 1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36}

size of complement: 35

interpretation of d: {4, 9, 14, 19, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52}

size of interpretation: 36

complement: {0, 1, 2, 3, 5, 6, 7, 8, 10, 11, 12, 13, 15, 16, 17, 18, 20}

size of complement: 17

interpretation of e: {8, 18}

size of interpretation: 2

complement: {0, 1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 16, 17, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52}

size of complement: 51

interpretation of f: {8, 18, 20}

size of interpretation: 3

complement: {0, 1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 16, 17, 19, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52}

size of complement: 50

interpretation of g: {20}

size of interpretation: 1

complement: {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52}

size of complement: 52

interpretation of k: {}

size of interpretation: 0

complement: {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52}

size of complement: 53

interpretation of r: {9, 19, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36}

size of interpretation: 18

complement: {0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52}

size of complement: 35

interpretation of w: {}

size of interpretation: 0

complement: {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52}

size of complement: 53

interpretation of y: {}

size of interpretation: 0

complement: {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52}

size of complement: 53

In [ ]:
tbl

In [ ]:
rules()

In [ ]:
instructions()

In [ ]:
examples( )

In [6]:
follows(['All x are y','All y are z'],'All x are z')


The conclusion follows from the assumptions.

Here is a formal proof in our system:

1 All x are y Assumption 2 All y are z Assumption 3 All x are z Barbara 1 2
In [ ]:


In [ ]:
follows(['Some y are z'],'Some z are y')

In [ ]:
follows(['There are more x than y', 'There are more z than y'],'There at least as many x as x')

In [ ]:
follows(['There are more x than y'], 'There are at least as many x as y')

In [ ]:
follows(['All x are y', 'There are more z than y'],'There at least as many x as x')
# this one doesn't seem to work yet

In [ ]:


In [ ]:
follows(['Some x are y', 'There are more z than y'],'There at at least as many x as x')

In [ ]:
follows(['All x are y', 'All w are x'],'There are at least as many y as w')

In [ ]:
rules()

In [13]:
# Here's a very small, obviously false example that I hope produces too large of a countermodel.
follows([], )


The conclusion does not follow from the assumptions.

Here is a counter-model.

We take the universe of the model to be {}.

noun semantics complement
a {} {}
b {} {}
In [ ]: