logo

Expression of type ExprTuple

from the theory of proveit.linear_algebra.addition

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
from proveit.core_expr_types import x_1_to_n
from proveit.linear_algebra import VecAdd, 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 = [x_1_to_n], instance_expr = InSet(VecAdd(x_1_to_n), V), domain = V), 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_{x_{1}, x_{2}, \ldots, x_{n} \in V}~\left(\left(x_{1} +  x_{2} +  \ldots +  x_{n}\right) \in V\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: 20
body: 2
2Operationoperator: 9
operand: 4
3ExprTuple4
4Lambdaparameter: 37
body: 6
5ExprTuple37
6Conditionalvalue: 7
condition: 8
7Operationoperator: 9
operand: 13
8Operationoperator: 11
operands: 12
9Literal
10ExprTuple13
11Literal
12ExprTuple37, 14
13Lambdaparameters: 27
body: 15
14Operationoperator: 16
operand: 20
15Conditionalvalue: 18
condition: 19
16Literal
17ExprTuple20
18Operationoperator: 34
operands: 21
19Operationoperator: 22
operands: 23
20Variable
21ExprTuple24, 37
22Literal
23ExprTuple25
24Operationoperator: 26
operands: 27
25ExprRangelambda_map: 28
start_index: 32
end_index: 33
26Literal
27ExprTuple29
28Lambdaparameter: 40
body: 30
29ExprRangelambda_map: 31
start_index: 32
end_index: 33
30Operationoperator: 34
operands: 35
31Lambdaparameter: 40
body: 36
32Literal
33Variable
34Literal
35ExprTuple36, 37
36IndexedVarvariable: 38
index: 40
37Variable
38Variable
39ExprTuple40
40Variable