Introduction
In the field of mathematics known as topology, there are things called separation axioms.
Intuitively, you have a set X
and a collection of subsets of X
, which we can think of as properties.
The system is well separated, if one can distinguish between all items of X
based on their properties.
The separation axioms formalize this idea.
In this challenge, your task is to check three separation axioms, given X
and the list of properties.
Input
Your inputs are an integer n ≥ 2
, and a list of lists T
of integers.
The integers in T
are drawn from X = [0, 1, ..., n-1]
.
The lists in T
may be empty and unsorted, but they will not contain duplicates.
Output
Your output is one of four strings, determined by three separation axioms, each stronger than the last. There are other axioms, but we stick with these for simplicity.
- Suppose that for all distinct
x
andy
inX
, there exists a list inT
containing exactly one of them. ThenX
andT
satisfy axiom T0. - Suppose that for all distinct
x
andy
inX
, there exist two lists inT
, one of which containsx
but noty
, and the other containsy
but notx
. ThenX
andT
satisfy axiom T1. - Suppose that the two lists above also contain no common elements.
Then
X
andT
satisfy axiom T2.
Your output is one of T2
, T1
, T0
or TS
, depending on which of the above conditions holds (TS
means none of them do).
Note that T2 is stronger than T1, which is stronger than T0, and you should always output the strongest possible axiom.
Rules and scoring
You can write a full program or a function. The lowest byte count wins, and standard loopholes are disallowed.
Test cases
2 [] -> TS
2 [[],[1]] -> T0
2 [[0],[1]] -> T2
3 [[0],[0,1,2],[1,2]] -> TS
3 [[],[0],[0,1],[2]] -> T0
3 [[0],[0,1],[2,1],[0,1,2]] -> T0
3 [[0],[0,1],[2,1],[2,0]] -> T1
6 [[0,2,4],[0,3,5],[1,2],[3,4,5]] -> TS
6 [[0,2,4],[0,3,5],[1,2],[2,5],[3,4,5]] -> T0
6 [[0,2,4],[0,3,5],[1,2],[2,5],[3,1],[3,4,5]] -> T1
6 [[0,1],[0,2,3],[1,4],[2,4],[2,3,5],[1,3],[4,5]] -> T2
n
superfluous? In the rest of the challenge, I'm not seeing it used beyond defining what elements can be inT
, so is it just a provided shortcut forT.Maximum()
? \$\endgroup\$0 []
should giveT2
. \$\endgroup\$