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 Conditional, ExprTuple, H, Lambda, n, v, w
from proveit.core_expr_types import x_1_to_n
from proveit.linear_algebra import Bases, InnerProd, 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(n, Conditional(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), InSet(n, 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(n \mapsto \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) \textrm{ if } n \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: 60
body: 3
2ExprTuple60
3Conditionalvalue: 4
condition: 5
4Operationoperator: 27
operand: 8
5Operationoperator: 50
operands: 7
6ExprTuple8
7ExprTuple60, 9
8Lambdaparameters: 56
body: 10
9Literal
10Conditionalvalue: 11
condition: 12
11Operationoperator: 38
operands: 13
12Operationoperator: 40
operands: 14
13ExprTuple15, 16
14ExprTuple17
15Operationoperator: 50
operands: 18
16Operationoperator: 40
operands: 19
17ExprRangelambda_map: 20
start_index: 59
end_index: 60
18ExprTuple54, 21
19ExprTuple22, 23
20Lambdaparameter: 64
body: 24
21Operationoperator: 25
operand: 35
22Operationoperator: 50
operands: 26
23Operationoperator: 27
operand: 31
24Operationoperator: 50
operands: 29
25Literal
26ExprTuple54, 30
27Literal
28ExprTuple31
29ExprTuple61, 35
30Operationoperator: 32
operand: 35
31Lambdaparameters: 48
body: 34
32Literal
33ExprTuple35
34Conditionalvalue: 36
condition: 37
35Variable
36Operationoperator: 38
operands: 39
37Operationoperator: 40
operands: 41
38Literal
39ExprTuple42, 43
40Literal
41ExprTuple44, 45
42Operationoperator: 46
operands: 48
43Operationoperator: 47
operands: 48
44Operationoperator: 50
operands: 49
45Operationoperator: 50
operands: 51
46Literal
47Literal
48ExprTuple52, 53
49ExprTuple52, 54
50Literal
51ExprTuple53, 54
52Variable
53Variable
54Operationoperator: 55
operands: 56
55Literal
56ExprTuple57
57ExprRangelambda_map: 58
start_index: 59
end_index: 60
58Lambdaparameter: 64
body: 61
59Literal
60Variable
61IndexedVarvariable: 62
index: 64
62Variable
63ExprTuple64
64Variable