ecological_sign_rules 0.5.3__py3-none-any.whl

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.
@@ -0,0 +1,248 @@
1
+ Metadata-Version: 2.4
2
+ Name: ecological_sign_rules
3
+ Version: 0.5.3
4
+ Summary: Prove Lotka-Volterra sign patterns impossible, with machine certificates and an independent checker
5
+ Author-email: Georgy Scholten <scholtengeorgy@gmail.com>
6
+ Maintainer-email: Georgy Scholten <scholtengeorgy@gmail.com>
7
+ License-Expression: MIT
8
+ Project-URL: Repository, https://github.com/gescholt/signrules
9
+ Project-URL: Documentation, https://github.com/gescholt/signrules/blob/main/docs/SIGNRULES.md
10
+ Project-URL: Issues, https://github.com/gescholt/signrules/issues
11
+ Project-URL: Changelog, https://github.com/gescholt/signrules/blob/main/CHANGELOG.md
12
+ Project-URL: DOI, https://doi.org/10.5281/zenodo.24214426
13
+ Keywords: Lotka-Volterra,sign pattern,qualitative stability,mathematical ecology,oriented matroid,chirotope,Grassmannian,computer-assisted proof,certificate
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Environment :: Console
16
+ Classifier: Intended Audience :: Science/Research
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
24
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
25
+ Requires-Python: >=3.10
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ Requires-Dist: numpy>=1.24
29
+ Requires-Dist: matplotlib>=3.7
30
+ Requires-Dist: networkx>=3.0
31
+ Requires-Dist: rich>=13.0
32
+ Requires-Dist: textual>=1.0
33
+ Provides-Extra: live
34
+ Requires-Dist: questionary>=2.0; extra == "live"
35
+ Provides-Extra: html
36
+ Requires-Dist: plotly>=5.0; extra == "html"
37
+ Provides-Extra: all
38
+ Requires-Dist: ecological_sign_rules[html,live]; extra == "all"
39
+ Dynamic: license-file
40
+
41
+ # signrules
42
+
43
+ [![tests](https://github.com/gescholt/signrules/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/gescholt/signrules/actions/workflows/ci.yml)
44
+ [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.24214426.svg)](https://doi.org/10.5281/zenodo.24214426)
45
+
46
+ `signrules` proves Lotka–Volterra sign patterns **impossible**. Every proof comes with a machine certificate,
47
+ and an independent checker replays it.
48
+
49
+ A Lotka–Volterra community `ẋ = diag(x)(a − Bx)` is described qualitatively by its *sign pattern*: the signs
50
+ of the growth rates `a` and of the interaction matrix `B`. The pattern is *possible* if some magnitudes with
51
+ these signs have a positive equilibrium that is locally asymptotically stable, and *impossible* otherwise.
52
+
53
+ ## Install
54
+
55
+ ```bash
56
+ uv tool install ecological_sign_rules # the signrules command; Python 3.10 or later
57
+ ```
58
+
59
+ The package is `ecological_sign_rules` on [PyPI](https://pypi.org/project/ecological_sign_rules/) and imports
60
+ as `signrules`. Without installing: `uvx --from ecological_sign_rules signrules`. In a project:
61
+ `uv add ecological_sign_rules`. [uv](https://docs.astral.sh/uv/) itself installs with
62
+ `curl -LsSf https://astral.sh/uv/install.sh | sh` or `brew install uv`.
63
+
64
+ ## First run
65
+
66
+ ```bash
67
+ signrules
68
+ ```
69
+
70
+ <img src="https://raw.githubusercontent.com/gescholt/signrules/main/docs/figures/app_A-e.png" width="760" alt="the signrules app: the sign matrix of the pattern A-e, its interaction network, and the verdict IMPOSSIBLE in the status line">
71
+
72
+ This opens an app in the terminal:
73
+
74
+ 1. **Pick a pattern** in the library (↑ ↓, enter), or start from an empty matrix.
75
+ 2. **Edit it**: the arrow keys move over the sign matrix `[diag(a) | B]`, space flips a sign, `<` and `>`
76
+ remove or add a species.
77
+ 3. **Press `r`** to search. A dashboard shows the search live; the verdict comes at the end, with the
78
+ certificate under it for an impossible pattern.
79
+
80
+ `?` lists every key; Esc goes back, `q` quits.
81
+
82
+ The same from the command line:
83
+
84
+ ```bash
85
+ signrules run --preset A-e # a four-species pattern proved impossible: verdict and certificate
86
+ signrules run --a +--- --B "+-++/-+++/+++-/++-+" # your own pattern: the signs of a, then the rows of B
87
+ signrules verify # check the classification on four, five and six species
88
+ ```
89
+
90
+ ## Verdicts and terms
91
+
92
+ A search ends in one of three verdicts:
93
+
94
+ * **Impossible**: no magnitudes with these signs have a stable positive equilibrium. The certificate printed
95
+ with the verdict is the proof, and the independent checker has replayed it.
96
+ * **Not decided by the rules**: some sign tables survive every rule. The pattern may be possible; the rules
97
+ cannot tell.
98
+ * **Undecided**: the search stopped at its node limit (20,000 by default; `--max-nodes 0` lifts it).
99
+
100
+ The words used below:
101
+
102
+ * **sign table**: a sign for every minor of `B` (equivalently, every Plücker coordinate of `[diag(a) | B]`).
103
+ * **killed**: every sign table is ruled out, so the pattern is impossible. **Killed at the root**: ruled out
104
+ by propagation alone, before any branching; the certificate is then a short list of steps.
105
+ * **completion**: a full sign table that no rule rules out.
106
+ * **certificate**: the steps from the pattern to a contradiction, each naming the identity or inequality
107
+ that forces it.
108
+ * **trivial**: some obligate species has only harmful interactions, so no positive equilibrium exists at all.
109
+ * **deletion lemma**: deleting a species from an impossible pattern leaves an impossible or trivial one. So
110
+ every impossible pattern on n species extends one on n − 1 species, and the *extension screen* lists the
111
+ candidates.
112
+ * **minimal impossible**: impossible, with every one-species deletion impossible or trivial.
113
+
114
+ ## Commands
115
+
116
+ | command | what it does |
117
+ |---|---|
118
+ | `run` | complete one pattern with a live dashboard; prints the verdict and, for a kill, the certificate |
119
+ | `tree` | complete one pattern and write an interactive HTML viewer of the search tree |
120
+ | `replay` | kill one pattern at the root and check its certificate with the independent replayer |
121
+ | `edit` | the full-screen app (also plain `signrules`): library, matrix editor, network, rules, search, verdict |
122
+ | `presets` | list the named patterns (the eleven n = 4 patterns, the n = 5, 6 presets) with short ids |
123
+ | `screen` | list the candidates for impossible n-species patterns (deletion lemma) and run the rules on each |
124
+ | `verify` | check the classification on four, five and six species: every pattern killed or certified possible |
125
+
126
+ `signrules <command> --help` gives the options and examples. Signs are written `+-...`, `+,-,...` or
127
+ `1,-1,...`; the rows of `B` are separated by `/`, and its diagonal is `+`. A preset is named by its short id
128
+ (`signrules presets`) or any unambiguous prefix of its name. `--rules` takes `all` (the default), `annals`
129
+ (the rules of the first paper below) or a list such as `R1,R2,R7`. `--plain`, or output to a file, prints the
130
+ verdict only. `--cert DIR` draws the certificate (needs Graphviz). `python -m signrules` is the same command.
131
+
132
+ ## What it proves
133
+
134
+ * **Four species**: each of the 3044 patterns up to relabelling is decided. 715 are killed at the root (11
135
+ of them non-trivial: the eleven candidates of Meng et al.); each of the other 2329 has a *certificate of
136
+ possibility*, a rational matrix whose equilibrium is checked stable in exact arithmetic.
137
+ * **Five and six species**: the deletion lemma, applied to the impossible patterns on one species fewer,
138
+ leaves 83 candidates at n = 5 and 143 at n = 6, and every one is decided: 24 and 41 are killed at the root,
139
+ the other 59 and 102 have certificates of possibility. So exactly 24 five-species and 41 six-species
140
+ patterns are impossible, the minimal impossible patterns.
141
+
142
+ `signrules verify` checks all of this from the data shipped with the package, in about 15 seconds: it
143
+ rebuilds the candidate lists, redoes and replays every kill, and checks every certificate.
144
+ * **Any number of species**: two benefactor-permutation families are impossible (`scripts/families.py`).
145
+
146
+ ## Use from Python
147
+
148
+ ```python
149
+ from signrules import Ecology, complete
150
+
151
+ eco = Ecology.parse("+---", "+-++/-+++/+++-/++-+") # the strings of the command line; lists of ±1 work too
152
+ print(eco) # the sign matrix [diag(a) | B]
153
+ result = complete(eco)
154
+ print(result.verdict, result.summary()) # impossible impossible at the root (R8 real eigenvalue ...)
155
+ ```
156
+
157
+ * For a kill, `replay_kill(eco, result)` re-derives every step with the independent checker, and
158
+ `write_certificate(eco, result, "cert")` draws the certificate (needs Graphviz).
159
+ * For an open pattern, `result.completions` holds the surviving sign tables, and `eco.minor_signs(table)`
160
+ names one as `{minor: sign}`.
161
+ * `signrules.patterns` has the named patterns: `ELEVEN` (four species), `PATTERNS` (five and six),
162
+ `parity_pattern`, `random_pattern`.
163
+ * `signrules.data` has the classification: `census(4)`, and `screen_records(n)`, `root_kills(n)` and
164
+ `possible(n)` for n = 5, 6. `signrules.possible.check_witness` checks a certificate of possibility.
165
+
166
+ The docstring of `complete` lists its options.
167
+
168
+ ## How it works
169
+
170
+ The matrix `[diag(a) | B]` is a point of the Grassmannian `Gr(n, 2n)`, and every Plücker coordinate is a minor
171
+ of `B` up to a known sign. Feasibility and stability become constraints on one set of sign variables. The
172
+ search propagates the 3-term Grassmann–Plücker relations and the rules below to a fixed point, then branches
173
+ on an open sign. A contradiction kills the branch, and the steps that led to it form the certificate. The
174
+ tests check that the rules never reject a genuine feasible, stable system.
175
+
176
+ <img src="https://raw.githubusercontent.com/gescholt/signrules/main/docs/figures/algorithm.png" width="520" alt="one run of the search: initial signs, propagation to a fixed point, then a contradiction, a completion or a branch">
177
+
178
+ | rule | what it says | source |
179
+ |---|---|---|
180
+ | `R1` | stability: `det B > 0` and positive coefficients of the characteristic polynomial | [1] |
181
+ | `R2n` | Cramer's rule on the full system | [1] |
182
+ | `R2` | Cramer's rule on every subsystem | [2] |
183
+ | `R3` | balanced patterns: the principal-minor signs of an M-matrix | [2], Theorems 3.1–3.2 |
184
+ | `R5` | Laplace expansion of every minor along a row or a column | [2] |
185
+ | `R7` | tope rule, the oriented-matroid Farkas lemma; it contains `R2` | new |
186
+ | `R8` | a real positive eigenvalue for benefactor-permutation patterns | new |
187
+
188
+ The two new rules will appear in a paper in preparation. Two rules from [2], `R4` and `R6`, are subsumed by
189
+ these and not run. [docs/SIGNRULES.md](https://github.com/gescholt/signrules/blob/main/docs/SIGNRULES.md)
190
+ gives the full account: the dictionary between minors and Plücker coordinates, each rule with its proof,
191
+ certificates and replay, the search, and the screens.
192
+
193
+ ## Conventions
194
+
195
+ Species are numbered from 0 here and from 1 in the papers. `b_ii > 0`. `B[i, j] < 0`: species `j` benefits
196
+ species `i` (food, a mutualist); `B[i, j] > 0`: `i` loses to `j` (competition, predation). `a_i > 0`: species
197
+ `i` grows alone (free); `a_i < 0`: it does not (obligate). In `[diag(a) | B]` the columns `0..n-1` carry
198
+ `diag(a)` and `n..2n-1` carry `B`, so `p_0367` is the Plücker coordinate on columns 0, 3, 6, 7. In the
199
+ network drawings, a dashed arrow i → j means that i benefits from j, a red line joins two species that each
200
+ lose to the other, and free species are pink, obligate ones blue.
201
+
202
+ ## Reproducing the papers
203
+
204
+ The package does not need the `scripts/` folder; the scripts reproduce the numbers of the papers from a clone
205
+ of the repository. Their records are in `data/`.
206
+
207
+ | result | command |
208
+ |---|---|
209
+ | the eleven four-species kills; with `--rules R1,R2n`, the completion counts of [1] (S-d, S-e, A-a, A-c: 64, 64, 1996, 1528) | `uv run python scripts/impossible_eleven.py` |
210
+ | the extension screens: 83 candidates at n = 5, 143 at n = 6 | `signrules screen 5 --out n5.jsonl`, `signrules screen 6 --out n6.jsonl` |
211
+ | every root kill replays, and flipping any single step makes the replay fail | `uv run python scripts/replay_certificates.py 6 --tamper` (and 4, 5) |
212
+ | the exhaustive five-species screen of all 248,436 non-trivial patterns up to relabelling: 21 kills under R1–R6, three more by R8 | `uv run python scripts/screen_all.py --rules R1,R2,R3,R4,R5,R6` (100 CPU-minutes) |
213
+ | the benefactor-permutation families | `uv run python scripts/families.py` |
214
+ | what each rule adds on the minimal impossible patterns | `uv run python scripts/rule_ladder.py 4 5 6 --out ladder.jsonl` |
215
+ | R4 and R6 are subsumed by the other rules | `uv run python scripts/rule_ablation.py 3 4 --census`, `uv run python scripts/r4_subsumption.py 3 4 --rules R1,R7 --others` |
216
+
217
+ ## Development
218
+
219
+ ```bash
220
+ git clone https://github.com/gescholt/signrules.git && cd signrules
221
+ uv sync --all-extras # the environment from uv.lock, with the extras and pytest
222
+ uv run pytest -q # about a minute
223
+ ```
224
+
225
+ The extras are `live` (questionary: menus for `signrules run` without a pattern) and `html` (plotly, for
226
+ `save_search_tree_html`). Graphviz (`apt install graphviz`, `brew install graphviz`) is needed only to draw
227
+ certificates and trees.
228
+
229
+ ## Papers
230
+
231
+ The package extends the sign-completion algorithm of [1] with the arguments of [2], read as propagation rules:
232
+
233
+ * [1] T. Ö. Çelik, P. A. Haas, G. Scholten, K. Wang, G. Zucal, *Strata of ecological coexistence via
234
+ Grassmannians*, Ann. Comb. (2026), [doi:10.1007/s00026-026-00837-7](https://doi.org/10.1007/s00026-026-00837-7),
235
+ [arXiv:2509.00165](https://arxiv.org/abs/2509.00165).
236
+ * [2] T. Ö. Çelik, V. A. Isoldi, I. Portakal, G. Zucal, *Stable coexistence in ecologies and games* (2026),
237
+ [arXiv:2609.09286](https://arxiv.org/abs/2609.09286).
238
+
239
+ The four-species patterns come from Y. Meng, S. Horvát, C. D. Modes, P. A. Haas, *Impossible ecologies:
240
+ interaction networks and stability of coexistence in ecological communities*, Cell Systems 16 (2025) 101297,
241
+ [doi:10.1016/j.cels.2025.101297](https://doi.org/10.1016/j.cels.2025.101297).
242
+
243
+ ## Citation and licence
244
+
245
+ Every release is archived on Zenodo: [doi:10.5281/zenodo.24214426](https://doi.org/10.5281/zenodo.24214426)
246
+ (all versions). To cite, see [CITATION.cff](https://github.com/gescholt/signrules/blob/main/CITATION.cff).
247
+ Changes are listed in [CHANGELOG.md](https://github.com/gescholt/signrules/blob/main/CHANGELOG.md). MIT
248
+ licence. Questions and bug reports: [open an issue](https://github.com/gescholt/signrules/issues).
@@ -0,0 +1,35 @@
1
+ ecological_sign_rules-0.5.3.dist-info/licenses/LICENSE,sha256=cKtdc5Hj3eKIc2XBlIGZJcOnmuHFG1A2z-ATm3xjmNg,1072
2
+ signrules/__init__.py,sha256=XtOJ8yiTIkiRZHqJz_A33fBUGeIVbhcBOaULkqHF_Kc,2893
3
+ signrules/__main__.py,sha256=5GqTR2gLdB1a5bCkSMAfAvq9_ukY-e8kBbSGzFgFN5c,112
4
+ signrules/certificate.py,sha256=wGXiRofWyQYeTUIHEip1vSQPuvm8Q9snBZ5nvMbK7L8,30452
5
+ signrules/chirotope.py,sha256=7AFhzHANNhe8m6fgMlNY2gYsc7EVr1MLsl-QWoQHBXo,4995
6
+ signrules/cli.py,sha256=_ZUiuRujEAPwFjwS4gE-ZVV6h3ZXoAjvbETf6IMdixQ,30438
7
+ signrules/editor.py,sha256=w0dutAqRpfgPcAMEQE4kGr08ZqcvpAU2kP2Fnuqbxlc,33738
8
+ signrules/engine.py,sha256=mEx0Ya05RxBBjGYKBO4W6okG9FLT2jl2Gms2oCQEiGU,14522
9
+ signrules/gvrender.py,sha256=233IvgQSrhxxjH-sw22JBULphSXf0lm1tP6W7TZGviI,20080
10
+ signrules/labels.py,sha256=1nXXQYMPy55zKQCw-ZTQjmsrz5MWhcoDZ0L27F1N_98,12867
11
+ signrules/livesearch.py,sha256=vNqYLVCj4ngdhMu87Uqgg5Y4aGoWGpB17EtxU64-h8g,18530
12
+ signrules/network.py,sha256=RR1fBXQdBGA_IRdcY0OeZzlsgHojRmoDzCbx7yW5YCc,9071
13
+ signrules/patterns.py,sha256=N9v4McLG7jT72Fez8ub8-1L-_xRIYAby59jFi_6fKuk,20737
14
+ signrules/plucker_index.py,sha256=L9K9ZA5NdGzU95xDHXlevaUj-9KNlmTsBSiCtu-eJ-o,6955
15
+ signrules/possible.py,sha256=iuxMu5twl0bVO_skK9VfeBMyoVt5MHAZ-J4YmMUX2lM,4035
16
+ signrules/replay.py,sha256=300ZGlJ4xyh3BYNWHkTkdh8MAx4-SBnv1Twu_3gSrhY,35062
17
+ signrules/report.py,sha256=FN8C6FW0EIWaferHmqUx8AH_KNZ84-Jn8NGSBUVuKu0,8440
18
+ signrules/rules.py,sha256=jqGXZuUoaIGjrFXD84IBjfvFXRIKlzkvmq_9gdDwyms,44402
19
+ signrules/screen.py,sha256=jkP9WdQGapjxm5jBgnnhYZmYBPUMz2MyF4Rav5uCTQc,8684
20
+ signrules/search.py,sha256=dS0k5iC7x6pseuN0-4POG7AnJZJja8Sv3oSKISxw4oc,26993
21
+ signrules/style.py,sha256=KAiXEsCJDGP_KkeEOZM4WXvsonH8Xm4LpWZE7VTANdY,3703
22
+ signrules/symmetry.py,sha256=LUj8lkJWT2HTDMbDoagdfjYmxhnY1tdOhJkRSUdHYkQ,3851
23
+ signrules/treeplot.py,sha256=7fZsZ80kXUDZEH_XilQiI4I4eTXy48cJi6WgTrHLwpM,14429
24
+ signrules/treeview.py,sha256=YaNVE7EZVUSI29xblL5Ww6uTMlywMRjdjtVpXOe2jQQ,30732
25
+ signrules/data/__init__.py,sha256=3b_r3odtvCkzBhpA4QRj90IqP8xDHhcFD1Ge6GayUh0,2411
26
+ signrules/data/n4/census.jsonl,sha256=SIC7IXK8KhN-9Ua2TW0PKotuX_5gvzAfdCI7vEWJ_mk,556359
27
+ signrules/data/n5/extension_screen.jsonl,sha256=uGB6GPJJkA9w5RTxWejKVVRrJydr-cHQfsUbTIHX9Hc,21426
28
+ signrules/data/n5/possible.jsonl,sha256=XDytXXtpTM1LNcuG-2Phs-EUEhk--2GpIOOtnlkFYFU,14304
29
+ signrules/data/n6/extension_screen.jsonl,sha256=mYfjsoq5sxIHO-YX929XclL888kJjPSXmksAOqH1OYE,44154
30
+ signrules/data/n6/possible.jsonl,sha256=l7WpeAWJaEpHn-XAEnhE9GNJE1S5Ha1tES-EGjBIhLM,32872
31
+ ecological_sign_rules-0.5.3.dist-info/METADATA,sha256=UjZxzDYBDLoegAztvtMiD-wETCuozUf_Q62IYCvoYEM,14484
32
+ ecological_sign_rules-0.5.3.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
33
+ ecological_sign_rules-0.5.3.dist-info/entry_points.txt,sha256=lNN-xwulgS3TpbLoCWgmb4Uxx2rhIJtOyeXiXU0GmTA,49
34
+ ecological_sign_rules-0.5.3.dist-info/top_level.txt,sha256=tl0mHF7DTvASfSRYA_b3MC9RnOtGLYgfj-e5LWed5aY,10
35
+ ecological_sign_rules-0.5.3.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ signrules = signrules.cli:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Georgy Scholten
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 @@
1
+ signrules
signrules/__init__.py ADDED
@@ -0,0 +1,51 @@
1
+ """
2
+ Sign rules on the ecological Grassmannian: decide impossibility of a
3
+ Lotka–Volterra sign pattern by propagating signs of the minors of B.
4
+
5
+ Typical use::
6
+
7
+ from signrules import Ecology, complete
8
+
9
+ eco = Ecology.parse("+---", "+-++/-+++/+++-/++-+") # signs of a; rows of B (b_ij < 0: j benefits i)
10
+ print(eco) # the sign matrix [diag(a) | B]
11
+ result = complete(eco)
12
+ print(result.verdict, result.summary()) # impossible | open | undecided, and one line why
13
+
14
+ from signrules import ELEVEN # the named patterns: ELEVEN, PATTERNS, presets()
15
+ a, B = ELEVEN["S-a obligate mutualism"]
16
+ print(complete(Ecology(a, B)).summary()) # "impossible at the root (R3 balanced ...)"
17
+
18
+ See docs/SIGNRULES.md for the mathematics and rules.py for the rule catalogue.
19
+ """
20
+ from importlib.metadata import PackageNotFoundError, version as _version
21
+
22
+ try:
23
+ __version__ = _version("ecological_sign_rules")
24
+ except PackageNotFoundError: # imported from a checkout that was never installed
25
+ __version__ = "unknown"
26
+
27
+ from .plucker_index import PluckerIndex, UNKNOWN, index
28
+ from .chirotope import build_relations, build_relation_ids, propagate, violates
29
+ from .rules import Ecology, Conflict
30
+ from .search import complete, SearchResult, Derivation
31
+ from .certificate import (certificate_diagram, certificate_dot, write_certificate,
32
+ completion_diagram, completion_dot, write_completion,
33
+ search_tree_text, search_tree_diagram, search_tree_dot, write_search_tree)
34
+ from .gvrender import Diagram
35
+ from . import labels, style
36
+ from .treeplot import plot_search_tree, save_search_tree_png, search_tree_plotly, save_search_tree_html
37
+ from .replay import Replayer, ReplayReport, replay_certificate, replay_kill
38
+ from . import patterns
39
+ from .patterns import (ELEVEN, PATTERNS, parity_pattern, random_pattern, canonical_classes, trivial,
40
+ parse_signs, parse_pattern, presets, resolve_preset)
41
+
42
+ __all__ = ["PluckerIndex", "UNKNOWN", "index", "build_relations", "build_relation_ids", "propagate", "violates",
43
+ "Ecology", "Conflict", "complete", "SearchResult", "Derivation",
44
+ "Replayer", "ReplayReport", "replay_certificate", "replay_kill",
45
+ "certificate_diagram", "certificate_dot", "write_certificate",
46
+ "completion_diagram", "completion_dot", "write_completion",
47
+ "search_tree_text", "search_tree_diagram", "search_tree_dot", "write_search_tree",
48
+ "Diagram", "labels", "style", "patterns",
49
+ "ELEVEN", "PATTERNS", "parity_pattern", "random_pattern", "canonical_classes", "trivial",
50
+ "parse_signs", "parse_pattern", "presets", "resolve_preset",
51
+ "plot_search_tree", "save_search_tree_png", "search_tree_plotly", "save_search_tree_html"]
signrules/__main__.py ADDED
@@ -0,0 +1,6 @@
1
+ """``python -m signrules`` is the ``signrules`` command."""
2
+ import sys
3
+
4
+ from .cli import main
5
+
6
+ sys.exit(main())