foliated-arithmetic 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. foliated_arithmetic-0.1.0/LICENSE +21 -0
  2. foliated_arithmetic-0.1.0/PKG-INFO +179 -0
  3. foliated_arithmetic-0.1.0/README.md +148 -0
  4. foliated_arithmetic-0.1.0/pyproject.toml +73 -0
  5. foliated_arithmetic-0.1.0/setup.cfg +4 -0
  6. foliated_arithmetic-0.1.0/src/foliated_arithmetic/__init__.py +272 -0
  7. foliated_arithmetic-0.1.0/src/foliated_arithmetic/arithmetic.py +222 -0
  8. foliated_arithmetic-0.1.0/src/foliated_arithmetic/balancing.py +301 -0
  9. foliated_arithmetic-0.1.0/src/foliated_arithmetic/coords.py +384 -0
  10. foliated_arithmetic-0.1.0/src/foliated_arithmetic/division.py +251 -0
  11. foliated_arithmetic-0.1.0/src/foliated_arithmetic/geodesic.py +305 -0
  12. foliated_arithmetic-0.1.0/src/foliated_arithmetic/holonomy.py +261 -0
  13. foliated_arithmetic-0.1.0/src/foliated_arithmetic/primality.py +678 -0
  14. foliated_arithmetic-0.1.0/src/foliated_arithmetic/py.typed +0 -0
  15. foliated_arithmetic-0.1.0/src/foliated_arithmetic/transport.py +202 -0
  16. foliated_arithmetic-0.1.0/src/foliated_arithmetic/types.py +365 -0
  17. foliated_arithmetic-0.1.0/src/foliated_arithmetic.egg-info/PKG-INFO +179 -0
  18. foliated_arithmetic-0.1.0/src/foliated_arithmetic.egg-info/SOURCES.txt +28 -0
  19. foliated_arithmetic-0.1.0/src/foliated_arithmetic.egg-info/dependency_links.txt +1 -0
  20. foliated_arithmetic-0.1.0/src/foliated_arithmetic.egg-info/requires.txt +6 -0
  21. foliated_arithmetic-0.1.0/src/foliated_arithmetic.egg-info/top_level.txt +1 -0
  22. foliated_arithmetic-0.1.0/tests/test_arithmetic.py +317 -0
  23. foliated_arithmetic-0.1.0/tests/test_balancing.py +205 -0
  24. foliated_arithmetic-0.1.0/tests/test_coords.py +220 -0
  25. foliated_arithmetic-0.1.0/tests/test_division.py +271 -0
  26. foliated_arithmetic-0.1.0/tests/test_geodesic.py +272 -0
  27. foliated_arithmetic-0.1.0/tests/test_holonomy.py +188 -0
  28. foliated_arithmetic-0.1.0/tests/test_invariants.py +379 -0
  29. foliated_arithmetic-0.1.0/tests/test_primality.py +356 -0
  30. foliated_arithmetic-0.1.0/tests/test_transport.py +263 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Dr. Hassan Baloui
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,179 @@
1
+ Metadata-Version: 2.4
2
+ Name: foliated-arithmetic
3
+ Version: 0.1.0
4
+ Summary: Zero-dependency, strictly typed, exact-integer Python library for Foliated Arithmetic, Chebyshev Geodesics, Discrete Holonomy, and the Minimal Balancing Multiplier.
5
+ Author-email: "Dr. Hassan Baloui" <hassan.baloui@gmail.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://www.new-mathematical-concepts.org
8
+ Project-URL: Repository, https://github.com/hbaloui/foliated-arithmetic
9
+ Project-URL: DOI, https://doi.org/10.5281/zenodo.24430826
10
+ Project-URL: Monograph, https://doi.org/10.5281/zenodo.23456718
11
+ Project-URL: Preprint, https://doi.org/10.5281/zenodo.24109170
12
+ Keywords: number-theory,foliated-arithmetic,geometry-of-integers,discrete-geometry,chebyshev-metric,minimal-balancing-multiplier,oeis
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
21
+ Classifier: Typing :: Typed
22
+ Requires-Python: >=3.10
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Provides-Extra: dev
26
+ Requires-Dist: pytest>=8.0; extra == "dev"
27
+ Requires-Dist: mypy>=1.10; extra == "dev"
28
+ Requires-Dist: ruff>=0.6; extra == "dev"
29
+ Requires-Dist: build>=1.2; extra == "dev"
30
+ Dynamic: license-file
31
+
32
+ # foliated-arithmetic
33
+
34
+ [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.24430826.svg)](https://doi.org/10.5281/zenodo.24430826)
35
+ [![CI](https://github.com/hbaloui/foliated-arithmetic/actions/workflows/ci.yml/badge.svg)](https://github.com/hbaloui/foliated-arithmetic/actions/workflows/ci.yml)
36
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://www.python.org/downloads/)
37
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
38
+
39
+ Zero-dependency, strictly typed, exact-integer Python library implementing **Foliated Arithmetic**, **Chebyshev Geodesic Routing**, **Discrete Holonomy & Curvature**, **Leaf-Local Prime Factorization**, and the **Minimal Balancing Multiplier (MBM)** from *The Geometry of Integers*.
40
+
41
+ * **Zero floating-point drift:** Every integer root (`iroot`), directional shift ($\mu = 2\lambda \in \{0, 1, 2\}$), geodesic distance, factorization, and OEIS sequence uses exact arbitrary-precision integer (or `fractions.Fraction`) arithmetic.
42
+ * **Exact $m = 1$ Peano Correspondence:** Setting `m=1` collapses every coordinate, operator, metric, primality class, and curvature identically to classical commutative Peano arithmetic.
43
+ * **PEP 561 Typed:** Ships with `py.typed` and passes `mypy --strict` with zero issues.
44
+
45
+ ## Installation
46
+
47
+ ```bash
48
+ pip install -e .
49
+ ```
50
+
51
+ For development (tests, strict type checking, linting):
52
+
53
+ ```bash
54
+ pip install -e ".[dev]"
55
+ ```
56
+
57
+ ## Quick Start
58
+
59
+ ```python
60
+ >>> from foliated_arithmetic import (
61
+ ... Direction,
62
+ ... f_add,
63
+ ... f_sub,
64
+ ... f_mul,
65
+ ... f_divmod,
66
+ ... f_mod,
67
+ ... f_quotient,
68
+ ... geodesic_distance,
69
+ ... geodesic_path,
70
+ ... leaf_factorization,
71
+ ... discrete_curvature,
72
+ ... mbm,
73
+ ... prime_count_via_mbm,
74
+ ... shell_mbm_spectrum,
75
+ ... )
76
+
77
+ >>> # Multi-valued, non-commutative foliated addition & unique meet at prime 31 (m = 2)
78
+ >>> f_add(2, 3)
79
+ Triad(left=17, vertical=20, right=23)
80
+ >>> f_add(3, 2)
81
+ Triad(left=11, vertical=13, right=15)
82
+ >>> f_add(3, 4).as_set() & f_add(4, 3).as_set()
83
+ {31}
84
+
85
+ >>> # Cross-origin subtraction on the reflected double-lattice Z_2 (strictly invertible)
86
+ >>> diff = f_sub(13, 2)
87
+ >>> diff
88
+ Triad(left=-13, vertical=3, right=1)
89
+ >>> tuple(f_add(diff[d], 2)[d] for d in Direction)
90
+ (13, 13, 13)
91
+
92
+ >>> # Foliated multiplication & Euclidean division (33 /_2 2)
93
+ >>> f_mul(2, 3)
94
+ Triad(left=26, vertical=30, right=34)
95
+ >>> f_quotient(33, 2)
96
+ 3
97
+ >>> f_mod(33, 2).as_tuple()
98
+ ((0, 7), (0, 3), (0, -1))
99
+
100
+ >>> # Transport-generated Chebyshev geodesic metric & shortest 1-zigzag trajectory
101
+ >>> geodesic_distance(2, 33)
102
+ 4
103
+ >>> geodesic_path(2, 33)
104
+ [2, 7, 14, 23, 33]
105
+
106
+ >>> # Leaf-Local Fundamental Theorem of Arithmetic (scalar x = 861 across m = 2, 3)
107
+ >>> leaf_factorization(861, Direction.VERTICAL, m=2)
108
+ [(123, 2), (201, 1)]
109
+ >>> leaf_factorization(861, Direction.VERTICAL, m=3)
110
+ [(42, 3)]
111
+
112
+ >>> # Discrete holonomy curvature & Minimal Balancing Multiplier (OEIS A382286)
113
+ >>> discrete_curvature(10, Direction.LEFT, Direction.RIGHT)
114
+ 340
115
+ >>> mbm(17)
116
+ 16
117
+ >>> shell_mbm_spectrum(5)
118
+ [1, 5, 3, 1, 25, 1, 25, 1, 3, 8, 1]
119
+ >>> prime_count_via_mbm(100)
120
+ 25
121
+
122
+ >>> # Correspondence Principle: exact collapse to classical Peano arithmetic at m = 1
123
+ >>> f_add(2, 3, m=1).as_tuple()
124
+ (5, 5, 5)
125
+ >>> f_mul(2, 3, m=1).as_tuple()
126
+ (6, 6, 6)
127
+ >>> geodesic_distance(2, 33, m=1)
128
+ 31
129
+
130
+ ```
131
+
132
+ ## Package Architecture
133
+
134
+ | Module | Mathematical Scope |
135
+ | :--- | :--- |
136
+ | `foliated_arithmetic.types` | `Direction` ($\mu = 2\lambda \in \{0, 1, 2\}$), `Triad[T]`, `ShellCoord`, `DivisionResult`, strict validators |
137
+ | `foliated_arithmetic.coords` | Exact `iroot`, power shells $\mathcal{S}_{k,m}$, medians $V_{0,m}$, reflection $\sigma_m$, birth shells $k_0$, leaf depths $d_{\lambda,m}$ |
138
+ | `foliated_arithmetic.transport` | Single-cone $\nabla_{\lambda,m}$ on $\mathbb{N}_m$ and 4-branch reflected shift $\widehat{\nabla}_{\lambda,m}$ on $\mathbb{Z}_m$ |
139
+ | `foliated_arithmetic.arithmetic` | Multi-valued $\oplus_m$, $\ominus_m$, $\otimes_m$, leaf-conserving powers $a^{\langle p \rangle_m}$, left-recursive powers $a^{[p]_m}$ |
140
+ | `foliated_arithmetic.division` | Foliated Euclidean division $\oslash_m$, 2D remainders $(\rho_k, \rho_\lambda)$, divisibility $\mid_{\lambda,m}$, congruence $\equiv_{\lambda,m}$ |
141
+ | `foliated_arithmetic.geodesic` | Transport-generated Chebyshev metric $\delta_m$, 1-zigzag waypoints, shortest trajectories, closed balls |
142
+ | `foliated_arithmetic.primality` | Global $\lambda$-primality $\mathbb{P}_{\lambda,m}$, local leaf-depth primality $\mathcal{D}_{\lambda,m}$, co-leaf product $\odot_{\lambda,m}$, Leaf-Local FTA |
143
+ | `foliated_arithmetic.holonomy` | Holographic self-shift $\widehat{T}_\lambda$, holonomy commutator $[\widehat{T}_{\lambda_1}, \widehat{T}_{\lambda_2}]$, discrete curvature $\mathcal{R}$, shell-to-leaf decoding |
144
+ | `foliated_arithmetic.balancing` | Minimal Balancing Multiplier $\beta_m(n)$ (`A382286`), $\mathcal{Q}_2$ (`A401528`), `A381054`, `A382306`, `A383115`, exact $\pi(x)$ |
145
+
146
+ ## Verification
147
+
148
+ ```bash
149
+ python -m mypy src/foliated_arithmetic
150
+ python -m pytest -v --doctest-modules --doctest-glob="README.md" src/foliated_arithmetic tests README.md
151
+ ```
152
+
153
+ ## Citation
154
+
155
+ If you use `foliated-arithmetic` in your research, please cite the archived software release:
156
+
157
+ ```bibtex
158
+ @software{baloui_2026_foliated_arithmetic,
159
+ author = {Baloui, Hassan},
160
+ title = {{foliated-arithmetic}: Exact-Integer Python Reference Library for The Geometry of Integers},
161
+ month = nov,
162
+ year = 2026,
163
+ publisher = {Zenodo},
164
+ version = {v0.1.0},
165
+ doi = {10.5281/zenodo.24430826},
166
+ url = {https://doi.org/10.5281/zenodo.24430826}
167
+ }
168
+ ```
169
+
170
+ ## References
171
+
172
+ * Dr. Hassan Baloui, *foliated-arithmetic (v0.1.0)*, Zenodo Software Archive: <https://doi.org/10.5281/zenodo.24430826>
173
+ * Dr. Hassan Baloui, *Geometry of Integers*, Zenodo Monograph: <https://doi.org/10.5281/zenodo.23456718>
174
+ * Dr. Hassan Baloui, *The Minimal Balancing Multiplier and the Riemann Zeta Function at Positive Integers*, Zenodo Preprint: <https://doi.org/10.5281/zenodo.24109170>
175
+ * Interactive Research Portal & OEIS Sequence Atlas: <https://www.new-mathematical-concepts.org>
176
+
177
+ ## License
178
+
179
+ MIT License — see [LICENSE](LICENSE).
@@ -0,0 +1,148 @@
1
+ # foliated-arithmetic
2
+
3
+ [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.24430826.svg)](https://doi.org/10.5281/zenodo.24430826)
4
+ [![CI](https://github.com/hbaloui/foliated-arithmetic/actions/workflows/ci.yml/badge.svg)](https://github.com/hbaloui/foliated-arithmetic/actions/workflows/ci.yml)
5
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://www.python.org/downloads/)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
7
+
8
+ Zero-dependency, strictly typed, exact-integer Python library implementing **Foliated Arithmetic**, **Chebyshev Geodesic Routing**, **Discrete Holonomy & Curvature**, **Leaf-Local Prime Factorization**, and the **Minimal Balancing Multiplier (MBM)** from *The Geometry of Integers*.
9
+
10
+ * **Zero floating-point drift:** Every integer root (`iroot`), directional shift ($\mu = 2\lambda \in \{0, 1, 2\}$), geodesic distance, factorization, and OEIS sequence uses exact arbitrary-precision integer (or `fractions.Fraction`) arithmetic.
11
+ * **Exact $m = 1$ Peano Correspondence:** Setting `m=1` collapses every coordinate, operator, metric, primality class, and curvature identically to classical commutative Peano arithmetic.
12
+ * **PEP 561 Typed:** Ships with `py.typed` and passes `mypy --strict` with zero issues.
13
+
14
+ ## Installation
15
+
16
+ ```bash
17
+ pip install -e .
18
+ ```
19
+
20
+ For development (tests, strict type checking, linting):
21
+
22
+ ```bash
23
+ pip install -e ".[dev]"
24
+ ```
25
+
26
+ ## Quick Start
27
+
28
+ ```python
29
+ >>> from foliated_arithmetic import (
30
+ ... Direction,
31
+ ... f_add,
32
+ ... f_sub,
33
+ ... f_mul,
34
+ ... f_divmod,
35
+ ... f_mod,
36
+ ... f_quotient,
37
+ ... geodesic_distance,
38
+ ... geodesic_path,
39
+ ... leaf_factorization,
40
+ ... discrete_curvature,
41
+ ... mbm,
42
+ ... prime_count_via_mbm,
43
+ ... shell_mbm_spectrum,
44
+ ... )
45
+
46
+ >>> # Multi-valued, non-commutative foliated addition & unique meet at prime 31 (m = 2)
47
+ >>> f_add(2, 3)
48
+ Triad(left=17, vertical=20, right=23)
49
+ >>> f_add(3, 2)
50
+ Triad(left=11, vertical=13, right=15)
51
+ >>> f_add(3, 4).as_set() & f_add(4, 3).as_set()
52
+ {31}
53
+
54
+ >>> # Cross-origin subtraction on the reflected double-lattice Z_2 (strictly invertible)
55
+ >>> diff = f_sub(13, 2)
56
+ >>> diff
57
+ Triad(left=-13, vertical=3, right=1)
58
+ >>> tuple(f_add(diff[d], 2)[d] for d in Direction)
59
+ (13, 13, 13)
60
+
61
+ >>> # Foliated multiplication & Euclidean division (33 /_2 2)
62
+ >>> f_mul(2, 3)
63
+ Triad(left=26, vertical=30, right=34)
64
+ >>> f_quotient(33, 2)
65
+ 3
66
+ >>> f_mod(33, 2).as_tuple()
67
+ ((0, 7), (0, 3), (0, -1))
68
+
69
+ >>> # Transport-generated Chebyshev geodesic metric & shortest 1-zigzag trajectory
70
+ >>> geodesic_distance(2, 33)
71
+ 4
72
+ >>> geodesic_path(2, 33)
73
+ [2, 7, 14, 23, 33]
74
+
75
+ >>> # Leaf-Local Fundamental Theorem of Arithmetic (scalar x = 861 across m = 2, 3)
76
+ >>> leaf_factorization(861, Direction.VERTICAL, m=2)
77
+ [(123, 2), (201, 1)]
78
+ >>> leaf_factorization(861, Direction.VERTICAL, m=3)
79
+ [(42, 3)]
80
+
81
+ >>> # Discrete holonomy curvature & Minimal Balancing Multiplier (OEIS A382286)
82
+ >>> discrete_curvature(10, Direction.LEFT, Direction.RIGHT)
83
+ 340
84
+ >>> mbm(17)
85
+ 16
86
+ >>> shell_mbm_spectrum(5)
87
+ [1, 5, 3, 1, 25, 1, 25, 1, 3, 8, 1]
88
+ >>> prime_count_via_mbm(100)
89
+ 25
90
+
91
+ >>> # Correspondence Principle: exact collapse to classical Peano arithmetic at m = 1
92
+ >>> f_add(2, 3, m=1).as_tuple()
93
+ (5, 5, 5)
94
+ >>> f_mul(2, 3, m=1).as_tuple()
95
+ (6, 6, 6)
96
+ >>> geodesic_distance(2, 33, m=1)
97
+ 31
98
+
99
+ ```
100
+
101
+ ## Package Architecture
102
+
103
+ | Module | Mathematical Scope |
104
+ | :--- | :--- |
105
+ | `foliated_arithmetic.types` | `Direction` ($\mu = 2\lambda \in \{0, 1, 2\}$), `Triad[T]`, `ShellCoord`, `DivisionResult`, strict validators |
106
+ | `foliated_arithmetic.coords` | Exact `iroot`, power shells $\mathcal{S}_{k,m}$, medians $V_{0,m}$, reflection $\sigma_m$, birth shells $k_0$, leaf depths $d_{\lambda,m}$ |
107
+ | `foliated_arithmetic.transport` | Single-cone $\nabla_{\lambda,m}$ on $\mathbb{N}_m$ and 4-branch reflected shift $\widehat{\nabla}_{\lambda,m}$ on $\mathbb{Z}_m$ |
108
+ | `foliated_arithmetic.arithmetic` | Multi-valued $\oplus_m$, $\ominus_m$, $\otimes_m$, leaf-conserving powers $a^{\langle p \rangle_m}$, left-recursive powers $a^{[p]_m}$ |
109
+ | `foliated_arithmetic.division` | Foliated Euclidean division $\oslash_m$, 2D remainders $(\rho_k, \rho_\lambda)$, divisibility $\mid_{\lambda,m}$, congruence $\equiv_{\lambda,m}$ |
110
+ | `foliated_arithmetic.geodesic` | Transport-generated Chebyshev metric $\delta_m$, 1-zigzag waypoints, shortest trajectories, closed balls |
111
+ | `foliated_arithmetic.primality` | Global $\lambda$-primality $\mathbb{P}_{\lambda,m}$, local leaf-depth primality $\mathcal{D}_{\lambda,m}$, co-leaf product $\odot_{\lambda,m}$, Leaf-Local FTA |
112
+ | `foliated_arithmetic.holonomy` | Holographic self-shift $\widehat{T}_\lambda$, holonomy commutator $[\widehat{T}_{\lambda_1}, \widehat{T}_{\lambda_2}]$, discrete curvature $\mathcal{R}$, shell-to-leaf decoding |
113
+ | `foliated_arithmetic.balancing` | Minimal Balancing Multiplier $\beta_m(n)$ (`A382286`), $\mathcal{Q}_2$ (`A401528`), `A381054`, `A382306`, `A383115`, exact $\pi(x)$ |
114
+
115
+ ## Verification
116
+
117
+ ```bash
118
+ python -m mypy src/foliated_arithmetic
119
+ python -m pytest -v --doctest-modules --doctest-glob="README.md" src/foliated_arithmetic tests README.md
120
+ ```
121
+
122
+ ## Citation
123
+
124
+ If you use `foliated-arithmetic` in your research, please cite the archived software release:
125
+
126
+ ```bibtex
127
+ @software{baloui_2026_foliated_arithmetic,
128
+ author = {Baloui, Hassan},
129
+ title = {{foliated-arithmetic}: Exact-Integer Python Reference Library for The Geometry of Integers},
130
+ month = nov,
131
+ year = 2026,
132
+ publisher = {Zenodo},
133
+ version = {v0.1.0},
134
+ doi = {10.5281/zenodo.24430826},
135
+ url = {https://doi.org/10.5281/zenodo.24430826}
136
+ }
137
+ ```
138
+
139
+ ## References
140
+
141
+ * Dr. Hassan Baloui, *foliated-arithmetic (v0.1.0)*, Zenodo Software Archive: <https://doi.org/10.5281/zenodo.24430826>
142
+ * Dr. Hassan Baloui, *Geometry of Integers*, Zenodo Monograph: <https://doi.org/10.5281/zenodo.23456718>
143
+ * Dr. Hassan Baloui, *The Minimal Balancing Multiplier and the Riemann Zeta Function at Positive Integers*, Zenodo Preprint: <https://doi.org/10.5281/zenodo.24109170>
144
+ * Interactive Research Portal & OEIS Sequence Atlas: <https://www.new-mathematical-concepts.org>
145
+
146
+ ## License
147
+
148
+ MIT License — see [LICENSE](LICENSE).
@@ -0,0 +1,73 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "foliated-arithmetic"
7
+ version = "0.1.0"
8
+ description = "Zero-dependency, strictly typed, exact-integer Python library for Foliated Arithmetic, Chebyshev Geodesics, Discrete Holonomy, and the Minimal Balancing Multiplier."
9
+ readme = "README.md"
10
+ license = { text = "MIT" }
11
+ requires-python = ">=3.10"
12
+ authors = [
13
+ { name = "Dr. Hassan Baloui", email = "hassan.baloui@gmail.com" },
14
+ ]
15
+ keywords = [
16
+ "number-theory",
17
+ "foliated-arithmetic",
18
+ "geometry-of-integers",
19
+ "discrete-geometry",
20
+ "chebyshev-metric",
21
+ "minimal-balancing-multiplier",
22
+ "oeis",
23
+ ]
24
+ classifiers = [
25
+ "Development Status :: 4 - Beta",
26
+ "Intended Audience :: Science/Research",
27
+ "License :: OSI Approved :: MIT License",
28
+ "Programming Language :: Python :: 3",
29
+ "Programming Language :: Python :: 3.10",
30
+ "Programming Language :: Python :: 3.11",
31
+ "Programming Language :: Python :: 3.12",
32
+ "Topic :: Scientific/Engineering :: Mathematics",
33
+ "Typing :: Typed",
34
+ ]
35
+ dependencies = []
36
+
37
+ [project.urls]
38
+ Homepage = "https://www.new-mathematical-concepts.org"
39
+ Repository = "https://github.com/hbaloui/foliated-arithmetic"
40
+ DOI = "https://doi.org/10.5281/zenodo.24430826"
41
+ Monograph = "https://doi.org/10.5281/zenodo.23456718"
42
+ Preprint = "https://doi.org/10.5281/zenodo.24109170"
43
+
44
+ [project.optional-dependencies]
45
+ dev = [
46
+ "pytest>=8.0",
47
+ "mypy>=1.10",
48
+ "ruff>=0.6",
49
+ "build>=1.2",
50
+ ]
51
+
52
+ [tool.setuptools]
53
+ package-dir = { "" = "src" }
54
+
55
+ [tool.setuptools.packages.find]
56
+ where = ["src"]
57
+
58
+ [tool.setuptools.package-data]
59
+ foliated_arithmetic = ["py.typed"]
60
+
61
+ [tool.pytest.ini_options]
62
+ testpaths = ["tests"]
63
+ addopts = "-ra"
64
+
65
+ [tool.mypy]
66
+ python_version = "3.10"
67
+ strict = true
68
+ warn_unreachable = true
69
+ warn_unused_ignores = true
70
+
71
+ [tool.ruff]
72
+ target-version = "py310"
73
+ line-length = 100
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,272 @@
1
+ """
2
+ Foliated Arithmetic — Exact-Integer Reference Library
3
+ -----------------------------------------------------
4
+ Zero-dependency, strictly typed, exact-integer Python implementation of
5
+ *The Geometry of Integers* (Dr. Hassan Baloui, DOI: 10.5281/zenodo.23456718)
6
+ and *The Minimal Balancing Multiplier and the Riemann Zeta Function at
7
+ Positive Integers* (DOI: 10.5281/zenodo.24109170).
8
+
9
+ Quick-start doctests::
10
+
11
+ >>> from foliated_arithmetic import (
12
+ ... Direction,
13
+ ... f_add,
14
+ ... f_sub,
15
+ ... f_mul,
16
+ ... f_mod,
17
+ ... f_quotient,
18
+ ... geodesic_distance,
19
+ ... geodesic_path,
20
+ ... leaf_factorization,
21
+ ... discrete_curvature,
22
+ ... mbm,
23
+ ... shell_mbm_spectrum,
24
+ ... )
25
+ >>> f_add(2, 3)
26
+ Triad(left=17, vertical=20, right=23)
27
+ >>> f_add(3, 4).as_set() & f_add(4, 3).as_set()
28
+ {31}
29
+ >>> f_sub(13, 2)
30
+ Triad(left=-13, vertical=3, right=1)
31
+ >>> f_mul(2, 3)
32
+ Triad(left=26, vertical=30, right=34)
33
+ >>> (f_quotient(33, 2), f_mod(33, 2).as_tuple())
34
+ (3, ((0, 7), (0, 3), (0, -1)))
35
+ >>> geodesic_distance(2, 33)
36
+ 4
37
+ >>> geodesic_path(2, 33)
38
+ [2, 7, 14, 23, 33]
39
+ >>> leaf_factorization(861, Direction.VERTICAL, m=2)
40
+ [(123, 2), (201, 1)]
41
+ >>> discrete_curvature(10, Direction.LEFT, Direction.RIGHT)
42
+ 340
43
+ >>> mbm(17)
44
+ 16
45
+ >>> shell_mbm_spectrum(5)
46
+ [1, 5, 3, 1, 25, 1, 25, 1, 3, 8, 1]
47
+ >>> f_add(2, 3, m=1).as_tuple(), f_mul(2, 3, m=1).as_tuple()
48
+ ((5, 5, 5), (6, 6, 6))
49
+ """
50
+
51
+ from __future__ import annotations
52
+
53
+ from foliated_arithmetic.arithmetic import (
54
+ add_dir,
55
+ f_add,
56
+ f_mul,
57
+ f_pow,
58
+ f_recursive_pow,
59
+ f_sub,
60
+ mul_dir,
61
+ pow_dir,
62
+ recursive_pow_dir,
63
+ sub_dir,
64
+ )
65
+ from foliated_arithmetic.balancing import (
66
+ central_divisors,
67
+ is_balanced,
68
+ is_square_multiplier,
69
+ mbm,
70
+ mbm_first_moment,
71
+ prime_count_via_mbm,
72
+ prime_indicator_via_mbm,
73
+ shell_balanced_count,
74
+ shell_discrepancy,
75
+ shell_mbm_spectrum,
76
+ shell_unit_discrepancy_count,
77
+ unit_discrepancy_multiplier,
78
+ )
79
+ from foliated_arithmetic.coords import (
80
+ birth_shell,
81
+ depth_triad,
82
+ from_leaf_coord,
83
+ iroot,
84
+ lateral_generator,
85
+ leaf_coord,
86
+ leaf_depth,
87
+ leaf_root,
88
+ min_shell,
89
+ shell_bounds,
90
+ shell_coord,
91
+ shell_index,
92
+ shell_median,
93
+ shell_reflection,
94
+ shell_size,
95
+ )
96
+ from foliated_arithmetic.division import (
97
+ exact_quotient_dir,
98
+ f_divmod,
99
+ f_divmod_dir,
100
+ f_mod,
101
+ f_mod_dir,
102
+ f_quotient,
103
+ is_congruent,
104
+ is_divisible,
105
+ is_divisible_triad,
106
+ )
107
+ from foliated_arithmetic.geodesic import (
108
+ RoutingRegime,
109
+ bounding_direction,
110
+ geodesic_ball,
111
+ geodesic_distance,
112
+ geodesic_path,
113
+ routing_regime,
114
+ transport_geodesic_distance,
115
+ virtual_waypoint,
116
+ zigzag_waypoint,
117
+ )
118
+ from foliated_arithmetic.holonomy import (
119
+ decode_holographic_image,
120
+ discrete_curvature,
121
+ holonomy_commutator,
122
+ is_forbidden_self_shift_shell,
123
+ normalized_curvature,
124
+ reverse_self_shift,
125
+ self_shift,
126
+ self_shift_triad,
127
+ )
128
+ from foliated_arithmetic.primality import (
129
+ LeafClass,
130
+ co_leaf_mul,
131
+ co_leaf_pow,
132
+ count_classical_primes,
133
+ factor_integer,
134
+ foliated_divisors,
135
+ intrinsic_leaf_depth_power,
136
+ is_classical_prime,
137
+ is_foliated_prime,
138
+ is_foliated_prime_triad,
139
+ is_local_leaf_prime,
140
+ is_local_leaf_prime_triad,
141
+ is_omni_foliated_prime,
142
+ is_triple_leaf_prime,
143
+ leaf_classification,
144
+ leaf_factorization,
145
+ leaf_factorization_triad,
146
+ reconstruct_leaf_factorization,
147
+ shell_local_prime_count,
148
+ )
149
+ from foliated_arithmetic.transport import (
150
+ nabla,
151
+ nabla_hat,
152
+ nabla_hat_triad,
153
+ nabla_triad,
154
+ )
155
+ from foliated_arithmetic.types import (
156
+ CANONICAL_DIRECTIONS,
157
+ Direction,
158
+ DivisionResult,
159
+ DomainError,
160
+ FoliatedArithmeticError,
161
+ InvalidDegreeError,
162
+ ShellCoord,
163
+ Triad,
164
+ require_int,
165
+ validate_degree,
166
+ validate_non_negative,
167
+ validate_positive,
168
+ )
169
+
170
+ __version__ = "0.1.0"
171
+
172
+ __all__ = [
173
+ "CANONICAL_DIRECTIONS",
174
+ "Direction",
175
+ "DivisionResult",
176
+ "DomainError",
177
+ "FoliatedArithmeticError",
178
+ "InvalidDegreeError",
179
+ "LeafClass",
180
+ "RoutingRegime",
181
+ "ShellCoord",
182
+ "Triad",
183
+ "__version__",
184
+ "add_dir",
185
+ "birth_shell",
186
+ "bounding_direction",
187
+ "central_divisors",
188
+ "co_leaf_mul",
189
+ "co_leaf_pow",
190
+ "count_classical_primes",
191
+ "decode_holographic_image",
192
+ "depth_triad",
193
+ "discrete_curvature",
194
+ "exact_quotient_dir",
195
+ "f_add",
196
+ "f_divmod",
197
+ "f_divmod_dir",
198
+ "f_mod",
199
+ "f_mod_dir",
200
+ "f_mul",
201
+ "f_pow",
202
+ "f_quotient",
203
+ "f_recursive_pow",
204
+ "f_sub",
205
+ "factor_integer",
206
+ "foliated_divisors",
207
+ "from_leaf_coord",
208
+ "geodesic_ball",
209
+ "geodesic_distance",
210
+ "geodesic_path",
211
+ "holonomy_commutator",
212
+ "intrinsic_leaf_depth_power",
213
+ "iroot",
214
+ "is_balanced",
215
+ "is_classical_prime",
216
+ "is_congruent",
217
+ "is_divisible",
218
+ "is_divisible_triad",
219
+ "is_foliated_prime",
220
+ "is_foliated_prime_triad",
221
+ "is_forbidden_self_shift_shell",
222
+ "is_local_leaf_prime",
223
+ "is_local_leaf_prime_triad",
224
+ "is_omni_foliated_prime",
225
+ "is_square_multiplier",
226
+ "is_triple_leaf_prime",
227
+ "lateral_generator",
228
+ "leaf_classification",
229
+ "leaf_coord",
230
+ "leaf_depth",
231
+ "leaf_factorization",
232
+ "leaf_factorization_triad",
233
+ "leaf_root",
234
+ "mbm",
235
+ "mbm_first_moment",
236
+ "min_shell",
237
+ "mul_dir",
238
+ "nabla",
239
+ "nabla_hat",
240
+ "nabla_hat_triad",
241
+ "nabla_triad",
242
+ "normalized_curvature",
243
+ "pow_dir",
244
+ "prime_count_via_mbm",
245
+ "prime_indicator_via_mbm",
246
+ "reconstruct_leaf_factorization",
247
+ "recursive_pow_dir",
248
+ "require_int",
249
+ "reverse_self_shift",
250
+ "routing_regime",
251
+ "self_shift",
252
+ "self_shift_triad",
253
+ "shell_balanced_count",
254
+ "shell_bounds",
255
+ "shell_coord",
256
+ "shell_discrepancy",
257
+ "shell_index",
258
+ "shell_local_prime_count",
259
+ "shell_mbm_spectrum",
260
+ "shell_median",
261
+ "shell_reflection",
262
+ "shell_size",
263
+ "shell_unit_discrepancy_count",
264
+ "sub_dir",
265
+ "transport_geodesic_distance",
266
+ "unit_discrepancy_multiplier",
267
+ "validate_degree",
268
+ "validate_non_negative",
269
+ "validate_positive",
270
+ "virtual_waypoint",
271
+ "zigzag_waypoint",
272
+ ]