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, Forall, InClass, InSet
In [2]:
# build up the expression from sub-expressions
sub_expr1 = VecSpaces(K)
expr = Conditional(Forall(instance_param_or_params = [A, B], instance_expr = Exists(instance_param_or_params = [U, V], instance_expr = And(InSet(A, U), InSet(B, V)), domain = sub_expr1), condition = InSet(TensorProd(A, B), W)), InClass(W, 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())
\left\{\forall_{A, B~|~\left(A {\otimes} B\right) \in W}~\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)\right] \textrm{ if } W \underset{{\scriptscriptstyle c}}{\in} \textrm{VecSpaces}\left(K\right)\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: 33
operands: 5
3Literal
4ExprTuple6
5ExprTuple15, 39
6Lambdaparameters: 19
body: 7
7Conditionalvalue: 8
condition: 9
8Operationoperator: 10
operand: 13
9Operationoperator: 30
operands: 12
10Literal
11ExprTuple13
12ExprTuple14, 15
13Lambdaparameters: 16
body: 17
14Operationoperator: 18
operands: 19
15Variable
16ExprTuple37, 38
17Conditionalvalue: 20
condition: 21
18Literal
19ExprTuple35, 36
20Operationoperator: 23
operands: 22
21Operationoperator: 23
operands: 24
22ExprTuple25, 26
23Literal
24ExprTuple27, 28
25Operationoperator: 30
operands: 29
26Operationoperator: 30
operands: 31
27Operationoperator: 33
operands: 32
28Operationoperator: 33
operands: 34
29ExprTuple35, 37
30Literal
31ExprTuple36, 38
32ExprTuple37, 39
33Literal
34ExprTuple38, 39
35Variable
36Variable
37Variable
38Variable
39Operationoperator: 40
operand: 42
40Literal
41ExprTuple42
42Variable