topology.mws

__Topology with Maple__

by Didier Deses

`> `
**restart;**

with(combinat):with(networks):with(plottools):

`Warning, the protected name Chi has been redefined and unprotected`

`Warning, these names have been redefined: dodecahedron, icosahedron, octahedron, tetrahedron`

This is a set of procedures to do finite topology in Maple. The procedures were chosen to illustrate basic topological constructions and properties. The only limitation is of course that it can only be done for relatively small finite sets.

I have written a lot more procedures in Maple about this subject, but since they are more specialized (reseach-level), I have decided to exclude them of this file, anyone interested can contact me for further informations:
__diddesen@vub.ac.be__

I would advice anyone to start with the examples, so go ahead and try.

**The procedures**

A procedure to check if a set is a subset of another one, the implementation is quite trivial.

`> `
**issubset:=proc(A,B)**

local a;

for a in A do

if not(member(a,B)) then RETURN(false); fi;

od;

RETURN(true);

end:

Two procedure to close a set under unions/intersetctions: `union` it recursively applied to the guven set, untill it doeen't change anymore

`> `
**clunion:=proc(T)**

local A,U;U:=T;

for A in T do

U:= U union map(`union`,U,A);

od;

if U=T then U; else clunion(U); fi;

end:

`> `
**clintersect:=proc(T)**

local A,U;U:=T;

for A in T do

U:= U union map(`intersect`,U,A);

od;

if U=T then U; else clintersect(U); fi;

end:

A subbasis B is used to generate a topology by closing B under both finite intersections and finite unions and adding X and {}. Since X is a finite set the result is a topology.

`> `
**topbase:=proc(X,B)**

clunion(clintersect(B union {X,{}}));

end:

A finite topology on X must contain X and {}, must be closed under unions and intersections.

`> `
**isTopo:=proc(X,T)**

clunion(T)=T and member(X,T) and member({},T) and clintersect(T)=T;

end:

This one finds al sets of the topology such that both the set and its complement are open,i.e. the clopen sets.

`> `
**CO:=proc(X,T)**

local A,W;W:={};

for A in T do

if member(X minus A,T) then W:=W union {A}; fi;

od;

W; end:

`> `

By complementing open sets one finds the closed sets.

`> `
**CLO:=proc(X,T)**

{seq(X minus T[i],i=1..nops(T))};

end:

The interior of a set is the union of all open sets contained is the given one.

`> `
**interior:=proc(A,X,T)**

local i,I;

I:={};

for i to nops(T) do

if issubset(T[i],A) then I:=I union T[i]; fi;

od;

I; end:

`Warning, imaginary unit `I` used as a local variable`

The closure of a set is the intersection of all closed sets containing the given one.

`> `
**closure:=proc(A,X,T)**

local i,C,ClX;

ClX:=CLO(X,T);

C:=X;

for i to nops(ClX) do

if issubset(A,ClX[i]) then C:=C intersect ClX[i]; fi;

od;

C; end:

Subspaces are found by taking intersections with the open sets.

`> `
**subspace:=proc(A,X,T)**

map2(`intersect`,A,T);

end:

Given a list of sets this procedure finds all element in the cartesian product.

`> `
**expandcart:=proc(PX)**

local C,P,i;

C:={};

P:=cartprod([seq([op(PX[i])],i=1..nops(PX))]);

while not P[finished] do C:=C union {P[nextvalue]()} od;

C;

end:

Implementation of the inverse projections, this is needed in later procedures.

`> `
**iprj:=proc(k,S,PX) **

local i,O;

for i to nops(PX) do

if i=k then O[i]:=S else O[i]:=PX[i] fi;

od;

expandcart([seq(O[i],i=1..nops(PX))]);

end:

Procedure to find a subbasis for a product topology using inverse projections.

`> `
**prodbase:=proc(PX,PS)**

local i,k,S;S:={};

for k to nops(PX) do

for i to nops(PS[k]) do

S:=S union {iprj(k,PS[k][i],PX)};

od;

od;

S;

end:

Given a list of sets and a list of topologies, the product topology is found.

`> `
**prodtop:=proc(PX,PT)**

topbase(expandcart(PX),prodbase(PX,PT));

end:

The following are a set of procedures testing for some topological properties, the used algorithms are simply exhaustive ones, all possibilities are checked.

`> `
**isT0:=proc(X,T)**

local x,y,A,test;

for x in X do

for y in X minus {x} do

for A in T do

test:=evalb((member(x,A) and not(member(y,A))) or (member(y,A) and not(member(x,A)))):

if test then break; fi;

od:

if not(test) then break; fi;

od:

if not(test) then break; fi;

od:

test;

end:

`> `
**isT1:=proc(X,T)**

