logo

Expression of type Exists

from the theory of proveit.physics.quantum.algebra

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, B, X, Y
from proveit.linear_algebra import HilbertSpaces, Hspace, LinMap
from proveit.logic import Exists, InSet, Set
from proveit.numbers import Complex
from proveit.physics.quantum import Qmult, QmultCodomain
In [2]:
# build up the expression from sub-expressions
sub_expr1 = LinMap(Hspace, X)
expr = Exists(instance_param_or_params = [Hspace, X, Y], instance_expr = InSet([Qmult(A), Qmult(B)], Set([sub_expr1, Hspace], [X, LinMap(Hspace, Complex)], [LinMap(X, Y), sub_expr1], [Complex, QmultCodomain], [QmultCodomain, Complex])), 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())
\exists_{\mathcal{H}, X, Y \underset{{\scriptscriptstyle c}}{\in} \textrm{HilbertSpaces}}~\left(\left(\left[A\right], \left[B\right]\right) \in \left\{\left(\mathcal{L}\left(\mathcal{H}, X\right), \mathcal{H}\right), \left(X, \mathcal{L}\left(\mathcal{H}, \mathbb{C}\right)\right), \left(\mathcal{L}\left(X, Y\right), \mathcal{L}\left(\mathcal{H}, X\right)\right), \left(\mathbb{C}, \mathcal{Q^*}\right), \left(\mathcal{Q^*}, \mathbb{C}\right)\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: 1
operand: 3
1Literal
2ExprTuple3
3Lambdaparameters: 4
body: 5
4ExprTuple46, 47, 45
5Conditionalvalue: 6
condition: 7
6Operationoperator: 8
operands: 9
7Operationoperator: 10
operands: 11
8Literal
9ExprTuple12, 13
10Literal
11ExprTuple14, 15, 16
12ExprTuple17, 18
13Operationoperator: 19
operands: 20
14Operationoperator: 23
operands: 21
15Operationoperator: 23
operands: 22
16Operationoperator: 23
operands: 24
17Operationoperator: 26
operand: 34
18Operationoperator: 26
operand: 35
19Literal
20ExprTuple28, 29, 30, 31, 32
21ExprTuple46, 33
22ExprTuple47, 33
23Literal
24ExprTuple45, 33
25ExprTuple34
26Literal
27ExprTuple35
28ExprTuple38, 46
29ExprTuple47, 36
30ExprTuple37, 38
31ExprTuple44, 39
32ExprTuple39, 44
33Literal
34Variable
35Variable
36Operationoperator: 42
operands: 40
37Operationoperator: 42
operands: 41
38Operationoperator: 42
operands: 43
39Literal
40ExprTuple46, 44
41ExprTuple47, 45
42Literal
43ExprTuple46, 47
44Literal
45Variable
46Variable
47Variable