logo

Expression of type ExprTuple

from the theory of proveit.linear_algebra.tensors

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, i
from proveit.core_expr_types import V_1_to_i, a_1_to_i
from proveit.linear_algebra import TensorProd, VecSpaces
from proveit.logic import Forall, InSet
from proveit.numbers import NaturalPos
In [2]:
# build up the expression from sub-expressions
sub_expr1 = [V_1_to_i]
expr = ExprTuple(Lambda(i, Conditional(Forall(instance_param_or_params = sub_expr1, instance_expr = Forall(instance_param_or_params = [a_1_to_i], instance_expr = InSet(TensorProd(a_1_to_i), TensorProd(V_1_to_i)), domains = sub_expr1), domain = VecSpaces(K)), InSet(i, NaturalPos))))
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(i \mapsto \left\{\forall_{V_{1}, V_{2}, \ldots, V_{i} \underset{{\scriptscriptstyle c}}{\in} \textrm{VecSpaces}\left(K\right)}~\left[\forall_{\left(a_{1} \in V_{1}\right), \left(a_{2} \in V_{2}\right), \ldots, \left(a_{i} \in V_{i}\right)}~\left(\left(a_{1} {\otimes}  a_{2} {\otimes}  \ldots {\otimes}  a_{i}\right) \in \left(V_{1} {\otimes}  V_{2} {\otimes}  \ldots {\otimes}  V_{i}\right)\right)\right] \textrm{ if } i \in \mathbb{N}^+\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: 45
body: 3
2ExprTuple45
3Conditionalvalue: 4
condition: 5
4Operationoperator: 13
operand: 8
5Operationoperator: 46
operands: 7
6ExprTuple8
7ExprTuple45, 9
8Lambdaparameters: 34
body: 10
9Literal
10Conditionalvalue: 11
condition: 12
11Operationoperator: 13
operand: 16
12Operationoperator: 24
operands: 15
13Literal
14ExprTuple16
15ExprTuple17
16Lambdaparameters: 32
body: 18
17ExprRangelambda_map: 19
start_index: 44
end_index: 45
18Conditionalvalue: 20
condition: 21
19Lambdaparameter: 53
body: 22
20Operationoperator: 46
operands: 23
21Operationoperator: 24
operands: 25
22Operationoperator: 26
operands: 27
23ExprTuple28, 29
24Literal
25ExprTuple30
26Literal
27ExprTuple49, 31
28Operationoperator: 33
operands: 32
29Operationoperator: 33
operands: 34
30ExprRangelambda_map: 35
start_index: 44
end_index: 45
31Operationoperator: 36
operand: 41
32ExprTuple38
33Literal
34ExprTuple39
35Lambdaparameter: 53
body: 40
36Literal
37ExprTuple41
38ExprRangelambda_map: 42
start_index: 44
end_index: 45
39ExprRangelambda_map: 43
start_index: 44
end_index: 45
40Operationoperator: 46
operands: 47
41Variable
42Lambdaparameter: 53
body: 48
43Lambdaparameter: 53
body: 49
44Literal
45Variable
46Literal
47ExprTuple48, 49
48IndexedVarvariable: 50
index: 53
49IndexedVarvariable: 51
index: 53
50Variable
51Variable
52ExprTuple53
53Variable