logo

Expression of type Forall

from the theory of proveit.linear_algebra.addition

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, V
from proveit.core_expr_types import Q__b_1_to_j, b_1_to_j, f__b_1_to_j
from proveit.linear_algebra import VecSpaces
from proveit.linear_algebra.addition import vec_summation_b1toj_fQ
from proveit.logic import Forall, Implies, InSet
In [2]:
# build up the expression from sub-expressions
expr = Forall(instance_param_or_params = [V], instance_expr = Implies(Forall(instance_param_or_params = [b_1_to_j], instance_expr = InSet(f__b_1_to_j, V), condition = Q__b_1_to_j), InSet(vec_summation_b1toj_fQ, V)).with_wrapping_at(2), 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 \underset{{\scriptscriptstyle c}}{\in} \textrm{VecSpaces}\left(K\right)}~\left(\begin{array}{c} \begin{array}{l} \left[\forall_{b_{1}, b_{2}, \ldots, b_{j}~|~Q\left(b_{1}, b_{2}, \ldots, b_{j}\right)}~\left(f\left(b_{1}, b_{2}, \ldots, b_{j}\right) \in V\right)\right] \Rightarrow  \\ \left(\left[\sum_{b_{1}, b_{2}, \ldots, b_{j}~|~Q\left(b_{1}, b_{2}, \ldots, b_{j}\right)}~f\left(b_{1}, b_{2}, \ldots, b_{j}\right)\right] \in V\right) \end{array} \end{array}\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: 30
body: 4
3ExprTuple30
4Conditionalvalue: 5
condition: 6
5Operationoperator: 7
operands: 8
6Operationoperator: 9
operands: 10
7Literal
8ExprTuple11, 12
9Literal
10ExprTuple30, 13
11Operationoperator: 14
operand: 19
12Operationoperator: 27
operands: 16
13Operationoperator: 17
operand: 21
14Literal
15ExprTuple19
16ExprTuple20, 30
17Literal
18ExprTuple21
19Lambdaparameters: 35
body: 22
20Operationoperator: 23
operand: 26
21Variable
22Conditionalvalue: 25
condition: 32
23Literal
24ExprTuple26
25Operationoperator: 27
operands: 28
26Lambdaparameters: 35
body: 29
27Literal
28ExprTuple31, 30
29Conditionalvalue: 31
condition: 32
30Variable
31Operationoperator: 33
operands: 35
32Operationoperator: 34
operands: 35
33Variable
34Variable
35ExprTuple36
36ExprRangelambda_map: 37
start_index: 38
end_index: 39
37Lambdaparameter: 43
body: 40
38Literal
39Variable
40IndexedVarvariable: 41
index: 43
41Variable
42ExprTuple43
43Variable