logo

Expression of type Forall

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 K
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
In [2]:
# build up the expression from sub-expressions
sub_expr1 = [V_1_to_i]
expr = 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))
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())
\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]
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
with_wrappingIf 'True', wrap the Expression after the parametersNoneNone/False('with_wrapping',)
condition_wrappingWrap 'before' or 'after' the condition (or None).NoneNone/False('with_wrap_after_condition', 'with_wrap_before_condition')
wrap_paramsIf 'True', wraps every two parameters AND wraps the Expression after the parametersNoneNone/False('with_params',)
justificationjustify to the 'left', 'center', or 'right' in the array cellscentercenter('with_justification',)
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Operationoperator: 6
operand: 2
1ExprTuple2
2Lambdaparameters: 27
body: 3
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 9
5Operationoperator: 17
operands: 8
6Literal
7ExprTuple9
8ExprTuple10
9Lambdaparameters: 25
body: 11
10ExprRangelambda_map: 12
start_index: 37
end_index: 38
11Conditionalvalue: 13
condition: 14
12Lambdaparameter: 46
body: 15
13Operationoperator: 39
operands: 16
14Operationoperator: 17
operands: 18
15Operationoperator: 19
operands: 20
16ExprTuple21, 22
17Literal
18ExprTuple23
19Literal
20ExprTuple42, 24
21Operationoperator: 26
operands: 25
22Operationoperator: 26
operands: 27
23ExprRangelambda_map: 28
start_index: 37
end_index: 38
24Operationoperator: 29
operand: 34
25ExprTuple31
26Literal
27ExprTuple32
28Lambdaparameter: 46
body: 33
29Literal
30ExprTuple34
31ExprRangelambda_map: 35
start_index: 37
end_index: 38
32ExprRangelambda_map: 36
start_index: 37
end_index: 38
33Operationoperator: 39
operands: 40
34Variable
35Lambdaparameter: 46
body: 41
36Lambdaparameter: 46
body: 42
37Literal
38Variable
39Literal
40ExprTuple41, 42
41IndexedVarvariable: 43
index: 46
42IndexedVarvariable: 44
index: 46
43Variable
44Variable
45ExprTuple46
46Variable