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, 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 = [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)
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_{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]
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: 1
operand: 3
1Literal
2ExprTuple3
3Lambdaparameter: 51
body: 4
4Conditionalvalue: 5
condition: 6
5Operationoperator: 7
operand: 10
6Operationoperator: 21
operands: 9
7Literal
8ExprTuple10
9ExprTuple51, 26
10Lambdaparameter: 48
body: 11
11Conditionalvalue: 12
condition: 13
12Operationoperator: 23
operands: 14
13Operationoperator: 15
operands: 16
14ExprTuple51, 17
15Literal
16ExprTuple18, 19
17Operationoperator: 40
operands: 20
18Operationoperator: 21
operands: 22
19Operationoperator: 23
operands: 24
20ExprTuple25, 48
21Literal
22ExprTuple48, 26
23Literal
24ExprTuple27, 28
25Operationoperator: 29
operands: 30
26Operationoperator: 31
operands: 32
27Operationoperator: 40
operands: 33
28Operationoperator: 34
operand: 39
29Literal
30ExprTuple36, 37
31Literal
32ExprTuple39, 39
33ExprTuple38, 48
34Literal
35ExprTuple39
36Operationoperator: 40
operands: 41
37Operationoperator: 42
operands: 43
38Operationoperator: 49
operand: 48
39Variable
40Literal
41ExprTuple51, 45
42Literal
43ExprTuple46, 47
44ExprTuple48
45Operationoperator: 49
operand: 51
46Literal
47Literal
48Variable
49Literal
50ExprTuple51
51Variable