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, 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 And, Equals, Forall, InSet
from proveit.numbers import 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(i, Conditional(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)), one), domains = sub_expr2, condition = And(ExprRange(sub_expr1, Equals(Norm(IndexedVar(a, sub_expr1)), one), one, i))).with_wrapping(), domain = InnerProdSpaces(K)).with_wrapping(), 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\{\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}\right \| = 1\right) \land  \left(\left \|a_{2}\right \| = 1\right) \land  \ldots \land  \left(\left \|a_{i}\right \| = 1\right)}~\\
\left(\left \|a_{1} {\otimes}  a_{2} {\otimes}  \ldots {\otimes}  a_{i}\right \| = 1\right)\end{array}\right]\end{array} \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: 53
body: 3
2ExprTuple53
3Conditionalvalue: 4
condition: 5
4Operationoperator: 16
operand: 8
5Operationoperator: 46
operands: 7
6ExprTuple8
7ExprTuple53, 9
8Lambdaparameters: 10
body: 11
9Literal
10ExprTuple12
11Conditionalvalue: 13
condition: 14
12ExprRangelambda_map: 15
start_index: 58
end_index: 53
13Operationoperator: 16
operand: 19
14Operationoperator: 36
operands: 18
15Lambdaparameter: 64
body: 50
16Literal
17ExprTuple19
18ExprTuple20
19Lambdaparameters: 45
body: 21
20ExprRangelambda_map: 22
start_index: 58
end_index: 53
21Conditionalvalue: 23
condition: 24
22Lambdaparameter: 64
body: 25
23Operationoperator: 55
operands: 26
24Operationoperator: 36
operands: 27
25Operationoperator: 28
operands: 29
26ExprTuple30, 58
27ExprTuple31, 32
28Literal
29ExprTuple50, 33
30Operationoperator: 59
operand: 40
31ExprRangelambda_map: 35
start_index: 58
end_index: 53
32Operationoperator: 36
operands: 37
33Operationoperator: 38
operand: 43
34ExprTuple40
35Lambdaparameter: 64
body: 41
36Literal
37ExprTuple42
38Literal
39ExprTuple43
40Operationoperator: 44
operands: 45
41Operationoperator: 46
operands: 47
42ExprRangelambda_map: 48
start_index: 58
end_index: 53
43Variable
44Literal
45ExprTuple49
46Literal
47ExprTuple61, 50
48Lambdaparameter: 64
body: 51
49ExprRangelambda_map: 52
start_index: 58
end_index: 53
50IndexedVarvariable: 54
index: 64
51Operationoperator: 55
operands: 56
52Lambdaparameter: 64
body: 61
53Variable
54Variable
55Literal
56ExprTuple57, 58
57Operationoperator: 59
operand: 61
58Literal
59Literal
60ExprTuple61
61IndexedVarvariable: 62
index: 64
62Variable
63ExprTuple64
64Variable