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, a, x
from proveit.linear_algebra import ScalarMult, VecSpaces
from proveit.logic import Forall, InClass, InSet
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda(V, Conditional(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), 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_{a \in K}~\left[\forall_{x \in V}~\left(\left(a \cdot x\right) \in V\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: 30
body: 3
2ExprTuple30
3Conditionalvalue: 4
condition: 5
4Operationoperator: 17
operand: 9
5Operationoperator: 7
operands: 8
6ExprTuple9
7Literal
8ExprTuple30, 10
9Lambdaparameter: 33
body: 12
10Operationoperator: 13
operand: 21
11ExprTuple33
12Conditionalvalue: 15
condition: 16
13Literal
14ExprTuple21
15Operationoperator: 17
operand: 20
16Operationoperator: 27
operands: 19
17Literal
18ExprTuple20
19ExprTuple33, 21
20Lambdaparameter: 34
body: 23
21Variable
22ExprTuple34
23Conditionalvalue: 24
condition: 25
24Operationoperator: 27
operands: 26
25Operationoperator: 27
operands: 28
26ExprTuple29, 30
27Literal
28ExprTuple34, 30
29Operationoperator: 31
operands: 32
30Variable
31Literal
32ExprTuple33, 34
33Variable
34Variable