issubset({seq({X[i]},i=1..nops(X))},CLO(X,T));

end:

`> `
**isHd:=proc(X,T)**

local x,y,A,B,test;

for x in X do

for y in X minus {x} do

for A in T do

for B in T minus {A} do

test:=evalb(member(x,A) and member(y,B) and A intersect B={}):

if test then break; fi;

od:

if test then break; fi;

od:

if not(test) then break; fi;

od:

if not(test) then break; fi;

od:

test;

end:

A topology is weakly zero-dimensional iff the clopen sets form a base.

`> `
**isWzd:=proc(X,T) evalb(topbase(X,CO(X,T))=T) end:**

A topology is connected iff there are no proper clopen sets.

`> `
**isConn:=proc(X,T)**

evalb(CO(X,T)={X,{}});

end:

A connection component is the largest connected subspace, containing a given point.

`> `
**K:=proc(x,X,T)**

local i,S,SK;

SK:={};

S:=map2(`union`,{x},powerset(X));

for i to nops(S) do

if isConn(S[i],subspace(S[i],X,T)) then SK:=SK union S[i]; fi;

od; SK; end:

A topology is totally disconnected if all connections components are singletons.

`> `
**isTotDisc:=proc(X,T)**

local i;

for i to nops(X) do

if not(K(X[i],X,T)={X[i]}) then RETURN(false) fi;

od;

RETURN(true);

end:

This procedures returns a graph of the lattice of a set of sets, ordered by inclusion.

`> `
**setlattice:=proc(S)**

local a,b,G,os,i,j,lorder,P,L,T,k,tl,dincl;

dincl:=proc(A,B,S)

local C;

if A=B then RETURN(false) fi;

if not issubset(A,B) then RETURN(false) fi;

for C in S minus {A,B} do

if issubset(A,C) and issubset(C,B) then RETURN(false) fi;

od;

RETURN(true);

end:

lorder:=proc(a,b) evalb(nops(a)<nops(b)) end:

new(G);

os:=sort([op(S)],lorder);

addvertex({seq(i,i=1..nops(S))},G);

for i to nops(os) do

for j to nops(os) do

if dincl(os[i],os[j],S) then addedge([i,j],G) fi;

od;

od;

k:=nops(os[1]);

tl:=1;

T:={};

for i to nops(os) do

print(i=os[i]);

if nops(os[i])=k then T:=T union {i};

else

L[tl]:=T;

T:={i};

tl:=tl+1;

k:=nops(os[i]);

fi;

od;

L[tl]:=T;

P:=draw(Linear(seq([op(L[i])],i=1..tl)),G);

print(rotate(P,Pi/2));

G;

end:

`> `

**The examples**

Let's take a set

`> `
**X:={a,b,c,d};**

and a topology given by the subbasis of open sets

`> `
**B:={{a,b},{c,a},{c,d}};**

`> `
**T:=topbase(X,B);**

is T indeed a topology on X?

`> `
**isTopo(X,T);**

What are it's closed sets?

`> `
**CLO(X,T);**

Given a subset A, what is it's closure, it's interior?

`> `
**A:={a,d};**

closure(A,X,T);

interior(A,X,T);

What is the subspace induced by T on A?

`> `
**TA:=subspace(A,X,T);**

isTopo(A,TA);

Is this X,T T0,T1, Hausdorff?

`> `
**isT0(X,T);**

isT1(X,T);

isHd(X,T);

Is it connected?

`> `
**isConn(X,T);**

Is it totally disconnected?

`> `
**isTotDisc(X,T);**

What are the connectedness-components?

`> `
**K(a,X,T);**

K(c,X,T);

What are the clopen sets?

`> `
**CO(X,T);**

Is X,T weakly zero-dimensional?

`> `
**isWzd(X,T);**

Compare the results with the subspace?

`> `
**A,TA;**

`> `
**isConn(A,TA);**

`> `
**isTotDisc(A,TA);**

`> `
**isWzd(A,TA);**

Suppose we have another topological space

`> `
**Y:={0,1};**

S:={{},{0,1},{1}};

isTopo(Y,S);

What is the product space of X and Y?

`> `
**XY:=expandcart([X,Y]);**

What is the propduct topology?

`> `
**TXY:=prodtop([X,Y],[T,S]);**

isTopo(XY,TXY);

As a product of T0 spaces it must be T0.

`> `
**isT0(XY,TXY);**

isHd(XY,TXY);

What about connectedness?

`> `
**isTotDisc(XY,TXY);**

`> `
**K([b,0],XY,TXY);**

What are the lattices of open sets of the spaces above?

`> `
**setlattice(T);**

`> `
**setlattice(S);**

`> `
**setlattice(TXY);**

`> `

`> `

`> `

`> `

`> `

`> `