logo

Expression of type Forall

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, U
from proveit.linear_algebra import Adj, HilbertSpaces, Hspace, Identity, LinMap
from proveit.logic import Equals, Exists, Forall
from proveit.numbers import sqrt
In [2]:
# build up the expression from sub-expressions
sub_expr1 = LinMap(Hspace, Hspace)
expr = Forall(instance_param_or_params = [Hspace], instance_expr = Forall(instance_param_or_params = [A], instance_expr = Exists(instance_param_or_params = [U], instance_expr = Equals(A, Composition(U, sqrt(Composition(Adj(A), A)))), domain = sub_expr1, condition = Equals(Composition(Adj(U), U), Identity(Hspace))).with_wrapping(), domain = sub_expr1), domain = 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())
\forall_{\mathcal{H} \underset{{\scriptscriptstyle c}}{\in} \textrm{HilbertSpaces}}~\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(U \circ \sqrt{\left(A^{\dagger} \circ A\right)}\right)\right)\end{array}\right]\right]
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
with_wrappingIf 'True', wrap the Expression after the parametersNoneNone/False('with_wrapping',)
condition_wrappingWrap 'before' or 'after' the condition (or None).NoneNone/False('with_wrap_after_condition', 'with_wrap_before_condition')
wrap_paramsIf 'True', wraps every two parameters AND wraps the Expression after the parametersNoneNone/False('with_params',)
justificationjustify to the 'left', 'center', or 'right' in the array cellscentercenter('with_justification',)
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Operationoperator: 6
operand: 2
1ExprTuple2
2Lambdaparameter: 47
body: 3
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 10
5Operationoperator: 8
operands: 9
6Literal
7ExprTuple10
8Literal
9ExprTuple47, 11
10Lambdaparameter: 59
body: 12
11Literal
12Conditionalvalue: 13
condition: 14
13Operationoperator: 15
operand: 18
14Operationoperator: 29
operands: 17
15Literal
16ExprTuple18
17ExprTuple59, 34
18Lambdaparameter: 56
body: 19
19Conditionalvalue: 20
condition: 21
20Operationoperator: 31
operands: 22
21Operationoperator: 23
operands: 24
22ExprTuple59, 25
23Literal
24ExprTuple26, 27
25Operationoperator: 48
operands: 28
26Operationoperator: 29
operands: 30
27Operationoperator: 31
operands: 32
28ExprTuple56, 33
29Literal
30ExprTuple56, 34
31Literal
32ExprTuple35, 36
33Operationoperator: 37
operands: 38
34Operationoperator: 39
operands: 40
35Operationoperator: 48
operands: 41
36Operationoperator: 42
operand: 47
37Literal
38ExprTuple44, 45
39Literal
40ExprTuple47, 47
41ExprTuple46, 56
42Literal
43ExprTuple47
44Operationoperator: 48
operands: 49
45Operationoperator: 50
operands: 51
46Operationoperator: 57
operand: 56
47Variable
48Literal
49ExprTuple53, 59
50Literal
51ExprTuple54, 55
52ExprTuple56
53Operationoperator: 57
operand: 59
54Literal
55Literal
56Variable
57Literal
58ExprTuple59
59Variable