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, 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, InClass, InSet
In [2]:
# build up the expression from sub-expressions
expr = Conditional(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), InClass(V, 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())
\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} \textrm{ if } V \underset{{\scriptscriptstyle c}}{\in} \textrm{VecSpaces}\left(K\right)\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: 3
operands: 4
2Operationoperator: 5
operands: 6
3Literal
4ExprTuple7, 8
5Literal
6ExprTuple26, 9
7Operationoperator: 10
operand: 15
8Operationoperator: 23
operands: 12
9Operationoperator: 13
operand: 17
10Literal
11ExprTuple15
12ExprTuple16, 26
13Literal
14ExprTuple17
15Lambdaparameters: 31
body: 18
16Operationoperator: 19
operand: 22
17Variable
18Conditionalvalue: 21
condition: 28
19Literal
20ExprTuple22
21Operationoperator: 23
operands: 24
22Lambdaparameters: 31
body: 25
23Literal
24ExprTuple27, 26
25Conditionalvalue: 27
condition: 28
26Variable
27Operationoperator: 29
operands: 31
28Operationoperator: 30
operands: 31
29Variable
30Variable
31ExprTuple32
32ExprRangelambda_map: 33
start_index: 34
end_index: 35
33Lambdaparameter: 39
body: 36
34Literal
35Variable
36IndexedVarvariable: 37
index: 39
37Variable
38ExprTuple39
39Variable