logo

Expression of type ExprTuple

from the theory of proveit.linear_algebra.inner_products

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 ExprTuple, H, K, Lambda, n, v, w
from proveit.core_expr_types import x_1_to_n
from proveit.linear_algebra import Bases, InnerProd, InnerProdSpaces, OrthoNormBases
from proveit.logic import And, Equals, Forall, InSet, Set
from proveit.numbers import KroneckerDelta, NaturalPos
In [2]:
# build up the expression from sub-expressions
sub_expr1 = Set(x_1_to_n)
expr = ExprTuple(Lambda(K, Forall(instance_param_or_params = [H], instance_expr = Forall(instance_param_or_params = [n], instance_expr = Forall(instance_param_or_params = [x_1_to_n], instance_expr = Equals(InSet(sub_expr1, OrthoNormBases(H)), And(InSet(sub_expr1, Bases(H)), Forall(instance_param_or_params = [v, w], instance_expr = Equals(InnerProd(v, w), KroneckerDelta(v, w)), domain = sub_expr1))).with_wrapping_at(2), domain = H), domain = NaturalPos), domain = InnerProdSpaces(K))))
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_{H \underset{{\scriptscriptstyle c}}{\in} \textrm{InnerProdSpaces}\left(K\right)}~\left[\forall_{n \in \mathbb{N}^+}~\left[\forall_{x_{1}, x_{2}, \ldots, x_{n} \in H}~\left(\begin{array}{c} \begin{array}{l} \left(\left\{x_{1}, x_{2}, \ldots, x_{n}\right\} \in \textrm{O.N.Bases}\left(H\right)\right) =  \\ \left(\left(\left\{x_{1}, x_{2}, \ldots, x_{n}\right\} \in \textrm{Bases}\left(H\right)\right) \land \left[\forall_{v, w \in \left\{x_{1}, x_{2}, \ldots, x_{n}\right\}}~\left(\left \langle v, w\right \rangle = \delta_{v, w}\right)\right]\right) \end{array} \end{array}\right)\right]\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: 19
body: 2
2Operationoperator: 41
operand: 4
3ExprTuple4
4Lambdaparameter: 49
body: 5
5Conditionalvalue: 6
condition: 7
6Operationoperator: 41
operand: 11
7Operationoperator: 9
operands: 10
8ExprTuple11
9Literal
10ExprTuple49, 12
11Lambdaparameter: 74
body: 14
12Operationoperator: 15
operand: 19
13ExprTuple74
14Conditionalvalue: 17
condition: 18
15Literal
16ExprTuple19
17Operationoperator: 41
operand: 22
18Operationoperator: 64
operands: 21
19Variable
20ExprTuple22
21ExprTuple74, 23
22Lambdaparameters: 70
body: 24
23Literal
24Conditionalvalue: 25
condition: 26
25Operationoperator: 52
operands: 27
26Operationoperator: 54
operands: 28
27ExprTuple29, 30
28ExprTuple31
29Operationoperator: 64
operands: 32
30Operationoperator: 54
operands: 33
31ExprRangelambda_map: 34
start_index: 73
end_index: 74
32ExprTuple68, 35
33ExprTuple36, 37
34Lambdaparameter: 78
body: 38
35Operationoperator: 39
operand: 49
36Operationoperator: 64
operands: 40
37Operationoperator: 41
operand: 45
38Operationoperator: 64
operands: 43
39Literal
40ExprTuple68, 44
41Literal
42ExprTuple45
43ExprTuple75, 49
44Operationoperator: 46
operand: 49
45Lambdaparameters: 62
body: 48
46Literal
47ExprTuple49
48Conditionalvalue: 50
condition: 51
49Variable
50Operationoperator: 52
operands: 53
51Operationoperator: 54
operands: 55
52Literal
53ExprTuple56, 57
54Literal
55ExprTuple58, 59
56Operationoperator: 60
operands: 62
57Operationoperator: 61
operands: 62
58Operationoperator: 64
operands: 63
59Operationoperator: 64
operands: 65
60Literal
61Literal
62ExprTuple66, 67
63ExprTuple66, 68
64Literal
65ExprTuple67, 68
66Variable
67Variable
68Operationoperator: 69
operands: 70
69Literal
70ExprTuple71
71ExprRangelambda_map: 72
start_index: 73
end_index: 74
72Lambdaparameter: 78
body: 75
73Literal
74Variable
75IndexedVarvariable: 76
index: 78
76Variable
77ExprTuple78
78Variable