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 Conditional, j, l, n
from proveit.core_expr_types import A_1_to_l, C_1_to_n, b_1_to_j
from proveit.logic import And, Equals, Forall, InClass, InSet
from proveit.numbers import Complex, Natural
from proveit.physics.quantum import Qmult, QmultCodomain
In [2]:
# build up the expression from sub-expressions
expr = Conditional(Forall(instance_param_or_params = [b_1_to_j], instance_expr = Forall(instance_param_or_params = [A_1_to_l, C_1_to_n], instance_expr = Equals(Qmult(A_1_to_l, b_1_to_j, C_1_to_n), Qmult(b_1_to_j, A_1_to_l, C_1_to_n)).with_wrapping_at(2), condition = InClass(Qmult(A_1_to_l, C_1_to_n), QmultCodomain)), domain = Complex), And(InSet(j, Natural), InSet(l, Natural), InSet(n, Natural)))
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_{b_{1}, b_{2}, \ldots, b_{j} \in \mathbb{C}}~\left[\forall_{A_{1}, A_{2}, \ldots, A_{l}, C_{1}, C_{2}, \ldots, C_{n}~|~\left(A_{1} \thinspace  A_{2} \thinspace  \ldots \thinspace  A_{l}\thinspace C_{1} \thinspace  C_{2} \thinspace  \ldots \thinspace  C_{n}\right) \underset{{\scriptscriptstyle c}}{\in} \mathcal{Q^*}}~\left(\begin{array}{c} \begin{array}{l} \left(A_{1} \thinspace  A_{2} \thinspace  \ldots \thinspace  A_{l}\thinspace b_{1} \thinspace  b_{2} \thinspace  \ldots \thinspace  b_{j}\thinspace C_{1} \thinspace  C_{2} \thinspace  \ldots \thinspace  C_{n}\right) =  \\ \left(b_{1} \thinspace  b_{2} \thinspace  \ldots \thinspace  b_{j}\thinspace A_{1} \thinspace  A_{2} \thinspace  \ldots \thinspace  A_{l}\thinspace C_{1} \thinspace  C_{2} \thinspace  \ldots \thinspace  C_{n}\right) \end{array} \end{array}\right)\right] \textrm{ if } j \in \mathbb{N} ,  l \in \mathbb{N} ,  n \in \mathbb{N}\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: 17
operand: 5
2Operationoperator: 19
operands: 4
3ExprTuple5
4ExprTuple6, 7, 8
5Lambdaparameters: 9
body: 10
6Operationoperator: 32
operands: 11
7Operationoperator: 32
operands: 12
8Operationoperator: 32
operands: 13
9ExprTuple43
10Conditionalvalue: 14
condition: 15
11ExprTuple47, 16
12ExprTuple49, 16
13ExprTuple52, 16
14Operationoperator: 17
operand: 21
15Operationoperator: 19
operands: 20
16Literal
17Literal
18ExprTuple21
19Literal
20ExprTuple22
21Lambdaparameters: 42
body: 23
22ExprRangelambda_map: 24
start_index: 51
end_index: 47
23Conditionalvalue: 25
condition: 26
24Lambdaparameter: 60
body: 27
25Operationoperator: 28
operands: 29
26Operationoperator: 30
operands: 31
27Operationoperator: 32
operands: 33
28Literal
29ExprTuple34, 35
30Literal
31ExprTuple36, 37
32Literal
33ExprTuple53, 38
34Operationoperator: 41
operands: 39
35Operationoperator: 41
operands: 40
36Operationoperator: 41
operands: 42
37Literal
38Literal
39ExprTuple44, 43, 45
40ExprTuple43, 44, 45
41Literal
42ExprTuple44, 45
43ExprRangelambda_map: 46
start_index: 51
end_index: 47
44ExprRangelambda_map: 48
start_index: 51
end_index: 49
45ExprRangelambda_map: 50
start_index: 51
end_index: 52
46Lambdaparameter: 60
body: 53
47Variable
48Lambdaparameter: 60
body: 54
49Variable
50Lambdaparameter: 60
body: 55
51Literal
52Variable
53IndexedVarvariable: 56
index: 60
54IndexedVarvariable: 57
index: 60
55IndexedVarvariable: 58
index: 60
56Variable
57Variable
58Variable
59ExprTuple60
60Variable