Re: Topology
- To: mathgroup at smc.vnet.net
- Subject: [mg16201] Re: Topology
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Fri, 5 Mar 1999 00:40:38 -0500
- References: <7bg21q$5m3@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Vesa-Matti Sarenius wrote in message <7bg21q$5m3 at smc.vnet.net>...
>Hip!
>
>Anyone done this?
>
>T1 is a topology for a set A if
>1. {} and A are in T1 ({} is the empty set.)
>2. Any union of members in T1 is in T1
>3. Any intersection of finitely many members of T1 is in T1
>
>Then an example:
>
>Let A={a,b,c}
> then T1={{},A,{a},{a,b},{c},{a,c}} is a topology for A.
>
>I am trying to do a Mathematica code program to determine for finite
>sets (like A above) whether T1 is a topology.
>
>First I did this:
>
>ElementQ[set_,element_]:=
> Module[{i=0,t=False},While[i<Length[set],i=i+1;
> If[element==set[[i]],t=True,
> t=t]];t]
>
>This checks whether some a is a member of T1
>
>T1={{},{a,b,c},{a}}
>E.g. ElementQ[T1,{}] gives True.
>
>Now I am desperately trying to do:
>
>-TopologyQIntersections
>-TopologyQUnions
>
>two functions which would check the marks 2. and 3. from the definition,
>using the help of ElementQ.
>
>I came up with about nothing. So if anyone have done this or can help me
>otherwise, please do so.
>
>--
>Vesa-Matti Sarenius * - Am I a man or what? - A What!*
>mailto:sarenius at paju.oulu.NOSPAMfi* - What? - Yes, that's right! *
>Koskitie 47 A6 FIN-90500 OULU * * * * *
>http://www.student.oulu.fi/~sarenius * * * * * * * * * * hmmmm! *
>Finland, Europe. Tel. +358-8-342236 fax.+358-8-5305045. * * * * * *
>
After
<<DiscreteMath`Combinatorica`
Complement[
Apply[Union, KSubsets[T1, k], {1} ] ,T1
]
will give {} iff the unions of k subsets of T1 are elements of T1
We can similarly test for intersections.
This is probably inefficient - you may get some ideas from the other
functions of the package, and from their code.
Allan