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 ExprRange, ExprTuple, IndexedVar, K, Lambda, Variable, a, i
from proveit.core_expr_types import V_1_to_i, a_1_to_i
from proveit.linear_algebra import InnerProdSpaces, Norm, TensorProd
from proveit.logic import Equals, Forall
from proveit.numbers import Mult, NaturalPos, one
In [2]:
# build up the expression from sub-expressions
sub_expr1 = Variable("_a", latex_format = r"{_{-}a}")
sub_expr2 = [V_1_to_i]
expr = ExprTuple(Lambda(K, Forall(instance_param_or_params = [i], instance_expr = Forall(instance_param_or_params = sub_expr2, instance_expr = Forall(instance_param_or_params = [a_1_to_i], instance_expr = Equals(Norm(TensorProd(a_1_to_i)), Mult(ExprRange(sub_expr1, Norm(IndexedVar(a, sub_expr1)), one, i))), domains = sub_expr2).with_wrapping(), domain = InnerProdSpaces(K)).with_wrapping(), domain = 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(K \mapsto \left[\forall_{i \in \mathbb{N}^+}~\left[\begin{array}{l}\forall_{V_{1}, V_{2}, \ldots, V_{i} \underset{{\scriptscriptstyle c}}{\in} \textrm{InnerProdSpaces}\left(K\right)}~\\
\left[\begin{array}{l}\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 \| = \left(\left \|a_{1}\right \| \cdot  \left \|a_{2}\right \| \cdot  \ldots \cdot  \left \|a_{i}\right \|\right)\right)\end{array}\right]\end{array}\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: 48
body: 2
2Operationoperator: 19
operand: 4
3ExprTuple4
4Lambdaparameter: 59
body: 6
5ExprTuple59
6Conditionalvalue: 7
condition: 8
7Operationoperator: 19
operand: 11
8Operationoperator: 52
operands: 10
9ExprTuple11
10ExprTuple59, 12
11Lambdaparameters: 13
body: 14
12Literal
13ExprTuple15
14Conditionalvalue: 16
condition: 17
15ExprRangelambda_map: 18
start_index: 58
end_index: 59
16Operationoperator: 19
operand: 22
17Operationoperator: 31
operands: 21
18Lambdaparameter: 66
body: 56
19Literal
20ExprTuple22
21ExprTuple23
22Lambdaparameters: 50
body: 24
23ExprRangelambda_map: 25
start_index: 58
end_index: 59
24Conditionalvalue: 26
condition: 27
25Lambdaparameter: 66
body: 28
26Operationoperator: 29
operands: 30
27Operationoperator: 31
operands: 32
28Operationoperator: 33
operands: 34
29Literal
30ExprTuple35, 36
31Literal
32ExprTuple37
33Literal
34ExprTuple56, 38
35Operationoperator: 60
operand: 45
36Operationoperator: 40
operands: 41
37ExprRangelambda_map: 42
start_index: 58
end_index: 59
38Operationoperator: 43
operand: 48
39ExprTuple45
40Literal
41ExprTuple46
42Lambdaparameter: 66
body: 47
43Literal
44ExprTuple48
45Operationoperator: 49
operands: 50
46ExprRangelambda_map: 51
start_index: 58
end_index: 59
47Operationoperator: 52
operands: 53
48Variable
49Literal
50ExprTuple54
51Lambdaparameter: 66
body: 55
52Literal
53ExprTuple63, 56
54ExprRangelambda_map: 57
start_index: 58
end_index: 59
55Operationoperator: 60
operand: 63
56IndexedVarvariable: 62
index: 66
57Lambdaparameter: 66
body: 63
58Literal
59Variable
60Literal
61ExprTuple63
62Variable
63IndexedVarvariable: 64
index: 66
64Variable
65ExprTuple66
66Variable