logo

Expression of type Conditional

from the theory of proveit.numbers.multiplication

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, Function, Q, f, i, j, k
from proveit.core_expr_types import a_1_to_i, b_1_to_j, c_1_to_k
from proveit.logic import And, Equals, Forall, Implies, InSet
from proveit.numbers import Complex, Mult, Natural, NaturalPos, Sum
from proveit.numbers.summation import summation_b1toj_fQ
In [2]:
# build up the expression from sub-expressions
sub_expr1 = [b_1_to_j]
sub_expr2 = Function(f, sub_expr1)
sub_expr3 = Function(Q, sub_expr1)
expr = Conditional(Forall(instance_param_or_params = [f, Q], instance_expr = Implies(Forall(instance_param_or_params = sub_expr1, instance_expr = InSet(sub_expr2, Complex), condition = sub_expr3), Forall(instance_param_or_params = [a_1_to_i, c_1_to_k], instance_expr = Equals(Mult(a_1_to_i, summation_b1toj_fQ, c_1_to_k), Sum(index_or_indices = sub_expr1, summand = Mult(a_1_to_i, sub_expr2, c_1_to_k), condition = sub_expr3)).with_wrapping_at(2), domain = Complex).with_wrapping()).with_wrapping_at(2)), And(InSet(i, Natural), InSet(j, NaturalPos), InSet(k, Natural)))
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[\begin{array}{l}\forall_{a_{1}, a_{2}, \ldots, a_{i}, c_{1}, c_{2}, \ldots, c_{k} \in \mathbb{C}}~\\
\left(\begin{array}{c} \begin{array}{l} \left(a_{1} \cdot  a_{2} \cdot  \ldots \cdot  a_{i} \cdot \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]\cdot c_{1} \cdot  c_{2} \cdot  \ldots \cdot  c_{k}\right) =  \\ \left[\sum_{b_{1}, b_{2}, \ldots, b_{j}~|~Q\left(b_{1}, b_{2}, \ldots, b_{j}\right)}~\left(a_{1} \cdot  a_{2} \cdot  \ldots \cdot  a_{i} \cdot f\left(b_{1}, b_{2}, \ldots, b_{j}\right)\cdot c_{1} \cdot  c_{2} \cdot  \ldots \cdot  c_{k}\right)\right] \end{array} \end{array}\right)\end{array}\right] \end{array} \end{array}\right) \textrm{ if } i \in \mathbb{N} ,  j \in \mathbb{N}^+ ,  k \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: 21
operand: 5
2Operationoperator: 34
operands: 4
3ExprTuple5
4ExprTuple6, 7, 8
5Lambdaparameters: 9
body: 10
6Operationoperator: 52
operands: 11
7Operationoperator: 52
operands: 12
8Operationoperator: 52
operands: 13
9ExprTuple67, 64
10Operationoperator: 14
operands: 15
11ExprTuple66, 17
12ExprTuple77, 16
13ExprTuple70, 17
14Literal
15ExprTuple18, 19
16Literal
17Literal
18Operationoperator: 21
operand: 23
19Operationoperator: 21
operand: 24
20ExprTuple23
21Literal
22ExprTuple24
23Lambdaparameters: 68
body: 25
24Lambdaparameters: 26
body: 27
25Conditionalvalue: 28
condition: 60
26ExprTuple61, 63
27Conditionalvalue: 29
condition: 30
28Operationoperator: 52
operands: 31
29Operationoperator: 32
operands: 33
30Operationoperator: 34
operands: 35
31ExprTuple62, 56
32Literal
33ExprTuple36, 37
34Literal
35ExprTuple38, 39
36Operationoperator: 58
operands: 40
37Operationoperator: 48
operand: 45
38ExprRangelambda_map: 42
start_index: 76
end_index: 66
39ExprRangelambda_map: 43
start_index: 76
end_index: 70
40ExprTuple61, 44, 63
41ExprTuple45
42Lambdaparameter: 82
body: 46
43Lambdaparameter: 82
body: 47
44Operationoperator: 48
operand: 54
45Lambdaparameters: 68
body: 50
46Operationoperator: 52
operands: 51
47Operationoperator: 52
operands: 53
48Literal
49ExprTuple54
50Conditionalvalue: 55
condition: 60
51ExprTuple71, 56
52Literal
53ExprTuple73, 56
54Lambdaparameters: 68
body: 57
55Operationoperator: 58
operands: 59
56Literal
57Conditionalvalue: 62
condition: 60
58Literal
59ExprTuple61, 62, 63
60Operationoperator: 64
operands: 68
61ExprRangelambda_map: 65
start_index: 76
end_index: 66
62Operationoperator: 67
operands: 68
63ExprRangelambda_map: 69
start_index: 76
end_index: 70
64Variable
65Lambdaparameter: 82
body: 71
66Variable
67Variable
68ExprTuple72
69Lambdaparameter: 82
body: 73
70Variable
71IndexedVarvariable: 74
index: 82
72ExprRangelambda_map: 75
start_index: 76
end_index: 77
73IndexedVarvariable: 78
index: 82
74Variable
75Lambdaparameter: 82
body: 79
76Literal
77Variable
78Variable
79IndexedVarvariable: 80
index: 82
80Variable
81ExprTuple82
82Variable