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, Q, V, 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 import VecSpaces
from proveit.linear_algebra.addition import vec_summation_b1toj_fQ
from proveit.logic import Forall, Implies, InSet
from proveit.numbers import NaturalPos
In [2]:
# build up the expression from sub-expressions
expr = Conditional(Forall(instance_param_or_params = [K, f, Q], instance_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))), 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_{K, f, Q}~\left[\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)\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: 22
operand: 5
2Operationoperator: 35
operands: 4
3ExprTuple5
4ExprTuple47, 6
5Lambdaparameters: 7
body: 8
6Literal
7ExprTuple29, 41, 42
8Operationoperator: 22
operand: 10
9ExprTuple10
10Lambdaparameter: 38
body: 12
11ExprTuple38
12Conditionalvalue: 13
condition: 14
13Operationoperator: 15
operands: 16
14Operationoperator: 17
operands: 18
15Literal
16ExprTuple19, 20
17Literal
18ExprTuple38, 21
19Operationoperator: 22
operand: 27
20Operationoperator: 35
operands: 24
21Operationoperator: 25
operand: 29
22Literal
23ExprTuple27
24ExprTuple28, 38
25Literal
26ExprTuple29
27Lambdaparameters: 43
body: 30
28Operationoperator: 31
operand: 34
29Variable
30Conditionalvalue: 33
condition: 40
31Literal
32ExprTuple34
33Operationoperator: 35
operands: 36
34Lambdaparameters: 43
body: 37
35Literal
36ExprTuple39, 38
37Conditionalvalue: 39
condition: 40
38Variable
39Operationoperator: 41
operands: 43
40Operationoperator: 42
operands: 43
41Variable
42Variable
43ExprTuple44
44ExprRangelambda_map: 45
start_index: 46
end_index: 47
45Lambdaparameter: 51
body: 48
46Literal
47Variable
48IndexedVarvariable: 49
index: 51
49Variable
50ExprTuple51
51Variable