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 Conditional, K, i
from proveit.core_expr_types import V_1_to_i, a_1_to_i
from proveit.linear_algebra import TensorProd, VecSpaces
from proveit.logic import Forall, InSet
from proveit.numbers import NaturalPos
In [2]:
# build up the expression from sub-expressions
sub_expr1 = [V_1_to_i]
expr = Conditional(Forall(instance_param_or_params = sub_expr1, instance_expr = Forall(instance_param_or_params = [a_1_to_i], instance_expr = InSet(TensorProd(a_1_to_i), TensorProd(V_1_to_i)), domains = sub_expr1), domain = VecSpaces(K)), InSet(i, NaturalPos))
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_{V_{1}, V_{2}, \ldots, V_{i} \underset{{\scriptscriptstyle c}}{\in} \textrm{VecSpaces}\left(K\right)}~\left[\forall_{\left(a_{1} \in V_{1}\right), \left(a_{2} \in V_{2}\right), \ldots, \left(a_{i} \in V_{i}\right)}~\left(\left(a_{1} {\otimes}  a_{2} {\otimes}  \ldots {\otimes}  a_{i}\right) \in \left(V_{1} {\otimes}  V_{2} {\otimes}  \ldots {\otimes}  V_{i}\right)\right)\right] \textrm{ if } i \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: 10
operand: 5
2Operationoperator: 43
operands: 4
3ExprTuple5
4ExprTuple42, 6
5Lambdaparameters: 31
body: 7
6Literal
7Conditionalvalue: 8
condition: 9
8Operationoperator: 10
operand: 13
9Operationoperator: 21
operands: 12
10Literal
11ExprTuple13
12ExprTuple14
13Lambdaparameters: 29
body: 15
14ExprRangelambda_map: 16
start_index: 41
end_index: 42
15Conditionalvalue: 17
condition: 18
16Lambdaparameter: 50
body: 19
17Operationoperator: 43
operands: 20
18Operationoperator: 21
operands: 22
19Operationoperator: 23
operands: 24
20ExprTuple25, 26
21Literal
22ExprTuple27
23Literal
24ExprTuple46, 28
25Operationoperator: 30
operands: 29
26Operationoperator: 30
operands: 31
27ExprRangelambda_map: 32
start_index: 41
end_index: 42
28Operationoperator: 33
operand: 38
29ExprTuple35
30Literal
31ExprTuple36
32Lambdaparameter: 50
body: 37
33Literal
34ExprTuple38
35ExprRangelambda_map: 39
start_index: 41
end_index: 42
36ExprRangelambda_map: 40
start_index: 41
end_index: 42
37Operationoperator: 43
operands: 44
38Variable
39Lambdaparameter: 50
body: 45
40Lambdaparameter: 50
body: 46
41Literal
42Variable
43Literal
44ExprTuple45, 46
45IndexedVarvariable: 47
index: 50
46IndexedVarvariable: 48
index: 50
47Variable
48Variable
49ExprTuple50
50Variable