funcprops 0.1.0__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.
- funcprops/__init__.py +234 -0
- funcprops/_semialg.py +246 -0
- funcprops/api.py +70 -0
- funcprops/branchcuts/__init__.py +141 -0
- funcprops/branchcuts/computation.py +664 -0
- funcprops/branchcuts/core.py +1204 -0
- funcprops/branchcuts/post_simplify.py +461 -0
- funcprops/conditions.py +124 -0
- funcprops/data/catalogue.json +127449 -0
- funcprops/data/dlmf_audit.json +3382 -0
- funcprops/dlmf.py +29 -0
- funcprops/engine.py +324 -0
- funcprops/exceptions.py +29 -0
- funcprops/proof_cache.py +373 -0
- funcprops/real_analysis/__init__.py +52 -0
- funcprops/real_analysis/advanced_convexity.py +217 -0
- funcprops/real_analysis/boundedness.py +168 -0
- funcprops/real_analysis/common.py +244 -0
- funcprops/real_analysis/convexity.py +698 -0
- funcprops/real_analysis/differentiability.py +112 -0
- funcprops/real_analysis/domain.py +188 -0
- funcprops/real_analysis/mapping.py +374 -0
- funcprops/real_analysis/monotonic_certificates.py +867 -0
- funcprops/real_analysis/monotonicity.py +673 -0
- funcprops/real_analysis/oscillation.py +151 -0
- funcprops/real_analysis/piecewise.py +174 -0
- funcprops/real_analysis/range.py +552 -0
- funcprops/real_analysis/sign.py +561 -0
- funcprops/real_analysis/smoothness.py +268 -0
- funcprops/real_analysis/special_functions.py +515 -0
- funcprops/real_analysis/structural_properties.py +558 -0
- funcprops/real_analysis/zeros.py +327 -0
- funcprops/registry.py +274 -0
- funcprops/results.py +239 -0
- funcprops/singularities.py +1767 -0
- funcprops/stratification.py +494 -0
- funcprops/sympy_compare.py +63 -0
- funcprops/transcendental/__init__.py +140 -0
- funcprops/transcendental/algebraize.py +201 -0
- funcprops/transcendental/analytic.py +261 -0
- funcprops/transcendental/complex_roots.py +542 -0
- funcprops/transcendental/exp_fourier.py +221 -0
- funcprops/transcendental/extrema.py +821 -0
- funcprops/transcendental/periodic.py +222 -0
- funcprops/transcendental/proof.py +104 -0
- funcprops/transcendental/real_interval.py +128 -0
- funcprops/transcendental/real_sign.py +117 -0
- funcprops/transcendental/reduce.py +288 -0
- funcprops/transcendental/roots.py +1380 -0
- funcprops/transcendental/zero_geometry.py +1197 -0
- funcprops/verification.py +410 -0
- funcprops-0.1.0.dist-info/METADATA +208 -0
- funcprops-0.1.0.dist-info/RECORD +56 -0
- funcprops-0.1.0.dist-info/WHEEL +5 -0
- funcprops-0.1.0.dist-info/licenses/LICENSE +674 -0
- funcprops-0.1.0.dist-info/top_level.txt +1 -0
funcprops/results.py
ADDED
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from enum import Enum
|
|
5
|
+
from typing import Any, Protocol, runtime_checkable
|
|
6
|
+
|
|
7
|
+
from sympy import Basic, Piecewise, S, sympify
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class TruthValue(str, Enum):
|
|
11
|
+
TRUE = "true"
|
|
12
|
+
FALSE = "false"
|
|
13
|
+
UNKNOWN = "unknown"
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class Analyticity(str, Enum):
|
|
17
|
+
ANALYTIC = "analytic"
|
|
18
|
+
NOT_ANALYTIC = "not_analytic"
|
|
19
|
+
UNKNOWN = "unknown"
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class Meromorphicity(str, Enum):
|
|
23
|
+
MEROMORPHIC = "meromorphic"
|
|
24
|
+
NOT_MEROMORPHIC = "not_meromorphic"
|
|
25
|
+
UNKNOWN = "unknown"
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class Monotonicity(str, Enum):
|
|
29
|
+
STRICTLY_INCREASING = "strictly_increasing"
|
|
30
|
+
NONDECREASING = "nondecreasing"
|
|
31
|
+
CONSTANT = "constant"
|
|
32
|
+
NONINCREASING = "nonincreasing"
|
|
33
|
+
STRICTLY_DECREASING = "strictly_decreasing"
|
|
34
|
+
NOT_MONOTONE = "not_monotone"
|
|
35
|
+
UNKNOWN = "unknown"
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class Convexity(str, Enum):
|
|
39
|
+
STRONGLY_CONVEX = "strongly_convex"
|
|
40
|
+
STRICTLY_CONVEX = "strictly_convex"
|
|
41
|
+
CONVEX = "convex"
|
|
42
|
+
AFFINE = "affine"
|
|
43
|
+
CONCAVE = "concave"
|
|
44
|
+
STRICTLY_CONCAVE = "strictly_concave"
|
|
45
|
+
STRONGLY_CONCAVE = "strongly_concave"
|
|
46
|
+
LOG_CONVEX = "log_convex"
|
|
47
|
+
LOG_CONCAVE = "log_concave"
|
|
48
|
+
QUASICONVEX = "quasiconvex"
|
|
49
|
+
QUASICONCAVE = "quasiconcave"
|
|
50
|
+
PSEUDOCONVEX = "pseudoconvex"
|
|
51
|
+
PSEUDOCONCAVE = "pseudoconcave"
|
|
52
|
+
NEITHER = "neither"
|
|
53
|
+
UNKNOWN = "unknown"
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
class Sign(str, Enum):
|
|
57
|
+
POSITIVE = "positive"
|
|
58
|
+
NONNEGATIVE = "nonnegative"
|
|
59
|
+
ZERO = "zero"
|
|
60
|
+
NONPOSITIVE = "nonpositive"
|
|
61
|
+
NEGATIVE = "negative"
|
|
62
|
+
SIGN_CHANGING = "sign_changing"
|
|
63
|
+
UNKNOWN = "unknown"
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
class Boundedness(str, Enum):
|
|
67
|
+
BOUNDED = "bounded"
|
|
68
|
+
BOUNDED_ABOVE = "bounded_above"
|
|
69
|
+
BOUNDED_BELOW = "bounded_below"
|
|
70
|
+
UNBOUNDED = "unbounded"
|
|
71
|
+
UNKNOWN = "unknown"
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
class Oscillation(str, Enum):
|
|
75
|
+
NONOSCILLATORY = "nonoscillatory"
|
|
76
|
+
FINITELY_OSCILLATORY = "finitely_oscillatory"
|
|
77
|
+
OSCILLATORY = "oscillatory"
|
|
78
|
+
UNKNOWN = "unknown"
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
class Periodicity(str, Enum):
|
|
82
|
+
CONSTANT = "constant"
|
|
83
|
+
PERIODIC = "periodic"
|
|
84
|
+
APERIODIC = "aperiodic"
|
|
85
|
+
UNKNOWN = "unknown"
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
class Symmetry(str, Enum):
|
|
89
|
+
EVEN = "even"
|
|
90
|
+
ODD = "odd"
|
|
91
|
+
BOTH = "both"
|
|
92
|
+
NEITHER = "neither"
|
|
93
|
+
CENTRAL = "central"
|
|
94
|
+
UNKNOWN = "unknown"
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
class Homogeneity(str, Enum):
|
|
98
|
+
HOMOGENEOUS = "homogeneous"
|
|
99
|
+
NOT_HOMOGENEOUS = "not_homogeneous"
|
|
100
|
+
UNKNOWN = "unknown"
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
class Continuity(str, Enum):
|
|
104
|
+
CONTINUOUS = "continuous"
|
|
105
|
+
DISCONTINUOUS = "discontinuous"
|
|
106
|
+
UNKNOWN = "unknown"
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
class Differentiability(str, Enum):
|
|
110
|
+
SMOOTH = "smooth"
|
|
111
|
+
CK = "Ck"
|
|
112
|
+
DIFFERENTIABLE = "differentiable"
|
|
113
|
+
NOT_DIFFERENTIABLE = "not_differentiable"
|
|
114
|
+
UNKNOWN = "unknown"
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
class SingularityKind(str, Enum):
|
|
118
|
+
POLE = "pole"
|
|
119
|
+
ESSENTIAL = "essential"
|
|
120
|
+
BRANCH_POINT = "branch_point"
|
|
121
|
+
BRANCH_CUT = "branch_cut"
|
|
122
|
+
DEFINITION_CUT = "definition_cut"
|
|
123
|
+
REMOVABLE = "removable"
|
|
124
|
+
DISCONTINUITY = "discontinuity"
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
@dataclass(frozen=True)
|
|
128
|
+
class ConditionalValue:
|
|
129
|
+
value: Any
|
|
130
|
+
condition: Basic = S.true
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
@dataclass(frozen=True)
|
|
134
|
+
class Singularity:
|
|
135
|
+
kind: SingularityKind
|
|
136
|
+
condition: Basic
|
|
137
|
+
guard: Basic = S.true
|
|
138
|
+
multiplicity: int | Basic | None = None
|
|
139
|
+
source: str | None = None
|
|
140
|
+
|
|
141
|
+
@property
|
|
142
|
+
def locus(self):
|
|
143
|
+
return self.condition
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
@dataclass(frozen=True)
|
|
147
|
+
class PropertyResult:
|
|
148
|
+
primary: Any
|
|
149
|
+
cases: tuple[ConditionalValue, ...] = ()
|
|
150
|
+
all_properties: tuple[Any, ...] = ()
|
|
151
|
+
source: str | None = None
|
|
152
|
+
exceptions: tuple[Any, ...] = ()
|
|
153
|
+
evidence: tuple[Any, ...] = ()
|
|
154
|
+
|
|
155
|
+
def as_detailed_result(self):
|
|
156
|
+
"""Project this result onto the package-wide detailed-result protocol."""
|
|
157
|
+
return as_detailed_result(self)
|
|
158
|
+
|
|
159
|
+
def as_piecewise(self):
|
|
160
|
+
if not self.cases:
|
|
161
|
+
return self.primary
|
|
162
|
+
pairs = []
|
|
163
|
+
for c in self.cases:
|
|
164
|
+
if isinstance(c.value, Basic):
|
|
165
|
+
v = c.value
|
|
166
|
+
elif isinstance(c.value, Enum):
|
|
167
|
+
v = sympify(c.value.value, evaluate=False)
|
|
168
|
+
else:
|
|
169
|
+
v = sympify(c.value, evaluate=False)
|
|
170
|
+
pairs.append((v, c.condition))
|
|
171
|
+
return Piecewise(*pairs)
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
@dataclass(frozen=True)
|
|
175
|
+
class DetailedPropertyResult:
|
|
176
|
+
"""Uniform non-breaking view of detailed property-analysis output.
|
|
177
|
+
|
|
178
|
+
Public property functions may keep returning their compact enums, sets, or
|
|
179
|
+
specialized result dataclasses. ``as_detailed_result`` projects any such
|
|
180
|
+
value onto this common protocol for downstream orchestration.
|
|
181
|
+
"""
|
|
182
|
+
|
|
183
|
+
primary: Any
|
|
184
|
+
cases: tuple[ConditionalValue, ...] = ()
|
|
185
|
+
domain: Any = None
|
|
186
|
+
complete: bool | None = None
|
|
187
|
+
source: str | None = None
|
|
188
|
+
evidence: tuple[Any, ...] = ()
|
|
189
|
+
certificate: Any = None
|
|
190
|
+
exceptions: tuple[Any, ...] = ()
|
|
191
|
+
all_properties: tuple[Any, ...] = ()
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
@runtime_checkable
|
|
195
|
+
class SupportsDetailedPropertyResult(Protocol):
|
|
196
|
+
"""Structural protocol implemented by objects exposing detailed results."""
|
|
197
|
+
|
|
198
|
+
def as_detailed_result(self) -> DetailedPropertyResult: ...
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
def as_detailed_result(value, *, domain=None, source=None, complete=None):
|
|
202
|
+
"""Return a uniform detailed view without changing compact public APIs."""
|
|
203
|
+
if isinstance(value, DetailedPropertyResult):
|
|
204
|
+
return value
|
|
205
|
+
if isinstance(value, PropertyResult):
|
|
206
|
+
certificate = next(
|
|
207
|
+
(
|
|
208
|
+
item
|
|
209
|
+
for item in value.evidence
|
|
210
|
+
if hasattr(item, "verify") or hasattr(item, "proof")
|
|
211
|
+
),
|
|
212
|
+
None,
|
|
213
|
+
)
|
|
214
|
+
return DetailedPropertyResult(
|
|
215
|
+
primary=value.primary,
|
|
216
|
+
cases=value.cases,
|
|
217
|
+
domain=domain,
|
|
218
|
+
complete=complete,
|
|
219
|
+
source=source or value.source,
|
|
220
|
+
evidence=value.evidence,
|
|
221
|
+
certificate=certificate,
|
|
222
|
+
exceptions=value.exceptions,
|
|
223
|
+
all_properties=value.all_properties,
|
|
224
|
+
)
|
|
225
|
+
primary = getattr(value, "classification", value)
|
|
226
|
+
evidence = tuple(getattr(value, "evidence", ()))
|
|
227
|
+
exceptions = tuple(getattr(value, "exceptional_loci", ()))
|
|
228
|
+
result_domain = domain if domain is not None else getattr(value, "domain", None)
|
|
229
|
+
return DetailedPropertyResult(
|
|
230
|
+
primary=primary,
|
|
231
|
+
cases=tuple(getattr(value, "cases", ())),
|
|
232
|
+
domain=result_domain,
|
|
233
|
+
complete=complete,
|
|
234
|
+
source=source or getattr(value, "source", None),
|
|
235
|
+
evidence=evidence,
|
|
236
|
+
certificate=getattr(value, "certificate", None),
|
|
237
|
+
exceptions=exceptions,
|
|
238
|
+
all_properties=tuple(getattr(value, "all_properties", ())),
|
|
239
|
+
)
|