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 Q, f, j
from proveit.core_expr_types import Q__b_1_to_j, b_1_to_j, f__b_1_to_j
from proveit.linear_algebra.addition import vec_summation_b1toj_fQ
from proveit.logic import Equals, Forall, Implies, InSet
from proveit.numbers import Complex, NaturalPos
from proveit.numbers.summation import summation_b1toj_fQ
In [2]:
# build up the expression from sub-expressions
expr = Forall(instance_param_or_params = [j], instance_expr = Forall(instance_param_or_params = [f, Q], instance_expr = Implies(Forall(instance_param_or_params = [b_1_to_j], instance_expr = InSet(f__b_1_to_j, Complex), condition = Q__b_1_to_j), Equals(vec_summation_b1toj_fQ, summation_b1toj_fQ)).with_wrapping_at(2)), 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_{j \in \mathbb{N}^+}~\left[\forall_{f, Q}~\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 \mathbb{C}\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] = \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]\right) \end{array} \end{array}\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: 17
operand: 2
1ExprTuple2
2Lambdaparameter: 42
body: 4
3ExprTuple42
4Conditionalvalue: 5
condition: 6
5Operationoperator: 17
operand: 9
6Operationoperator: 30
operands: 8
7ExprTuple9
8ExprTuple42, 10
9Lambdaparameters: 11
body: 12
10Literal
11ExprTuple36, 37
12Operationoperator: 13
operands: 14
13Literal
14ExprTuple15, 16
15Operationoperator: 17
operand: 21
16Operationoperator: 19
operands: 20
17Literal
18ExprTuple21
19Literal
20ExprTuple22, 23
21Lambdaparameters: 38
body: 24
22Operationoperator: 25
operand: 29
23Operationoperator: 26
operand: 29
24Conditionalvalue: 28
condition: 35
25Literal
26Literal
27ExprTuple29
28Operationoperator: 30
operands: 31
29Lambdaparameters: 38
body: 32
30Literal
31ExprTuple34, 33
32Conditionalvalue: 34
condition: 35
33Literal
34Operationoperator: 36
operands: 38
35Operationoperator: 37
operands: 38
36Variable
37Variable
38ExprTuple39
39ExprRangelambda_map: 40
start_index: 41
end_index: 42
40Lambdaparameter: 46
body: 43
41Literal
42Variable
43IndexedVarvariable: 44
index: 46
44Variable
45ExprTuple46
46Variable