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, 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, InClass, 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(H, Conditional(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), InClass(H, 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(H \mapsto \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] \textrm{ if } H \underset{{\scriptscriptstyle c}}{\in} \textrm{InnerProdSpaces}\left(K\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
2Conditionalvalue: 3
condition: 4
3Operationoperator: 38
operand: 8
4Operationoperator: 6
operands: 7
5ExprTuple8
6Literal
7ExprTuple46, 9
8Lambdaparameter: 71
body: 11
9Operationoperator: 12
operand: 16
10ExprTuple71
11Conditionalvalue: 14
condition: 15
12Literal
13ExprTuple16
14Operationoperator: 38
operand: 19
15Operationoperator: 61
operands: 18
16Variable
17ExprTuple19
18ExprTuple71, 20
19Lambdaparameters: 67
body: 21
20Literal
21Conditionalvalue: 22
condition: 23
22Operationoperator: 49
operands: 24
23Operationoperator: 51
operands: 25
24ExprTuple26, 27
25ExprTuple28
26Operationoperator: 61
operands: 29
27Operationoperator: 51
operands: 30
28ExprRangelambda_map: 31
start_index: 70
end_index: 71
29ExprTuple65, 32
30ExprTuple33, 34
31Lambdaparameter: 75
body: 35
32Operationoperator: 36
operand: 46
33Operationoperator: 61
operands: 37
34Operationoperator: 38
operand: 42
35Operationoperator: 61
operands: 40
36Literal
37ExprTuple65, 41
38Literal
39ExprTuple42
40ExprTuple72, 46
41Operationoperator: 43
operand: 46
42Lambdaparameters: 59
body: 45
43Literal
44ExprTuple46
45Conditionalvalue: 47
condition: 48
46Variable
47Operationoperator: 49
operands: 50
48Operationoperator: 51
operands: 52
49Literal
50ExprTuple53, 54
51Literal
52ExprTuple55, 56
53Operationoperator: 57
operands: 59
54Operationoperator: 58
operands: 59
55Operationoperator: 61
operands: 60
56Operationoperator: 61
operands: 62
57Literal
58Literal
59ExprTuple63, 64
60ExprTuple63, 65
61Literal
62ExprTuple64, 65
63Variable
64Variable
65Operationoperator: 66
operands: 67
66Literal
67ExprTuple68
68ExprRangelambda_map: 69
start_index: 70
end_index: 71
69Lambdaparameter: 75
body: 72
70Literal
71Variable
72IndexedVarvariable: 73
index: 75
73Variable
74ExprTuple75
75Variable