# Finite Topology Library
A Python library for defining, analyzing, and exploring finite topologies. This toolset is designed for educational purposes, to assist in research, and to make it easy to experiment with topological concepts computationally, using finite sets.
## Features
### Construct Common Topologies:
- **Discrete Topology**: Every subset is open.
- **Indiscrete (Trivial) Topology**: Only the empty set and the entire set are open.
- **Sierpiński Topology**: A classic topology on a two-element set.
- **Particular Point and Excluded Point Topologies**: Control which points are required or excluded in open sets.
- **Divisibility Topology**: Topology based on divisibility relations among integers.
- **Alexandrov Topology**: Topologies that are closed under arbitrary intersections of open sets, useful in domain theory.
### Analyze Functions Between Spaces:
- **Continuity**: Check whether a function between two topological spaces is continuous.
- **Homeomorphism**: Analyze whether two spaces are homeomorphic (topologically equivalent) via bijections.
- **Preimage and Image**: Compute preimages of sets under continuous mappings.
### Topology Properties:
- **Compactness**: Determine if a topology is compact, a trivial property for finite topologies.
- **Connectedness**: Check if the space can be split into two disjoint open sets.
- **Hausdorff Conditions (T2)**: Verify if any two distinct points have disjoint open neighborhoods.
- **Separation Axioms (T0, T1)**: Study basic separation properties in finite spaces.
## Installation
To install the library, run the following command:
```bash
pip install finite-topology
```
Alternatively, you can clone the repository and install dependencies:
```bash
git clone https://github.com/nand0san/Topology.git
cd finite-topology
pip install -r requirements.txt
```
## Usage
### Example 1: Create a Discrete Topology and Analyze a Continuous Function
```python
from finite_topology.known_topologies import create_discrete_topology
from finite_topology.functions import Function
# Define two sets
space = {1, 2, 3}
target_space = {'a', 'b', 'c'}
# Create discrete topologies on both spaces
source_topology = create_discrete_topology(space)
target_topology = create_discrete_topology(target_space)
# Define a mapping for a continuous function
mapping = {1: 'a', 2: 'b', 3: 'c'}
# Create a function and verify continuity
f = Function(source_topology, target_topology, mapping)
print(f"Is the function continuous? {f.is_continuous()}")
```
**Expected Output:**
```
Is the function continuous? True
```
### Example 2: Study Dense Sets in Finite Topologies
In finite topological spaces, dense sets exhibit interesting behavior. Consider the triviality that the entire space is dense in many cases.
```python
from finite_topology.topology import Topology
# Define a collection of subsets that form a topology
space = {1, 2, 3}
subsets = [{1}, {1, 2}, {1, 2, 3}]
topology = Topology(collection_of_subsets=subsets, generate=False)
# Find the dense subsets
dense_set = topology.find_dense_subset()
print(f"Dense subset: {dense_set}")
```
**Explanation:**
In finite topologies, a set is dense if its closure equals the entire space. The library can compute and return the smallest dense subset or indicate if the entire space is the only dense subset (trivial case).
**Expected Output:**
```
Dense subset: {1}
```
### Example 3: Topologies with Specific Points (Particular Point Topology)
```python
from finite_topology.known_topologies import create_particular_point_topology
space = {1, 2, 3}
particular_point = 2
# Create a particular point topology
topology = create_particular_point_topology(space, particular_point)
print(f"Topology with particular point {particular_point}:")
print(topology)
```
**Expected Output:**
```
Topology with particular point 2:
Topology(
Space: [1, 2, 3],
Collection of Subsets:
[1, 2, 3]
[2]
[1, 2]
[2, 3]
Properties: T0, T1, Connected, Compact, Separable
)
```
In this example, the topology is defined such that every non-empty open set must contain the particular point.
### Example 4: Checking Hausdorff Conditions (T2)
```python
from finite_topology.known_topologies import create_indiscrete_topology
# Create an indiscrete topology
space = {1, 2, 3}
topology = create_indiscrete_topology(space)
# Check if the topology is Hausdorff
print(f"Is the topology Hausdorff? {topology.is_hausdorff()}")
```
**Expected Output:**
```
Is the topology Hausdorff? False
```
**Note:** In finite spaces, the only Hausdorff topology is the discrete topology, as demonstrated in this [Math StackExchange discussion](https://math.stackexchange.com/questions/21241/finite-hausdorff-topological-spaces).
### Example 5: Generating a Topology from a Subbase
Use the `generate=True` parameter to create a topology from a collection of subsets acting as a subbase.
```python
from finite_topology.topology import Topology
# Define a collection of subsets that act as a subbase
subbase = [{1}, {2, 3}]
# Create the topology generated from the subbase
topology = Topology(collection_of_subsets=subbase, generate=True)
print("Topology generated from subbase:")
print(topology)
```
**Expected Output:**
```
Topology generated from subbase:
Topology(
Space: [1, 2, 3],
Collection of Subsets:
[1, 2, 3]
[]
[1]
[2, 3]
Properties: Not Connected, Compact, Separable
)
```
**Explanation:**
By setting `generate=True`, the topology is automatically generated by closing the provided collection of subsets under finite unions and intersections, thus creating the minimal topology that contains the subbase.
## More Advanced Usage
For a more in-depth exploration, the Jupyter notebooks in the GitHub repository offer guided examples on topics like:
- Constructing topologies based on equivalence relations.
- Exploring the interaction between topologies and continuous functions.
- Understanding the behavior of dense sets in topological spaces.
- Visualizing bases for topologies and how they define open sets.
## Documentation
The complete documentation, including class details and function usage, is generated via Sphinx and hosted on GitHub Pages: https://nand0san.github.io/Topology/
## Contributing
Feel free to contribute! Open an issue or submit a pull request for improvements, bug fixes, or new features.
Raw data
{
"_id": null,
"home_page": "https://github.com/nand0san/Topology",
"name": "finite-topology",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "topology, mathematics, finite sets, discrete topology",
"author": "nand0san",
"author_email": "hancaidolosdos@hotmail.com",
"download_url": "https://files.pythonhosted.org/packages/d7/54/1f7d186286b21b6e719d22651b8ef2c2bc9a870e4863427947d9114497ed/finite-topology-0.1.13.tar.gz",
"platform": null,
"description": "# Finite Topology Library\r\n\r\nA Python library for defining, analyzing, and exploring finite topologies. This toolset is designed for educational purposes, to assist in research, and to make it easy to experiment with topological concepts computationally, using finite sets.\r\n\r\n## Features\r\n\r\n### Construct Common Topologies:\r\n\r\n- **Discrete Topology**: Every subset is open.\r\n- **Indiscrete (Trivial) Topology**: Only the empty set and the entire set are open.\r\n- **Sierpi\u00c5\u201eski Topology**: A classic topology on a two-element set.\r\n- **Particular Point and Excluded Point Topologies**: Control which points are required or excluded in open sets.\r\n- **Divisibility Topology**: Topology based on divisibility relations among integers.\r\n- **Alexandrov Topology**: Topologies that are closed under arbitrary intersections of open sets, useful in domain theory.\r\n\r\n### Analyze Functions Between Spaces:\r\n\r\n- **Continuity**: Check whether a function between two topological spaces is continuous.\r\n- **Homeomorphism**: Analyze whether two spaces are homeomorphic (topologically equivalent) via bijections.\r\n- **Preimage and Image**: Compute preimages of sets under continuous mappings.\r\n\r\n### Topology Properties:\r\n\r\n- **Compactness**: Determine if a topology is compact, a trivial property for finite topologies.\r\n- **Connectedness**: Check if the space can be split into two disjoint open sets.\r\n- **Hausdorff Conditions (T2)**: Verify if any two distinct points have disjoint open neighborhoods.\r\n- **Separation Axioms (T0, T1)**: Study basic separation properties in finite spaces.\r\n\r\n## Installation\r\n\r\nTo install the library, run the following command:\r\n\r\n```bash\r\npip install finite-topology\r\n```\r\n\r\nAlternatively, you can clone the repository and install dependencies:\r\n\r\n```bash\r\ngit clone https://github.com/nand0san/Topology.git\r\ncd finite-topology\r\npip install -r requirements.txt\r\n```\r\n\r\n## Usage\r\n\r\n### Example 1: Create a Discrete Topology and Analyze a Continuous Function\r\n\r\n```python\r\nfrom finite_topology.known_topologies import create_discrete_topology\r\nfrom finite_topology.functions import Function\r\n\r\n# Define two sets\r\nspace = {1, 2, 3}\r\ntarget_space = {'a', 'b', 'c'}\r\n\r\n# Create discrete topologies on both spaces\r\nsource_topology = create_discrete_topology(space)\r\ntarget_topology = create_discrete_topology(target_space)\r\n\r\n# Define a mapping for a continuous function\r\nmapping = {1: 'a', 2: 'b', 3: 'c'}\r\n\r\n# Create a function and verify continuity\r\nf = Function(source_topology, target_topology, mapping)\r\nprint(f\"Is the function continuous? {f.is_continuous()}\")\r\n```\r\n\r\n**Expected Output:**\r\n```\r\nIs the function continuous? True\r\n```\r\n\r\n### Example 2: Study Dense Sets in Finite Topologies\r\n\r\nIn finite topological spaces, dense sets exhibit interesting behavior. Consider the triviality that the entire space is dense in many cases.\r\n\r\n```python\r\nfrom finite_topology.topology import Topology\r\n\r\n# Define a collection of subsets that form a topology\r\nspace = {1, 2, 3}\r\nsubsets = [{1}, {1, 2}, {1, 2, 3}]\r\ntopology = Topology(collection_of_subsets=subsets, generate=False)\r\n\r\n# Find the dense subsets\r\ndense_set = topology.find_dense_subset()\r\nprint(f\"Dense subset: {dense_set}\")\r\n```\r\n\r\n**Explanation:**\r\nIn finite topologies, a set is dense if its closure equals the entire space. The library can compute and return the smallest dense subset or indicate if the entire space is the only dense subset (trivial case).\r\n\r\n**Expected Output:**\r\n```\r\nDense subset: {1}\r\n```\r\n\r\n### Example 3: Topologies with Specific Points (Particular Point Topology)\r\n\r\n```python\r\nfrom finite_topology.known_topologies import create_particular_point_topology\r\n\r\nspace = {1, 2, 3}\r\nparticular_point = 2\r\n\r\n# Create a particular point topology\r\ntopology = create_particular_point_topology(space, particular_point)\r\n\r\nprint(f\"Topology with particular point {particular_point}:\")\r\nprint(topology)\r\n```\r\n\r\n**Expected Output:**\r\n```\r\nTopology with particular point 2:\r\nTopology(\r\n Space: [1, 2, 3],\r\n Collection of Subsets:\r\n [1, 2, 3]\r\n [2]\r\n [1, 2]\r\n [2, 3]\r\n Properties: T0, T1, Connected, Compact, Separable\r\n)\r\n```\r\n\r\nIn this example, the topology is defined such that every non-empty open set must contain the particular point.\r\n\r\n### Example 4: Checking Hausdorff Conditions (T2)\r\n\r\n```python\r\nfrom finite_topology.known_topologies import create_indiscrete_topology\r\n\r\n# Create an indiscrete topology\r\nspace = {1, 2, 3}\r\ntopology = create_indiscrete_topology(space)\r\n\r\n# Check if the topology is Hausdorff\r\nprint(f\"Is the topology Hausdorff? {topology.is_hausdorff()}\")\r\n```\r\n\r\n**Expected Output:**\r\n```\r\nIs the topology Hausdorff? False\r\n```\r\n\r\n**Note:** In finite spaces, the only Hausdorff topology is the discrete topology, as demonstrated in this [Math StackExchange discussion](https://math.stackexchange.com/questions/21241/finite-hausdorff-topological-spaces).\r\n\r\n### Example 5: Generating a Topology from a Subbase\r\n\r\nUse the `generate=True` parameter to create a topology from a collection of subsets acting as a subbase.\r\n\r\n```python\r\nfrom finite_topology.topology import Topology\r\n\r\n# Define a collection of subsets that act as a subbase\r\nsubbase = [{1}, {2, 3}]\r\n\r\n# Create the topology generated from the subbase\r\ntopology = Topology(collection_of_subsets=subbase, generate=True)\r\n\r\nprint(\"Topology generated from subbase:\")\r\nprint(topology)\r\n```\r\n\r\n**Expected Output:**\r\n```\r\nTopology generated from subbase:\r\nTopology(\r\n Space: [1, 2, 3],\r\n Collection of Subsets:\r\n [1, 2, 3]\r\n []\r\n [1]\r\n [2, 3]\r\n Properties: Not Connected, Compact, Separable\r\n)\r\n```\r\n\r\n**Explanation:**\r\nBy setting `generate=True`, the topology is automatically generated by closing the provided collection of subsets under finite unions and intersections, thus creating the minimal topology that contains the subbase.\r\n\r\n## More Advanced Usage\r\n\r\nFor a more in-depth exploration, the Jupyter notebooks in the GitHub repository offer guided examples on topics like:\r\n\r\n- Constructing topologies based on equivalence relations.\r\n- Exploring the interaction between topologies and continuous functions.\r\n- Understanding the behavior of dense sets in topological spaces.\r\n- Visualizing bases for topologies and how they define open sets.\r\n\r\n## Documentation\r\n\r\nThe complete documentation, including class details and function usage, is generated via Sphinx and hosted on GitHub Pages: https://nand0san.github.io/Topology/\r\n\r\n## Contributing\r\n\r\nFeel free to contribute! Open an issue or submit a pull request for improvements, bug fixes, or new features.\r\n\r\n",
"bugtrack_url": null,
"license": null,
"summary": "A Python library for defining and manipulating topologies on finite sets.",
"version": "0.1.13",
"project_urls": {
"Homepage": "https://github.com/nand0san/Topology",
"Source": "https://github.com/nand0san/Topology",
"Tracker": "https://github.com/nand0san/Topology/issues"
},
"split_keywords": [
"topology",
" mathematics",
" finite sets",
" discrete topology"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d7541f7d186286b21b6e719d22651b8ef2c2bc9a870e4863427947d9114497ed",
"md5": "757524970a4565bccc9ef73cf55f5cb8",
"sha256": "49dfdc0c3b5d769bcc81349797459a09df5a45468fbab979e9c0c1aedaa7c82a"
},
"downloads": -1,
"filename": "finite-topology-0.1.13.tar.gz",
"has_sig": false,
"md5_digest": "757524970a4565bccc9ef73cf55f5cb8",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 17467,
"upload_time": "2024-10-27T07:59:44",
"upload_time_iso_8601": "2024-10-27T07:59:44.008495Z",
"url": "https://files.pythonhosted.org/packages/d7/54/1f7d186286b21b6e719d22651b8ef2c2bc9a870e4863427947d9114497ed/finite-topology-0.1.13.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-27 07:59:44",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "nand0san",
"github_project": "Topology",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "finite-topology"
}