logo
In [1]:
import proveit
# Automation is not needed when building an expression:
proveit.defaults.automation = False # This will speed things up.
proveit.defaults.inline_pngs = False # Makes files smaller.
%load_expr # Load the stored expression as 'stored_expr'
# import Expression classes needed to build the expression
from proveit import A, Conditional, m, rho, x
from proveit.linear_algebra import MatrixExp, MatrixMult, ScalarMult
from proveit.logic import Equals, Forall, InSet
from proveit.numbers import Exp, Mult, NaturalPos, Real, e, i, pi, two
In [2]:
# build up the expression from sub-expressions
expr = Conditional(Forall(instance_param_or_params = [rho], instance_expr = Forall(instance_param_or_params = [A, x], instance_expr = Equals(MatrixMult(MatrixExp(A, m), x), ScalarMult(Exp(e, Mult(two, pi, i, Mult(m, rho))), x)), condition = Equals(MatrixMult(A, x), ScalarMult(Exp(e, Mult(two, pi, i, rho)), x))), domain = Real), InSet(m, NaturalPos))
expr:
In [3]:
# check that the built expression is the same as the stored expression
assert expr == stored_expr
assert expr._style_id == stored_expr._style_id
print("Passed sanity check: expr matches stored_expr")
Passed sanity check: expr matches stored_expr
In [4]:
# Show the LaTeX representation of the expression for convenience if you need it.
print(stored_expr.latex())
\left\{\forall_{\rho \in \mathbb{R}}~\left[\forall_{A, x~|~\left(A \thinspace x\right) = \left(\mathsf{e}^{2 \cdot \pi \cdot \mathsf{i} \cdot \rho} \cdot x\right)}~\left(\left(A^{m} \thinspace x\right) = \left(\mathsf{e}^{2 \cdot \pi \cdot \mathsf{i} \cdot \left(m \cdot \rho\right)} \cdot x\right)\right)\right] \textrm{ if } m \in \mathbb{N}^+\right..
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
condition_delimiter'comma' or 'and'commacomma('with_comma_delimiter', 'with_conjunction_delimiter')
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Conditionalvalue: 1
condition: 2
1Operationoperator: 11
operand: 5
2Operationoperator: 13
operands: 4
3ExprTuple5
4ExprTuple54, 6
5Lambdaparameter: 55
body: 8
6Literal
7ExprTuple55
8Conditionalvalue: 9
condition: 10
9Operationoperator: 11
operand: 15
10Operationoperator: 13
operands: 14
11Literal
12ExprTuple15
13Literal
14ExprTuple55, 16
15Lambdaparameters: 30
body: 17
16Literal
17Conditionalvalue: 18
condition: 19
18Operationoperator: 21
operands: 20
19Operationoperator: 21
operands: 22
20ExprTuple23, 24
21Literal
22ExprTuple25, 26
23Operationoperator: 29
operands: 27
24Operationoperator: 31
operands: 28
25Operationoperator: 29
operands: 30
26Operationoperator: 31
operands: 32
27ExprTuple33, 36
28ExprTuple34, 36
29Literal
30ExprTuple42, 36
31Literal
32ExprTuple35, 36
33Operationoperator: 37
operands: 38
34Operationoperator: 40
operands: 39
35Operationoperator: 40
operands: 41
36Variable
37Literal
38ExprTuple42, 54
39ExprTuple44, 43
40Literal
41ExprTuple44, 45
42Variable
43Operationoperator: 52
operands: 46
44Literal
45Operationoperator: 52
operands: 47
46ExprTuple49, 50, 51, 48
47ExprTuple49, 50, 51, 55
48Operationoperator: 52
operands: 53
49Literal
50Literal
51Literal
52Literal
53ExprTuple54, 55
54Variable
55Variable