logo

Expression of type Conditional

from the theory of proveit.linear_algebra.tensors

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, Conditional, K, U, V, W
from proveit.linear_algebra import TensorProd, VecSpaces
from proveit.logic import And, Exists, InSet
In [2]:
# build up the expression from sub-expressions
expr = Conditional(Exists(instance_param_or_params = [U, V], instance_expr = And(InSet(A, U), InSet(B, V)), domain = VecSpaces(K)), InSet(TensorProd(A, B), W))
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\{\exists_{U, V \underset{{\scriptscriptstyle c}}{\in} \textrm{VecSpaces}\left(K\right)}~\left(\left(A \in U\right) \land \left(B \in V\right)\right) \textrm{ if } \left(A {\otimes} B\right) \in W\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: 3
operand: 6
2Operationoperator: 23
operands: 5
3Literal
4ExprTuple6
5ExprTuple7, 8
6Lambdaparameters: 9
body: 10
7Operationoperator: 11
operands: 12
8Variable
9ExprTuple30, 31
10Conditionalvalue: 13
condition: 14
11Literal
12ExprTuple28, 29
13Operationoperator: 16
operands: 15
14Operationoperator: 16
operands: 17
15ExprTuple18, 19
16Literal
17ExprTuple20, 21
18Operationoperator: 23
operands: 22
19Operationoperator: 23
operands: 24
20Operationoperator: 26
operands: 25
21Operationoperator: 26
operands: 27
22ExprTuple28, 30
23Literal
24ExprTuple29, 31
25ExprTuple30, 32
26Literal
27ExprTuple31, 32
28Variable
29Variable
30Variable
31Variable
32Operationoperator: 33
operand: 35
33Literal
34ExprTuple35
35Variable