logo
In [1]:
import proveit
# Automation is not needed when only building an expression:
proveit.defaults.automation = False # This will speed things up.
proveit.defaults.inline_pngs = False # Makes files smaller.
%load_theorem_expr # Load the stored theorem expression as 'stored_expr'
# import the special expression
from proveit.numbers.number_sets.rational_numbers import reduced_nat_pos_ratio
In [2]:
# check that the built expression is the same as the stored expression
assert reduced_nat_pos_ratio.expr == stored_expr
assert reduced_nat_pos_ratio.expr._style_id == stored_expr._style_id
print("Passed sanity check: reduced_nat_pos_ratio matches stored_expr")
Passed sanity check: reduced_nat_pos_ratio matches stored_expr
In [3]:
# Show the LaTeX representation of the expression for convenience if you need it.
print(stored_expr.latex())
\forall_{q \in \mathbb{Q}^+}~\left[\exists_{a, b \in \mathbb{N}^+}~\left(\left(q = \frac{a}{b}\right) \land \left(gcd\left(a, b\right) = 1\right)\right)\right]
In [4]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
with_wrappingIf 'True', wrap the Expression after the parametersNoneNone/False('with_wrapping',)
condition_wrappingWrap 'before' or 'after' the condition (or None).NoneNone/False('with_wrap_after_condition', 'with_wrap_before_condition')
wrap_paramsIf 'True', wraps every two parameters AND wraps the Expression after the parametersNoneNone/False('with_params',)
justificationjustify to the 'left', 'center', or 'right' in the array cellscentercenter('with_justification',)
In [5]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Operationoperator: 1
operand: 3
1Literal
2ExprTuple3
3Lambdaparameter: 29
body: 5
4ExprTuple29
5Conditionalvalue: 6
condition: 7
6Operationoperator: 8
operand: 11
7Operationoperator: 27
operands: 10
8Literal
9ExprTuple11
10ExprTuple29, 12
11Lambdaparameters: 36
body: 13
12Literal
13Conditionalvalue: 14
condition: 15
14Operationoperator: 17
operands: 16
15Operationoperator: 17
operands: 18
16ExprTuple19, 20
17Literal
18ExprTuple21, 22
19Operationoperator: 24
operands: 23
20Operationoperator: 24
operands: 25
21Operationoperator: 27
operands: 26
22Operationoperator: 27
operands: 28
23ExprTuple29, 30
24Literal
25ExprTuple31, 32
26ExprTuple37, 33
27Literal
28ExprTuple38, 33
29Variable
30Operationoperator: 34
operands: 36
31Operationoperator: 35
operands: 36
32Literal
33Literal
34Literal
35Literal
36ExprTuple37, 38
37Variable
38Variable