Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemath
GitHub Repository: sagemath/sagelib
Path: blob/master/sage/structure/proof/all.py
4049 views
1
def arithmetic(t = None):
2
"""
3
Controls the default proof strategy for integer arithmetic algorithms (such as primality testing).
4
5
INPUT:
6
t -- boolean or None
7
8
OUTPUT:
9
If t == True, requires integer arithmetic operations to (by default) return results that are true unconditionally: the correctness will not depend on an algorithm with a nonzero probability of returning an incorrect answer or on the truth of any unproven conjectures.
10
If t == False, allows integer arithmetic operations to (by default) return results that may depend on unproven conjectures or on probabilistic algorithms. Such algorithms often have a substantial speed improvement over those requiring proof.
11
If t is None, returns the integer arithmetic proof status.
12
13
EXAMPLES:
14
sage: proof.arithmetic()
15
True
16
sage: proof.arithmetic(False)
17
sage: proof.arithmetic()
18
False
19
sage: proof.arithmetic(True)
20
sage: proof.arithmetic()
21
True
22
"""
23
from proof import _proof_prefs
24
return _proof_prefs.arithmetic(t)
25
26
def elliptic_curve(t = None):
27
"""
28
Controls the default proof strategy for elliptic curve algorithms.
29
30
INPUT:
31
t -- boolean or None
32
33
OUTPUT:
34
If t == True, requires elliptic curve algorithms to (by default) return results that are true unconditionally: the correctness will not depend on an algorithm with a nonzero probability of returning an incorrect answer or on the truth of any unproven conjectures.
35
If t == False, allows elliptic curve algorithms to (by default) return results that may depend on unproven conjectures or on probabilistic algorithms. Such algorithms often have a substantial speed improvement over those requiring proof.
36
If t is None, returns the current elliptic curve proof status.
37
38
EXAMPLES:
39
sage: proof.elliptic_curve()
40
True
41
sage: proof.elliptic_curve(False)
42
sage: proof.elliptic_curve()
43
False
44
sage: proof.elliptic_curve(True)
45
sage: proof.elliptic_curve()
46
True
47
"""
48
from proof import _proof_prefs
49
return _proof_prefs.elliptic_curve(t)
50
51
def linear_algebra(t = None):
52
"""
53
Controls the default proof strategy for linear algebra algorithms.
54
55
INPUT:
56
t -- boolean or None
57
58
OUTPUT:
59
If t == True, requires linear algebra algorithms to (by default) return results that are true unconditionally: the correctness will not depend on an algorithm with a nonzero probability of returning an incorrect answer or on the truth of any unproven conjectures.
60
If t == False, allows linear algebra algorithms to (by default) return results that may depend on unproven conjectures or on probabilistic algorithms. Such algorithms often have a substantial speed improvement over those requiring proof.
61
If t is None, returns the current linear algebra proof status.
62
63
EXAMPLES:
64
sage: proof.linear_algebra()
65
True
66
sage: proof.linear_algebra(False)
67
sage: proof.linear_algebra()
68
False
69
sage: proof.linear_algebra(True)
70
sage: proof.linear_algebra()
71
True
72
"""
73
from proof import _proof_prefs
74
return _proof_prefs.linear_algebra(t)
75
76
def number_field(t = None):
77
"""
78
Controls the default proof strategy for number field algorithms.
79
80
INPUT:
81
t -- boolean or None
82
83
OUTPUT:
84
If t == True, requires number field algorithms to (by default) return results that are true unconditionally: the correctness will not depend on an algorithm with a nonzero probability of returning an incorrect answer or on the truth of any unproven conjectures.
85
If t == False, allows number field algorithms to (by default) return results that may depend on unproven conjectures or on probabilistic algorithms. Such algorithms often have a substantial speed improvement over those requiring proof.
86
If t is None, returns the current number field proof status.
87
88
EXAMPLES:
89
sage: proof.number_field()
90
True
91
sage: proof.number_field(False)
92
sage: proof.number_field()
93
False
94
sage: proof.number_field(True)
95
sage: proof.number_field()
96
True
97
"""
98
from proof import _proof_prefs
99
return _proof_prefs.number_field(t)
100
101
def polynomial(t = None):
102
"""
103
Controls the default proof strategy for polynomial algorithms.
104
105
INPUT:
106
t -- boolean or None
107
108
OUTPUT:
109
If t == True, requires polynomial algorithms to (by default) return results that are true unconditionally: the correctness will not depend on an algorithm with a nonzero probability of returning an incorrect answer or on the truth of any unproven conjectures.
110
If t == False, allows polynomial algorithms to (by default) return results that may depend on unproven conjectures or on probabilistic algorithms. Such algorithms often have a substantial speed improvement over those requiring proof.
111
If t is None, returns the current polynomial proof status.
112
113
EXAMPLES:
114
sage: proof.polynomial()
115
True
116
sage: proof.polynomial(False)
117
sage: proof.polynomial()
118
False
119
sage: proof.polynomial(True)
120
sage: proof.polynomial()
121
True
122
"""
123
from proof import _proof_prefs
124
return _proof_prefs.polynomial(t)
125
126
def all(t = None):
127
"""
128
Controls the default proof strategy throughout Sage.
129
130
INPUT:
131
t -- boolean or None
132
133
OUTPUT:
134
If t == True, requires Sage algorithms to (by default) return results that are true unconditionally: the correctness will not depend on an algorithm with a nonzero probability of returning an incorrect answer or on the truth of any unproven conjectures.
135
If t == False, allows Sage algorithms to (by default) return results that may depend on unproven conjectures or on probabilistic algorithms. Such algorithms often have a substantial speed improvement over those requiring proof.
136
If t is None, returns the current global Sage proof status.
137
138
EXAMPLES:
139
sage: proof.all()
140
{'polynomial': True, 'other': True, 'elliptic_curve': True, 'number_field': True, 'linear_algebra': True, 'arithmetic': True}
141
sage: proof.number_field(False)
142
sage: proof.number_field()
143
False
144
sage: proof.all()
145
{'polynomial': True, 'other': True, 'elliptic_curve': True, 'number_field': False, 'linear_algebra': True, 'arithmetic': True}
146
sage: proof.number_field(True)
147
sage: proof.number_field()
148
True
149
"""
150
from proof import _proof_prefs
151
if t is None:
152
return _proof_prefs._require_proof.copy()
153
for s in _proof_prefs._require_proof.iterkeys():
154
_proof_prefs._require_proof[s] = bool(t)
155
156
from proof import WithProof
157
158