logo

Expression of type Lambda

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, Lambda, 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 = Lambda(j, 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())
j \mapsto \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()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Lambdaparameter: 49
body: 2
1ExprTuple49
2Conditionalvalue: 3
condition: 4
3Operationoperator: 24
operand: 7
4Operationoperator: 37
operands: 6
5ExprTuple7
6ExprTuple49, 8
7Lambdaparameters: 9
body: 10
8Literal
9ExprTuple31, 43, 44
10Operationoperator: 24
operand: 12
11ExprTuple12
12Lambdaparameter: 40
body: 14
13ExprTuple40
14Conditionalvalue: 15
condition: 16
15Operationoperator: 17
operands: 18
16Operationoperator: 19
operands: 20
17Literal
18ExprTuple21, 22
19Literal
20ExprTuple40, 23
21Operationoperator: 24
operand: 29
22Operationoperator: 37
operands: 26
23Operationoperator: 27
operand: 31
24Literal
25ExprTuple29
26ExprTuple30, 40
27Literal
28ExprTuple31
29Lambdaparameters: 45
body: 32
30Operationoperator: 33
operand: 36
31Variable
32Conditionalvalue: 35
condition: 42
33Literal
34ExprTuple36
35Operationoperator: 37
operands: 38
36Lambdaparameters: 45
body: 39
37Literal
38ExprTuple41, 40
39Conditionalvalue: 41
condition: 42
40Variable
41Operationoperator: 43
operands: 45
42Operationoperator: 44
operands: 45
43Variable
44Variable
45ExprTuple46
46ExprRangelambda_map: 47
start_index: 48
end_index: 49
47Lambdaparameter: 53
body: 50
48Literal
49Variable
50IndexedVarvariable: 51
index: 53
51Variable
52ExprTuple53
53Variable