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, 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 = Forall(instance_param_or_params = [i], instance_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)), domain = 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())
\forall_{i \in \mathbb{N}^+}~\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]\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: 14
operand: 2
1ExprTuple2
2Lambdaparameter: 46
body: 4
3ExprTuple46
4Conditionalvalue: 5
condition: 6
5Operationoperator: 14
operand: 9
6Operationoperator: 47
operands: 8
7ExprTuple9
8ExprTuple46, 10
9Lambdaparameters: 35
body: 11
10Literal
11Conditionalvalue: 12
condition: 13
12Operationoperator: 14
operand: 17
13Operationoperator: 25
operands: 16
14Literal
15ExprTuple17
16ExprTuple18
17Lambdaparameters: 33
body: 19
18ExprRangelambda_map: 20
start_index: 45
end_index: 46
19Conditionalvalue: 21
condition: 22
20Lambdaparameter: 54
body: 23
21Operationoperator: 47
operands: 24
22Operationoperator: 25
operands: 26
23Operationoperator: 27
operands: 28
24ExprTuple29, 30
25Literal
26ExprTuple31
27Literal
28ExprTuple50, 32
29Operationoperator: 34
operands: 33
30Operationoperator: 34
operands: 35
31ExprRangelambda_map: 36
start_index: 45
end_index: 46
32Operationoperator: 37
operand: 42
33ExprTuple39
34Literal
35ExprTuple40
36Lambdaparameter: 54
body: 41
37Literal
38ExprTuple42
39ExprRangelambda_map: 43
start_index: 45
end_index: 46
40ExprRangelambda_map: 44
start_index: 45
end_index: 46
41Operationoperator: 47
operands: 48
42Variable
43Lambdaparameter: 54
body: 49
44Lambdaparameter: 54
body: 50
45Literal
46Variable
47Literal
48ExprTuple49, 50
49IndexedVarvariable: 51
index: 54
50IndexedVarvariable: 52
index: 54
51Variable
52Variable
53ExprTuple54
54Variable