# 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.
# import Expression classes needed to build the expression
from proveit import ExprTuple, Lambda, a, i, v, va, vi
from proveit.linear_algebra import VecSum
from proveit.logic import Equals, Forall
from proveit.numbers import Integer, Interval

In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda(v, Forall(instance_param_or_params = [a], instance_expr = Equals(VecSum(index_or_indices = [i], summand = vi, domain = Interval(a, a)), va), domain = Integer)))

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(v \mapsto \left[\forall_{a \in \mathbb{Z}}~\left(\left(\sum_{i=a}^{a} v\left(i\right)\right) = v\left(a\right)\right)\right]\right)

In [5]:
stored_expr.style_options()

no style options
In [6]:
# display the expression information
stored_expr.expr_info()

core typesub-expressionsexpression
0ExprTuple1
1Lambdaparameter: 23
body: 3
2ExprTuple23
3Operationoperator: 4
operand: 6
4Literal
5ExprTuple6
6Lambdaparameter: 31
body: 7
7Conditionalvalue: 8
condition: 9
8Operationoperator: 10
operands: 11
9Operationoperator: 25
operands: 12
10Literal
11ExprTuple13, 14
12ExprTuple31, 15
13Operationoperator: 16
operand: 19
14Operationoperator: 23
operand: 31
15Literal
16Literal
17ExprTuple19
18ExprTuple31
19Lambdaparameter: 27
body: 20
20Conditionalvalue: 21
condition: 22
21Operationoperator: 23
operand: 27
22Operationoperator: 25
operands: 26
23Variable
24ExprTuple27
25Literal
26ExprTuple27, 28
27Variable
28Operationoperator: 29
operands: 30
29Literal
30ExprTuple31, 31
31Variable