logo

Expression of type Conditional

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 Conditional, 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 = Conditional(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)), InSet(j, 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_{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) \textrm{ if } j \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: 13
operand: 5
2Operationoperator: 26
operands: 4
3ExprTuple5
4ExprTuple38, 6
5Lambdaparameters: 7
body: 8
6Literal
7ExprTuple32, 33
8Operationoperator: 9
operands: 10
9Literal
10ExprTuple11, 12
11Operationoperator: 13
operand: 17
12Operationoperator: 15
operands: 16
13Literal
14ExprTuple17
15Literal
16ExprTuple18, 19
17Lambdaparameters: 34
body: 20
18Operationoperator: 21
operand: 25
19Operationoperator: 22
operand: 25
20Conditionalvalue: 24
condition: 31
21Literal
22Literal
23ExprTuple25
24Operationoperator: 26
operands: 27
25Lambdaparameters: 34
body: 28
26Literal
27ExprTuple30, 29
28Conditionalvalue: 30
condition: 31
29Literal
30Operationoperator: 32
operands: 34
31Operationoperator: 33
operands: 34
32Variable
33Variable
34ExprTuple35
35ExprRangelambda_map: 36
start_index: 37
end_index: 38
36Lambdaparameter: 42
body: 39
37Literal
38Variable
39IndexedVarvariable: 40
index: 42
40Variable
41ExprTuple42
42Variable