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 Equals, Forall, InSet
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(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)), Mult(ExprRange(sub_expr1, Norm(IndexedVar(a, sub_expr1)), one, i))), domains = sub_expr2).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} {\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} \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: 56
body: 3
2ExprTuple56
3Conditionalvalue: 4
condition: 5
4Operationoperator: 16
operand: 8
5Operationoperator: 49
operands: 7
6ExprTuple8
7ExprTuple56, 9
8Lambdaparameters: 10
body: 11
9Literal
10ExprTuple12
11Conditionalvalue: 13
condition: 14
12ExprRangelambda_map: 15
start_index: 55
end_index: 56
13Operationoperator: 16
operand: 19
14Operationoperator: 28
operands: 18
15Lambdaparameter: 63
body: 53
16Literal
17ExprTuple19
18ExprTuple20
19Lambdaparameters: 47
body: 21
20ExprRangelambda_map: 22
start_index: 55
end_index: 56
21Conditionalvalue: 23
condition: 24
22Lambdaparameter: 63
body: 25
23Operationoperator: 26
operands: 27
24Operationoperator: 28
operands: 29
25Operationoperator: 30
operands: 31
26Literal
27ExprTuple32, 33
28Literal
29ExprTuple34
30Literal
31ExprTuple53, 35
32Operationoperator: 57
operand: 42
33Operationoperator: 37
operands: 38
34ExprRangelambda_map: 39
start_index: 55
end_index: 56
35Operationoperator: 40
operand: 45
36ExprTuple42
37Literal
38ExprTuple43
39Lambdaparameter: 63
body: 44
40Literal
41ExprTuple45
42Operationoperator: 46
operands: 47
43ExprRangelambda_map: 48
start_index: 55
end_index: 56
44Operationoperator: 49
operands: 50
45Variable
46Literal
47ExprTuple51
48Lambdaparameter: 63
body: 52
49Literal
50ExprTuple60, 53
51ExprRangelambda_map: 54
start_index: 55
end_index: 56
52Operationoperator: 57
operand: 60
53IndexedVarvariable: 59
index: 63
54Lambdaparameter: 63
body: 60
55Literal
56Variable
57Literal
58ExprTuple60
59Variable
60IndexedVarvariable: 61
index: 63
61Variable
62ExprTuple63
63Variable