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 And, Equals, Forall
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(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)), 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(), 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}\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}\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: 46
body: 2
2Operationoperator: 19
operand: 4
3ExprTuple4
4Lambdaparameter: 56
body: 6
5ExprTuple56
6Conditionalvalue: 7
condition: 8
7Operationoperator: 19
operand: 11
8Operationoperator: 49
operands: 10
9ExprTuple11
10ExprTuple56, 12
11Lambdaparameters: 13
body: 14
12Literal
13ExprTuple15
14Conditionalvalue: 16
condition: 17
15ExprRangelambda_map: 18
start_index: 61
end_index: 56
16Operationoperator: 19
operand: 22
17Operationoperator: 39
operands: 21
18Lambdaparameter: 67
body: 53
19Literal
20ExprTuple22
21ExprTuple23
22Lambdaparameters: 48
body: 24
23ExprRangelambda_map: 25
start_index: 61
end_index: 56
24Conditionalvalue: 26
condition: 27
25Lambdaparameter: 67
body: 28
26Operationoperator: 58
operands: 29
27Operationoperator: 39
operands: 30
28Operationoperator: 31
operands: 32
29ExprTuple33, 61
30ExprTuple34, 35
31Literal
32ExprTuple53, 36
33Operationoperator: 62
operand: 43
34ExprRangelambda_map: 38
start_index: 61
end_index: 56
35Operationoperator: 39
operands: 40
36Operationoperator: 41
operand: 46
37ExprTuple43
38Lambdaparameter: 67
body: 44
39Literal
40ExprTuple45
41Literal
42ExprTuple46
43Operationoperator: 47
operands: 48
44Operationoperator: 49
operands: 50
45ExprRangelambda_map: 51
start_index: 61
end_index: 56
46Variable
47Literal
48ExprTuple52
49Literal
50ExprTuple64, 53
51Lambdaparameter: 67
body: 54
52ExprRangelambda_map: 55
start_index: 61
end_index: 56
53IndexedVarvariable: 57
index: 67
54Operationoperator: 58
operands: 59
55Lambdaparameter: 67
body: 64
56Variable
57Variable
58Literal
59ExprTuple60, 61
60Operationoperator: 62
operand: 64
61Literal
62Literal
63ExprTuple64
64IndexedVarvariable: 65
index: 67
65Variable
66ExprTuple67
67Variable