logo

Expression of type ExprTuple

from the theory of proveit.linear_algebra.scalar_multiplication

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 Conditional, ExprTuple, K, Lambda, V, alpha, beta, x
from proveit.linear_algebra import ScalarMult, VecSpaces
from proveit.logic import Equals, Forall, InClass
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda(V, Conditional(Forall(instance_param_or_params = [x], instance_expr = Forall(instance_param_or_params = [alpha, beta], instance_expr = Equals(ScalarMult(alpha, ScalarMult(beta, x)), ScalarMult(ScalarMult(alpha, beta), x)), domain = K), domain = V), InClass(V, VecSpaces(K)))))
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(V \mapsto \left\{\forall_{x \in V}~\left[\forall_{\alpha, \beta \in K}~\left(\left(\alpha \cdot \left(\beta \cdot x\right)\right) = \left(\left(\alpha \cdot \beta\right) \cdot x\right)\right)\right] \textrm{ if } V \underset{{\scriptscriptstyle c}}{\in} \textrm{VecSpaces}\left(K\right)\right..\right)
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0ExprTuple1
1Lambdaparameter: 21
body: 3
2ExprTuple21
3Conditionalvalue: 4
condition: 5
4Operationoperator: 17
operand: 9
5Operationoperator: 7
operands: 8
6ExprTuple9
7Literal
8ExprTuple21, 10
9Lambdaparameter: 44
body: 12
10Operationoperator: 13
operand: 40
11ExprTuple44
12Conditionalvalue: 15
condition: 16
13Literal
14ExprTuple40
15Operationoperator: 17
operand: 20
16Operationoperator: 36
operands: 19
17Literal
18ExprTuple20
19ExprTuple44, 21
20Lambdaparameters: 43
body: 22
21Variable
22Conditionalvalue: 23
condition: 24
23Operationoperator: 25
operands: 26
24Operationoperator: 27
operands: 28
25Literal
26ExprTuple29, 30
27Literal
28ExprTuple31, 32
29Operationoperator: 42
operands: 33
30Operationoperator: 42
operands: 34
31Operationoperator: 36
operands: 35
32Operationoperator: 36
operands: 37
33ExprTuple45, 38
34ExprTuple39, 44
35ExprTuple45, 40
36Literal
37ExprTuple46, 40
38Operationoperator: 42
operands: 41
39Operationoperator: 42
operands: 43
40Variable
41ExprTuple46, 44
42Literal
43ExprTuple45, 46
44Variable
45Variable
46Variable