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, HilbertSpaces, Hspace, Identity, LinMap
from proveit.logic import Equals, Exists, Forall, InClass
from proveit.numbers import sqrt
In [2]:
# build up the expression from sub-expressions
sub_expr1 = LinMap(Hspace, Hspace)
expr = Conditional(Forall(instance_param_or_params = [A], instance_expr = 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(), domain = sub_expr1), InClass(Hspace, HilbertSpaces))
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_{A \in \mathcal{L}\left(\mathcal{H}, \mathcal{H}\right)}~\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}\right] \textrm{ if } \mathcal{H} \underset{{\scriptscriptstyle c}}{\in} \textrm{HilbertSpaces}\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: 7
2Operationoperator: 5
operands: 6
3Literal
4ExprTuple7
5Literal
6ExprTuple44, 8
7Lambdaparameter: 56
body: 9
8Literal
9Conditionalvalue: 10
condition: 11
10Operationoperator: 12
operand: 15
11Operationoperator: 26
operands: 14
12Literal
13ExprTuple15
14ExprTuple56, 31
15Lambdaparameter: 53
body: 16
16Conditionalvalue: 17
condition: 18
17Operationoperator: 28
operands: 19
18Operationoperator: 20
operands: 21
19ExprTuple56, 22
20Literal
21ExprTuple23, 24
22Operationoperator: 45
operands: 25
23Operationoperator: 26
operands: 27
24Operationoperator: 28
operands: 29
25ExprTuple30, 53
26Literal
27ExprTuple53, 31
28Literal
29ExprTuple32, 33
30Operationoperator: 34
operands: 35
31Operationoperator: 36
operands: 37
32Operationoperator: 45
operands: 38
33Operationoperator: 39
operand: 44
34Literal
35ExprTuple41, 42
36Literal
37ExprTuple44, 44
38ExprTuple43, 53
39Literal
40ExprTuple44
41Operationoperator: 45
operands: 46
42Operationoperator: 47
operands: 48
43Operationoperator: 54
operand: 53
44Variable
45Literal
46ExprTuple56, 50
47Literal
48ExprTuple51, 52
49ExprTuple53
50Operationoperator: 54
operand: 56
51Literal
52Literal
53Variable
54Literal
55ExprTuple56
56Variable