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, Lambda, P, Px, Py, X, x, y
from proveit.linear_algebra import Hspace, InnerProd, LinMap, OrthoProj, VecZero
from proveit.logic import And, Equals, Forall, Iff, Implies, InSet
from proveit.numbers import zero
In [2]:
# build up the expression from sub-expressions
sub_expr1 = [x]
expr = ExprTuple(Lambda(P, Conditional(Iff(Equals(P, OrthoProj(Hspace, X)), And(Forall(instance_param_or_params = sub_expr1, instance_expr = Equals(Px, x), domain = X), Forall(instance_param_or_params = [y], instance_expr = Implies(Forall(instance_param_or_params = sub_expr1, instance_expr = Equals(InnerProd(x, y), zero), domain = X), Equals(Py, VecZero(Hspace))), domain = Hspace)).with_wrapping_at(2)).with_wrapping_at(2), InSet(P, LinMap(Hspace, Hspace)))))
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(P \mapsto \left\{\begin{array}{c} \begin{array}{l} \left(P = \textrm{OrthoProj}\left(\mathcal{H}, X\right)\right) \Leftrightarrow  \\ \left(\begin{array}{c} \left[\forall_{x \in X}~\left(P\left(x\right) = x\right)\right] \land  \\ \left[\forall_{y \in \mathcal{H}}~\left(\left[\forall_{x \in X}~\left(\left \langle x, y\right \rangle = 0\right)\right] \Rightarrow \left(P\left(y\right) = \vec{0}\left(\mathcal{H}\right)\right)\right)\right] \end{array}\right) \end{array} \end{array} \textrm{ if } P \in \mathcal{L}\left(\mathcal{H}, \mathcal{H}\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: 3
2ExprTuple46
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operands: 7
5Operationoperator: 55
operands: 8
6Literal
7ExprTuple9, 10
8ExprTuple46, 11
9Operationoperator: 53
operands: 12
10Operationoperator: 13
operands: 14
11Operationoperator: 15
operands: 16
12ExprTuple46, 17
13Literal
14ExprTuple18, 19
15Literal
16ExprTuple52, 52
17Operationoperator: 20
operands: 21
18Operationoperator: 38
operand: 24
19Operationoperator: 38
operand: 25
20Literal
21ExprTuple52, 59
22ExprTuple24
23ExprTuple25
24Lambdaparameter: 62
body: 26
25Lambdaparameter: 63
body: 27
26Conditionalvalue: 28
condition: 51
27Conditionalvalue: 29
condition: 30
28Operationoperator: 53
operands: 31
29Operationoperator: 32
operands: 33
30Operationoperator: 55
operands: 34
31ExprTuple35, 62
32Literal
33ExprTuple36, 37
34ExprTuple63, 52
35Operationoperator: 46
operand: 62
36Operationoperator: 38
operand: 41
37Operationoperator: 53
operands: 40
38Literal
39ExprTuple41
40ExprTuple42, 43
41Lambdaparameter: 62
body: 45
42Operationoperator: 46
operand: 63
43Operationoperator: 48
operand: 52
44ExprTuple62
45Conditionalvalue: 50
condition: 51
46Variable
47ExprTuple63
48Literal
49ExprTuple52
50Operationoperator: 53
operands: 54
51Operationoperator: 55
operands: 56
52Variable
53Literal
54ExprTuple57, 58
55Literal
56ExprTuple62, 59
57Operationoperator: 60
operands: 61
58Literal
59Variable
60Literal
61ExprTuple62, 63
62Variable
63Variable