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 A, Composition, Conditional, U
from proveit.linear_algebra import Adj, Hspace, Identity, LinMap
from proveit.logic import Equals, Exists, InSet
from proveit.numbers import sqrt
In [2]:
# build up the expression from sub-expressions
sub_expr1 = LinMap(Hspace, Hspace)
expr = Conditional(Exists(instance_param_or_params = [U], instance_expr = Equals(A, Composition(sqrt(Composition(A, Adj(A))), U)), domain = sub_expr1, condition = Equals(Composition(Adj(U), U), Identity(Hspace))).with_wrapping(), InSet(A, sub_expr1))
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\{\begin{array}{l}\exists_{U \in \mathcal{L}\left(\mathcal{H}, \mathcal{H}\right)~|~\left(U^{\dagger} \circ U\right) = I_{\mathcal{H}}}~\\
\left(A = \left(\sqrt{\left(A \circ A^{\dagger}\right)} \circ U\right)\right)\end{array} \textrm{ if } A \in \mathcal{L}\left(\mathcal{H}, \mathcal{H}\right)\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: 3
operand: 6
2Operationoperator: 17
operands: 5
3Literal
4ExprTuple6
5ExprTuple47, 22
6Lambdaparameter: 44
body: 7
7Conditionalvalue: 8
condition: 9
8Operationoperator: 19
operands: 10
9Operationoperator: 11
operands: 12
10ExprTuple47, 13
11Literal
12ExprTuple14, 15
13Operationoperator: 36
operands: 16
14Operationoperator: 17
operands: 18
15Operationoperator: 19
operands: 20
16ExprTuple21, 44
17Literal
18ExprTuple44, 22
19Literal
20ExprTuple23, 24
21Operationoperator: 25
operands: 26
22Operationoperator: 27
operands: 28
23Operationoperator: 36
operands: 29
24Operationoperator: 30
operand: 35
25Literal
26ExprTuple32, 33
27Literal
28ExprTuple35, 35
29ExprTuple34, 44
30Literal
31ExprTuple35
32Operationoperator: 36
operands: 37
33Operationoperator: 38
operands: 39
34Operationoperator: 45
operand: 44
35Variable
36Literal
37ExprTuple47, 41
38Literal
39ExprTuple42, 43
40ExprTuple44
41Operationoperator: 45
operand: 47
42Literal
43Literal
44Variable
45Literal
46ExprTuple47
47Variable