logo

Expression of type Conditional

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, Conditional, X, c
from proveit.linear_algebra import HilbertSpaces, Hspace, LinMap
from proveit.logic import Forall, InSet
from proveit.numbers import Complex
from proveit.physics.quantum import Qmult
In [2]:
# build up the expression from sub-expressions
sub_expr1 = LinMap(Hspace, X)
expr = Conditional(Forall(instance_param_or_params = [Hspace, X], instance_expr = Forall(instance_param_or_params = [A], instance_expr = InSet(Qmult(c, A), sub_expr1), condition = InSet(Qmult(A), sub_expr1)), domain = HilbertSpaces), InSet(c, Complex))
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_{\mathcal{H}, X \underset{{\scriptscriptstyle c}}{\in} \textrm{HilbertSpaces}}~\left[\forall_{A~|~\left[A\right] \in \mathcal{L}\left(\mathcal{H}, X\right)}~\left(\left(c \thinspace A\right) \in \mathcal{L}\left(\mathcal{H}, X\right)\right)\right] \textrm{ if } c \in \mathbb{C}\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: 10
operand: 5
2Operationoperator: 25
operands: 4
3ExprTuple5
4ExprTuple35, 6
5Lambdaparameters: 34
body: 7
6Literal
7Conditionalvalue: 8
condition: 9
8Operationoperator: 10
operand: 14
9Operationoperator: 12
operands: 13
10Literal
11ExprTuple14
12Literal
13ExprTuple15, 16
14Lambdaparameter: 36
body: 17
15Operationoperator: 19
operands: 18
16Operationoperator: 19
operands: 20
17Conditionalvalue: 21
condition: 22
18ExprTuple37, 23
19Literal
20ExprTuple38, 23
21Operationoperator: 25
operands: 24
22Operationoperator: 25
operands: 26
23Literal
24ExprTuple27, 29
25Literal
26ExprTuple28, 29
27Operationoperator: 31
operands: 30
28Operationoperator: 31
operand: 36
29Operationoperator: 33
operands: 34
30ExprTuple35, 36
31Literal
32ExprTuple36
33Literal
34ExprTuple37, 38
35Variable
36Variable
37Variable
38Variable