logo

Expression of type Conditional

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, H, 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 = 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\{\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..
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
condition_delimiter'comma' or 'and'commacomma('with_comma_delimiter', 'with_conjunction_delimiter')
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Conditionalvalue: 1
condition: 2
1Operationoperator: 24
operand: 5
2Operationoperator: 47
operands: 4
3ExprTuple5
4ExprTuple57, 6
5Lambdaparameters: 53
body: 7
6Literal
7Conditionalvalue: 8
condition: 9
8Operationoperator: 35
operands: 10
9Operationoperator: 37
operands: 11
10ExprTuple12, 13
11ExprTuple14
12Operationoperator: 47
operands: 15
13Operationoperator: 37
operands: 16
14ExprRangelambda_map: 17
start_index: 56
end_index: 57
15ExprTuple51, 18
16ExprTuple19, 20
17Lambdaparameter: 61
body: 21
18Operationoperator: 22
operand: 32
19Operationoperator: 47
operands: 23
20Operationoperator: 24
operand: 28
21Operationoperator: 47
operands: 26
22Literal
23ExprTuple51, 27
24Literal
25ExprTuple28
26ExprTuple58, 32
27Operationoperator: 29
operand: 32
28Lambdaparameters: 45
body: 31
29Literal
30ExprTuple32
31Conditionalvalue: 33
condition: 34
32Variable
33Operationoperator: 35
operands: 36
34Operationoperator: 37
operands: 38
35Literal
36ExprTuple39, 40
37Literal
38ExprTuple41, 42
39Operationoperator: 43
operands: 45
40Operationoperator: 44
operands: 45
41Operationoperator: 47
operands: 46
42Operationoperator: 47
operands: 48
43Literal
44Literal
45ExprTuple49, 50
46ExprTuple49, 51
47Literal
48ExprTuple50, 51
49Variable
50Variable
51Operationoperator: 52
operands: 53
52Literal
53ExprTuple54
54ExprRangelambda_map: 55
start_index: 56
end_index: 57
55Lambdaparameter: 61
body: 58
56Literal
57Variable
58IndexedVarvariable: 59
index: 61
59Variable
60ExprTuple61
61Variable