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 ExprTuple, K, Lambda, V, a, x
from proveit.linear_algebra import ScalarMult, VecSpaces
from proveit.logic import Forall, InSet
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda(K, Forall(instance_param_or_params = [V], instance_expr = Forall(instance_param_or_params = [a], instance_expr = Forall(instance_param_or_params = [x], instance_expr = InSet(ScalarMult(a, x), V), domain = V), domain = K), domain = 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(K \mapsto \left[\forall_{V \underset{{\scriptscriptstyle c}}{\in} \textrm{VecSpaces}\left(K\right)}~\left[\forall_{a \in K}~\left[\forall_{x \in V}~\left(\left(a \cdot x\right) \in V\right)\right]\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: 24
body: 2
2Operationoperator: 20
operand: 4
3ExprTuple4
4Lambdaparameter: 33
body: 6
5ExprTuple33
6Conditionalvalue: 7
condition: 8
7Operationoperator: 20
operand: 12
8Operationoperator: 10
operands: 11
9ExprTuple12
10Literal
11ExprTuple33, 13
12Lambdaparameter: 36
body: 15
13Operationoperator: 16
operand: 24
14ExprTuple36
15Conditionalvalue: 18
condition: 19
16Literal
17ExprTuple24
18Operationoperator: 20
operand: 23
19Operationoperator: 30
operands: 22
20Literal
21ExprTuple23
22ExprTuple36, 24
23Lambdaparameter: 37
body: 26
24Variable
25ExprTuple37
26Conditionalvalue: 27
condition: 28
27Operationoperator: 30
operands: 29
28Operationoperator: 30
operands: 31
29ExprTuple32, 33
30Literal
31ExprTuple37, 33
32Operationoperator: 34
operands: 35
33Variable
34Literal
35ExprTuple36, 37
36Variable
37Variable