logo

Expression of type ExprTuple

from the theory of proveit.linear_algebra

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, Function, Lambda, S, T, V, W, v
from proveit.linear_algebra import LinMap, LinMapAdd
from proveit.logic import Equals, Forall
from proveit.numbers import Add
In [2]:
# build up the expression from sub-expressions
sub_expr1 = [v]
expr = ExprTuple(Lambda([V, W], Forall(instance_param_or_params = [S, T], instance_expr = Forall(instance_param_or_params = sub_expr1, instance_expr = Equals(Function(LinMapAdd(S, T), sub_expr1), Add(Function(S, sub_expr1), Function(T, sub_expr1))), domain = V), domain = LinMap(V, W))))
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(\left(V, W\right) \mapsto \left[\forall_{S, T \in \mathcal{L}\left(V, W\right)}~\left[\forall_{v \in V}~\left(\left(S + T\right)\left(v\right) = \left(S\left(v\right) + T\left(v\right)\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
1Lambdaparameters: 26
body: 2
2Operationoperator: 8
operand: 4
3ExprTuple4
4Lambdaparameters: 35
body: 5
5Conditionalvalue: 6
condition: 7
6Operationoperator: 8
operand: 12
7Operationoperator: 10
operands: 11
8Literal
9ExprTuple12
10Literal
11ExprTuple13, 14
12Lambdaparameter: 41
body: 15
13Operationoperator: 23
operands: 16
14Operationoperator: 23
operands: 17
15Conditionalvalue: 18
condition: 19
16ExprTuple38, 20
17ExprTuple39, 20
18Operationoperator: 21
operands: 22
19Operationoperator: 23
operands: 24
20Operationoperator: 25
operands: 26
21Literal
22ExprTuple27, 28
23Literal
24ExprTuple41, 29
25Literal
26ExprTuple29, 30
27Operationoperator: 31
operand: 41
28Operationoperator: 32
operands: 33
29Variable
30Variable
31Operationoperator: 34
operands: 35
32Literal
33ExprTuple36, 37
34Literal
35ExprTuple38, 39
36Operationoperator: 38
operand: 41
37Operationoperator: 39
operand: 41
38Variable
39Variable
40ExprTuple41
41Variable