[Question]
  [
### Challenge
Given a set `T` of subsets of a finite set `S={1,2,3,...,n}`, determine whether `T` is a *topology* or not.
### Explanation
The *powerset* `P(S)` of some set `S` is the set of all subsets of `S`. Some examples:
```
S = {}, P(S) = {{}}
S = {1}, P(S) = {{}, {1}}
S = {1,2}, P(S) = {{}, {1}, {2}, {1,2}}
S = {1,2,3}, P(S) = {{}, {1}, {2}, {3}, {1,2}, {1,3}, {2,3}, {1,2,3}}
```
A *topology* `T` on the set `S` is a subset of `P(S)` with following properties:
* `{}` is in `T` and `S` is in `T`
* If `A` and `B` are in `T` then so is their intersection `A ∩ B`
* If `A` and `B` are in `T` then so is their union `A ∪ B` \*
\* This definition is not quite correct, but it is true for finite sets, which is sufficient for the purposes of this challenge. The actual axiom would allow for infinite unions as well, but that is irrelevant in the finite case.
### Details
* You can assume that `S = {1,2,...,n}` (or alternatively `S = {0,1,...,n}`) where `n` is the largest integer that appears in the sets of `T`.
* The input format is flexible: You can use a string, a list of lists or set of lists or any similar format your langauge can handle. You can also use sets like `S = {0,1,...,n}` if it is more convenient.
* The output must be truthey or falsey.
* You are allowed to take `n` (or alternatively `n+1` or `n-1`) as an additional input.
* If you work with ordered lists, you can assume that the numbers within a set are sorted. You can also assume that the list has a certain order (e.g. lexicographical.
* As we represent sets, you can assume that no two entries of their list-representation are equal.
### Examples
**Topologies**
```
{{}}  over {}
{{},{1}} over {1}
P(S) over S (see in the explanation)
{{},{1},{1,2}} over {1,2}
{{},{1},{2,3},{1,2,3}} over {1,2,3}
{{1}, {1,2,3}, {1,4,5,6}, {1,2,3,4,5,6}, {}, {2,3}, {4,5,6}, {2,3,4,5,6}}
{{}, {1}, {2,3}, {2}, {4,5,6}, {5,6}, {5}, {2,5,6}, {2,5}, {1,5}, {1,2,3,4,5,6}, {1,2,3}, {1,2}, {1,4,5,6}, {1,5,6}, {1,2,5,6}, {2,3,4,5,6}, {2,3,5,6}, {2,3,5}, {1,2,3,5}, {2,4,5,6}, {1,2,5}, {1,2,3,5,6}, {1,2,4,5,6}}
{{}, {1}, {1,2}, {1,2,3}, {1,2,3,4}, {1,2,3,4,5}, {1,2,3,4,5,6}, {1,2,3,4,5,6,7}, {1,2,3,4,5,6,7,8}, {1,2,3,4,5,6,7,8,9}}
{{}, {1}, {1,2,3}, {1,2,3,4,5}, {1,2,3,4,5,6,7}, {1,2,3,4,5,6,7,8,9}}
```
**non-Topologies**
```
{{1}} because {} is not contained
{{},{2}} because {1,2} is not contained
{{},{1,2},{2,3}} because the union {1,2,3} is not contained
{{},{1},{1,2},{2,3},{1,2,3}} because the intersection of {1,2} and {2,3} is not contained
{{},{1},{2},{3},{1,2},{2,3},{1,2,3}} because the union of {1} and {3} is not contained
{{}, {1}, {2,3}, {2}, {4,5,6}, {5,6}, {5}, {2,5,6}, {2,5}, {1,5}, {1,2,3,4,5,6}, {1,2,3}, {1,2}, {1,4,5,6}, {1,5,6}, {1,2,5,6}, {2,3,4,5,6}, {2,3,5,6}, {2,3,5}, {2,4,5,6}, {1,2,5}, {1,2,3,5,6}, {1,2,4,5,6}} because {1,2,3,5} is missing
{{}, {1}, {2}, {1,2,3}, {1,2,3,4,5}, {1,2,3,4,5,6,7}, {1,2,3,4,5,6,7,8,9}} because {1,2} is missing 
```
  
[Answer]
# [Python 2](https://docs.python.org/2/), ~~117~~ ~~99~~ ~~97~~ 91 bytes
```
n,x=input();sum(set.union(*x))!=n*-~n/2>q
[map(x.index,(i-i,i|j,i&j))for i in x for j in x]
```
[Try it online!](https://tio.run/##1VNNc4IwEL3zK7Z2poITbYVqqx17s8f20N4cDqjrGIuBQhhhbPvXaUKQD9GTpzLDZPfl5e1uePgJX3vMTBfeEietVitlJJ5Q5kdcN57CaKuHyHsRox7TO7FhXE1Yp/vLbs3nL222dXw97lG2xJjotEsJ/d4QerMxjJUXAAXKIAYZbrLQToW@tltTF@EjiHCsAfAgkYt4MMYFyC5U6geUcWi/eoBB4AVtTTIW6HN4Txh34qlE86PXgFufJ@BShjBHvkNkQjni6wQctoSV44YJLJwQw4p4qTh9e6nLMQ@yKwAXV1yB8wCdz@LIuNZkdrid3pGZuCzdsEHr5yHZ939szaxk4iWmwKwaZhJL7YjV1oZkJlHIgSy4JwMyLLAiVRqwz3kFq@Rkcgda/6fkmrUDh0URCpWBKjloVq42ZzZ6rHAaHeVJNSzl8wZqVarbJXoYb3Q0XtFO2Z4sXZvg3DgqJQ8NgDyegMjodPla3Uaxk@qZlLRNZpiKOeQwe2ULq2GjY@McmUq81hnmP/HERUYwL/wc5W8rftg/ "Python 2 – Try It Online")
Output is via exit code
[Answer]
# [Haskell](https://www.haskell.org/), ~~95 89 74~~ 78 bytes
```
import Data.List
t#n=all(`elem`t)$sort<$>[1..n]:[]:([union,intersect]<*>t<*>t)
```
[Try it online!](https://tio.run/##FcnBCoMwDADQ@76iYA86SkGPop523B@EgGEEVpZGabPv79zhnd6b6odFWkv5PIq5BxnFZ6p2s05XEul3Fs67Db5ev/gNxhgVZ8C5h6@mQ0NS41L5ZbjcN/sbWqakbnVnudJ5B4ABxjAhdlP7AQ "Haskell – Try It Online")
Explanation:
```
                              ([union,intersect]<*>t<*>t) -- create all unions & intersections 
                    [1..n]:[]:                            -- add the empty list and the full list
             sort<$>                                --sort them all
                                -- (as 'union' does not necessarily produce sorted outputs)
all(`elem`t)$                   -- check whether they are all already contained
```
[Answer]
# Mathematica, ~~87~~ ~~73~~ ~~66~~ 63 bytes
```
Outer[{#⋂#2,#⋃#2}&,#,#,1]~Flatten~2⋃{{},Range@#2}==#⋃#&
```
Takes `[T, n]` as input.
### Explanation
```
{#⋂#2,#⋃#2}&
```
Function that returns the intersection and the union of the inputs
```
Outer[ ... ,#,#,1]
```
Map that function onto the input list at level 1.
```
... ~Flatten~2
```
Flatten the result (the `Outer` part returns a bunch of nested `List`s).
```
... ⋃{{},Range@#2}
```
Take the union between the flattened list and `{{}, S}`. This removes duplicates and adds `{}` and `S` to the resulting list.
```
... ==#⋃#
```
Check whether the list from above is equal to the sorted version of the input.
[Answer]
# [MATL](https://github.com/lmendo/MATL), 38 bytes
```
!t~hXAs1>GXBXH2Z^!"@Z}Z|1MZ&hHm]vAGn~+
```
Input is a binary matrix where each row is a set, each column is an element, and each entry indicates membership. For example, `{{},{1},{1,2}}` is expressed as `[0 0;1 0;1 1]`. Use the linked [Octave program](https://tio.run/##jY7NCoMwEITvfYq9JYGloP05tAh9lagRAlkjJimK@OxpqkVpTz0szMwO366tvHyqGAcoQLdd8JwxcT9QsiQHXiljcpJ@EU1o@YNX4mcjBMKAwEKrG9uTDT5hGEIjjVNCJNqYaF8A7UhRqXqe3QjhX9QKSsXc@Z7XNpRG7X@MR7Ycq7Xr@ChinKZsRpgyzPG0ijNe8Lplu33Pp7Rle2F@AQ) to convert to this format.
[Try it online!](https://tio.run/##y00syfn/X7GkLiPCsdjQzj3CKcLDKCpOUckhqjaqxtA3Si3DIze2zNE9r077//9oQwUDGLRWMARDOAfEAAvBZKAcA2Q9Bsh6DJD1GCD0xAIA "MATL – Try It Online") Or [verify all test cases](https://tio.run/##5VOxDoIwEN39iuLg4nLPtYlR40BI3BwIRKMbg7pInNRfR2s5etJbGJwMCe29u3v3Sh/nY31qDnnWJPWzypdXzLN8laezYp@MF8WjuGNTTKr0vLsts8tz2qy3TbkblWQN3GLej3UvA7fAR3ARfA4@B59zS9toOyQi6hV/mAwxHwxCQH4cd4EDkj0ke0j2UOhhFW2dHCr7yUDggYoCsdiHeo@jwyFqpHJ5PohZ8qgQs9DjR6fHZ7731PEHbejxyBrGlS8Uf6dYtUCgIFAQKAgUBAoCBRmiWteoK9Lnf@zK/qZvawfDRWj8d7BGyzdFfBc23Mu/ePY3PqUBPh3mgRc).
### Explanation
```
!        % Implicit input. Transpose
t~       % Push a negated copy
h        % Horizontally concatenate both matrices
XA       % All: true for columns containing only 1
s        % Sum
1>       % Does it exceed 1? If so, both the empty set and the total
         % set are in the input
G        % Push input again
XB       % Convert each row from binary to decimal. This gives a column
         % vector of numbers that encode each set's contents. Union and
         % intersection will be done as bitwise XOR and AND
XH       % Copy to clipboard H
2Z^!     % Cartesian square transposed: gives all pairs of numbers as
         % columns of a matrix
"        % For each column
  @      %   Push current column
  Z}     %   Split into the two numbers
  Z|     %   Bitwise XOR
  1M     %   Push the two numbers again
  Z&     %   Bitwise AND
  h      %   Concatenate the two results horizontally
  Hm     %   Are they members of the vector of encoded sets? This gives
         %   a row vector with the two results
]        % End
v        % Concatenate all stack contents into a vertical vector
A        % Does it only contain ones? This is the main result: true iff
         % input is a non-empty topology. The empty input gives false,
         % and so it needs to be special cased
G        % Push input again
n~       % Is it empty?
+        % Add thw two results. Implicit display
```
[Answer]
# [Python 2](https://docs.python.org/2/), ~~92 71~~ 122 bytes
* Thanks a lot to @ovs for a heavy 19 bytes reduction: `&` and `|` shorthands for set operations.
* Thanks @notjagan for 5 bytes
* Thanks to @ovs for 2 bytes: `set()` as `i-i`
Lambda that takes a list of sets as input, and returns True/false. Simply checks if there is an empty set and the union and intersection of each sets(two sets iterated as `i` and `j`) exists in the given list of sets.
```
lambda x:x.sort()or all(k in x[-1]for k in range(1,max(x[-1])))and all(a in x for i in x for j in x for a in[i-j,i|j,i&j])
```
[Try it online!](https://tio.run/##VY7LDoIwEEV/pSvTJsUEfCxM/JLKYgygg1hIqUkN@u3YB4@66My903On7d763spsrM6XsYHntQBiTmbbt0pT1ioCTUMfBCUxIknzyk68UyBvJU35Ewz1N4wxkIXHwePEsbjKepUOEJjUHD/2bOqcjZ1CqUlFRV9qimzJouxe9iOWEMOXkyF1JeM731zZ8wM/OjG3AEzOCp@am03yJeHtJEKLriJm2RVlnYllEH@royejaUDyHw "Python 2 – Try It Online")
[Answer]
## CJam (23 bytes)
```
{[,M2$2m*{_~&\~|$}/]^!}
```
[Online test suite](http://cjam.aditsu.net/#code=q%22%7B%7D%2C%22%22%5B%5D%20%22erN%25%7B%0A~%3AE%3B%20e%23%20Store%20expected%20output%20for%20later%20check%0A%3A%3A(%20e%23%20Switch%20from%201..(n%2B1)%20to%200..n%0A_e_W%2B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3%7D%2C%7B1%2C2%2C3%7D%7D%200%0A%7B%7B%7D%2C%20%7B1%7D%2C%20%7B2%2C3%7D%2C%20%7B2%7D%2C%20%7B4%2C5%2C6%7D%2C%20%7B5%2C6%7D%2C%20%7B5%7D%2C%20%7B2%2C5%2C6%7D%2C%20%7B2%2C5%7D%2C%20%7B1%2C5%7D%2C%20%7B1%2C2%2C3%2C4%2C5%2C6%7D%2C%20%7B1%2C2%2C3%7D%2C%20%7B1%2C2%7D%2C%20%7B1%2C4%2C5%2C6%7D%2C%20%7B1%2C5%2C6%7D%2C%20%7B1%2C2%2C5%2C6%7D%2C%20%7B2%2C3%2C4%2C5%2C6%7D%2C%20%7B2%2C3%2C5%2C6%7D%2C%20%7B2%2C3%2C5%7D%2C%20%7B2%2C4%2C5%2C6%7D%2C%20%7B1%2C2%2C5%7D%2C%20%7B1%2C2%2C3%2C5%2C6%7D%2C%20%7B1%2C2%2C4%2C5%2C6%7D%7D%200%0A%7B%7B%7D%2C%20%7B1%7D%2C%20%7B2%7D%2C%20%7B1%2C2%2C3%7D%2C%20%7B1%2C2%2C3%2C4%2C5%7D%2C%20%7B1%2C2%2C3%2C4%2C5%2C6%2C7%7D%2C%20%7B1%2C2%2C3%2C4%2C5%2C6%2C7%2C8%2C9%7D%7D%200). This is an anonymous block (function). I assume `S = {0,1,...,n}`; the block takes an array of sorted arrays and `n+1` as parameters and leaves `0` or `1` on the stack. In the case `{{}}` the code and test framework assume that `n+1 = 0`.
[Answer]
# Pyth, ~~24~~ 23 bytes
```
q@aasm,@Fd{Ssd*QQYJUEyJ
```
[Test suite](https://pyth.herokuapp.com/?code=q%40aasm%2C%40Fd%7BSsd%2aQQYJUEyJ&test_suite=1&test_suite_input=%5B%5B%5D%5D%0A0%0A%5B%5B%5D%2C+%5B0%5D%5D%0A1%0A%5B%5B%5D%2C+%5B0%5D%2C+%5B1%2C+2%5D%2C+%5B0%2C+1%2C+2%5D%5D%0A3%0A%5B%5B%5D%2C+%5B0%5D%2C+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%5D%2C+%5B0%2C+1%2C+2%5D%2C+%5B0%2C+1%2C+4%5D%2C+%5B0%2C+4%2C+5%5D%2C+%5B1%2C+2%2C+4%5D%2C+%5B1%2C+4%2C+5%5D%2C+%5B3%2C+4%2C+5%5D%2C+%5B0%2C+1%2C+4%2C+5%5D%2C+%5B0%2C+3%2C+4%2C+5%5D%2C+%5B1%2C+2%2C+4%2C+5%5D%2C+%5B1%2C+3%2C+4%2C+5%5D%2C+%5B0%2C+1%2C+2%2C+4%2C+5%5D%2C+%5B0%2C+1%2C+3%2C+4%2C+5%5D%2C+%5B1%2C+2%2C+3%2C+4%2C+5%5D%2C+%5B0%2C+1%2C+2%2C+3%2C+4%2C+5%5D%5D%0A6&debug=0&input_size=2)
This program takes input as an ordered list of ordered lists. The inner lists must be in ascending order and the order list must be sorted by length then lexicographically. I have confirmed that this is an allowed input format. Numbers start at 0, and N+1 is also taken as input.
As for how it works, we filter out anything not in P(S), then add S, `[]`, the intersection of every pair and the union of every pair, deduplicate, and check that the result is equal to the input.
[Answer]
# Axiom, 358 bytes
```
t(a,s)==(aa:=sort(removeDuplicates(a));ss:=sort(removeDuplicates(s));a:=sort(a);s:=sort(s);a~=aa or s~=ss=>false;a:=map(sort, a);~member?([],a) or ~member?(s,a)=>false;for x in a repeat(for j in x repeat if ~member?(j,s) then return false;for y in a repeat if ~member?(sort(setIntersection(x,y)),a) or ~member?(sort(setUnion(x,y)),a) then return false);true)
```
ungolfed and results:
```
-- all the List have to be sorted because in list [1,2]~=[2,1]
-- So here "set" means: "List without duplicate, sorted with sort() function"
-- Return true if 
-- 1) a,s are set for above definition
-- 2) a is in P(s) 
-- 3) s,[] are in a
-- 4) for all x and y in a => xUy is in a and x intersect y is in a
t1(a:List List INT, s:List INT):Boolean==
    aa:=sort(removeDuplicates(a));ss:=sort(removeDuplicates(s))
    a :=sort(a);                  s :=sort(s)
    a~=aa          or s~=ss        =>false   -- they are not sets but list with element duplicate
    a:=map(sort, a)                          -- subset of a has to be sorted too
    ~member?([],a) or ~member?(s,a)=>false
    for x in a repeat
       for j in x repeat if ~member?(j,s) then return false 
       for y in a repeat if ~member?(sort(setIntersection(x,y)),a) or ~member?(sort(setUnion(x,y)),a) then return false
    true
(4) -> t([[]], [])
   (4)  true
                                                            Type: Boolean
(5) -> t([[],[1]], [1])
   (5)  true
                                                            Type: Boolean
(6) -> t([[],[1],[2,1]], [1,2])
   (6)  true
                                                            Type: Boolean
(7) -> t([[],[1],[2,3],[1,2,3]], [3,1,2])
   (7)  true
                                                            Type: Boolean
(8) -> t([[1], [1,2,3], [1,4,5,6], [1,2,3,4,5,6], [], [2,3], [4,5,6], [2,3,4,5,6]], [1,2,3,4,5,6])
   (8)  true
                                                            Type: Boolean
(9) -> t([[], [1], [2,3], [2], [4,5,6], [5,6], [5], [2,5,6], [2,5], [1,5], [1,2,3,4,5,6], [1,2,3], [1,2], [1,4,5,6], [1,5,6], [1,2,5,6], [2,3,4,5,6], [2,3,5,6], [2,3,5], [1,2,3,5], [2,4,5,6], [1,2,5], [1,2,3,5,6], [1,2,4,5,6]], [1,2,3,4,5,6])
   (9)  true
                                                            Type: Boolean
(10) -> t([[], [1], [1,2], [1,2,3], [1,2,3,4], [1,2,3,4,5], [1,2,3,4,5,6], [1,2,3,4,5,6,7], [1,2,3,4,5,6,7,8], [1,2,3,4,5,6,7,8,9]], [1,2,3,4,5,6,7,8,9])
   (10)  true
                                                            Type: Boolean
(11) -> t([[], [1], [1,2,3], [1,2,3,4,5], [1,2,3,4,5,6,7], [1,2,3,4,5,6,7,8,9]], [1,2,3,4,5,6,7,8,9])
   (11)  true
                                                            Type: Boolean
(2) -> t([[1]], [1])
   (2)  false
                                                            Type: Boolean
(4) -> t([[],[2]], [1,2])
   (4)  false
                                                            Type: Boolean
(5) -> t([[],[1,2],[2,3]], [1,2,3])
   (5)  false
                                                            Type: Boolean
(6) -> t([[],[1],[1,2],[2,3],[1,2,3]], [1,2,3])
   (6)  false
                                                            Type: Boolean
(7) -> t([[],[1],[2],[3],[1,2],[2,3],[1,2,3]] , [1,2,3])
   (7)  false
                                                            Type: Boolean
(8) -> t([[], [1], [2,3], [2], [4,5,6], [5,6], [5], [2,5,6], [2,5], [1,5],[1,2,3,4,5,6], [1,2,3], [1,2], [1,4,5,6], [1,5,6], [1,2,5,6], [2,3,4,5,6], [2,3,5,6], [2,3,5], [2,4,5,6], [1,2,5], [1,2,3,5,6], [1,2,4,5,6]], [1,2,3,4,5,6])
   (8)  false
                                                            Type: Boolean
(9) -> t([[], [1], [2], [1,2,3], [1,2,3,4,5], [1,2,3,4,5,6,7], [1,2,3,4,5,6,7,8,9]] , [1,2,3,4,5,6,7,8,9])
   (9)  false
                                                            Type: Boolean
(10) -> t([[], [1], [2,3], [2], [4,5,6], [5,6], [5], [2,5,6], [2,5], [1,5],[1,2,3,4,5,6], [1,2,3], [1,2], [1,4,5,6], [1,5,6], [1,2,5,6], [2,3,4,5,6], [2,3,5,6], [2,3,5], [2,4,5,6], [1,2,5], [1,2,3,5,6], [1,2,4,5,6]], [1,2,3,4,5,6])
   (10)  false
                                                            Type: Boolean
```
[Answer]
# Python, 87 bytes
`lambda n,T:(set(range(n))in T)&all(x in T for i in T for j in T for x in [i-i,i&j,i|j])`
Takes the number `n` and a list of sets `T` as input.
]