logo

Expression of type ExprTuple

from the theory of proveit.numbers.summation

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 ExprTuple, Lambda, Q, Qx, f, fx, x
from proveit.logic import Equals, Forall, Implies, InSet
from proveit.numbers import Sum, ZeroSet, zero
In [2]:
# build up the expression from sub-expressions
sub_expr1 = [x]
expr = ExprTuple(Lambda([f, Q], Implies(Forall(instance_param_or_params = sub_expr1, instance_expr = Equals(fx, zero), condition = Qx), InSet(Sum(index_or_indices = sub_expr1, summand = fx, condition = Qx), ZeroSet))))
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(\left(f, Q\right) \mapsto \left(\left[\forall_{x~|~Q\left(x\right)}~\left(f\left(x\right) = 0\right)\right] \Rightarrow \left(\left[\sum_{x~|~Q\left(x\right)}~f\left(x\right)\right] \in \left\{0\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
1Lambdaparameters: 2
body: 3
2ExprTuple28, 29
3Operationoperator: 4
operands: 5
4Literal
5ExprTuple6, 7
6Operationoperator: 8
operand: 12
7Operationoperator: 10
operands: 11
8Literal
9ExprTuple12
10Literal
11ExprTuple13, 14
12Lambdaparameter: 31
body: 15
13Operationoperator: 16
operand: 21
14Operationoperator: 18
operand: 25
15Conditionalvalue: 20
condition: 27
16Literal
17ExprTuple21
18Literal
19ExprTuple25
20Operationoperator: 22
operands: 23
21Lambdaparameter: 31
body: 24
22Literal
23ExprTuple26, 25
24Conditionalvalue: 26
condition: 27
25Literal
26Operationoperator: 28
operand: 31
27Operationoperator: 29
operand: 31
28Variable
29Variable
30ExprTuple31
31Variable