logo

Expression of type Conditional

from the theory of proveit.linear_algebra.matrices

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, b, k, x
from proveit.linear_algebra import MatrixMult, ScalarMult
from proveit.logic import Equals, Forall, Implies, InSet
from proveit.numbers import Complex, Exp, NaturalPos
In [2]:
# build up the expression from sub-expressions
expr = Conditional(Forall(instance_param_or_params = [b], instance_expr = Forall(instance_param_or_params = [A, x], instance_expr = Implies(Equals(MatrixMult(A, x), ScalarMult(b, x)), Equals(MatrixMult(Exp(A, k), x), ScalarMult(Exp(b, k), x)))), domain = Complex), InSet(k, 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_{b \in \mathbb{C}}~\left[\forall_{A, x}~\left(\left(\left(A \thinspace x\right) = \left(b \cdot x\right)\right) \Rightarrow \left(\left(A^{k} \thinspace x\right) = \left(b^{k} \cdot x\right)\right)\right)\right] \textrm{ if } k \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
4ExprTuple43, 6
5Lambdaparameter: 42
body: 8
6Literal
7ExprTuple42
8Conditionalvalue: 9
condition: 10
9Operationoperator: 11
operand: 15
10Operationoperator: 13
operands: 14
11Literal
12ExprTuple15
13Literal
14ExprTuple42, 16
15Lambdaparameters: 29
body: 17
16Literal
17Operationoperator: 18
operands: 19
18Literal
19ExprTuple20, 21
20Operationoperator: 23
operands: 22
21Operationoperator: 23
operands: 24
22ExprTuple25, 26
23Literal
24ExprTuple27, 28
25Operationoperator: 31
operands: 29
26Operationoperator: 33
operands: 30
27Operationoperator: 31
operands: 32
28Operationoperator: 33
operands: 34
29ExprTuple41, 37
30ExprTuple42, 37
31Literal
32ExprTuple35, 37
33Literal
34ExprTuple36, 37
35Operationoperator: 39
operands: 38
36Operationoperator: 39
operands: 40
37Variable
38ExprTuple41, 43
39Literal
40ExprTuple42, 43
41Variable
42Variable
43Variable