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 Conditional, ExprTuple, Lambda, i, j, k, x
from proveit.logic import And, Equals, Forall, InSet, NotEquals
from proveit.numbers import Add, Complex, Exp, Integer, Interval, LessEq, Sum, frac, one, subtract
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda(x, Conditional(Forall(instance_param_or_params = [j, k], instance_expr = Equals(Sum(index_or_indices = [i], summand = Exp(x, i), domain = Interval(j, k)), frac(subtract(Exp(x, j), Exp(x, Add(k, one))), subtract(one, x))), domain = Integer, condition = LessEq(j, k)), And(InSet(x, Complex), NotEquals(x, one)))))
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(x \mapsto \left\{\forall_{j, k \in \mathbb{Z}~|~j \leq k}~\left(\left(\sum_{i = j}^{k} x^{i}\right) = \frac{x^{j} - x^{k + 1}}{1 - x}\right) \textrm{ if } x \in \mathbb{C} ,  x \neq 1\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: 62
body: 2
2Conditionalvalue: 3
condition: 4
3Operationoperator: 5
operand: 8
4Operationoperator: 20
operands: 7
5Literal
6ExprTuple8
7ExprTuple9, 10
8Lambdaparameters: 58
body: 11
9Operationoperator: 48
operands: 12
10Operationoperator: 13
operands: 14
11Conditionalvalue: 15
condition: 16
12ExprTuple62, 17
13Literal
14ExprTuple62, 67
15Operationoperator: 18
operands: 19
16Operationoperator: 20
operands: 21
17Literal
18Literal
19ExprTuple22, 23
20Literal
21ExprTuple24, 25, 26
22Operationoperator: 27
operand: 34
23Operationoperator: 29
operands: 30
24Operationoperator: 48
operands: 31
25Operationoperator: 48
operands: 32
26Operationoperator: 33
operands: 58
27Literal
28ExprTuple34
29Literal
30ExprTuple35, 36
31ExprTuple61, 37
32ExprTuple66, 37
33Literal
34Lambdaparameter: 54
body: 39
35Operationoperator: 64
operands: 40
36Operationoperator: 64
operands: 41
37Literal
38ExprTuple54
39Conditionalvalue: 42
condition: 43
40ExprTuple44, 45
41ExprTuple67, 46
42Operationoperator: 59
operands: 47
43Operationoperator: 48
operands: 49
44Operationoperator: 59
operands: 50
45Operationoperator: 52
operand: 56
46Operationoperator: 52
operand: 62
47ExprTuple62, 54
48Literal
49ExprTuple54, 55
50ExprTuple62, 61
51ExprTuple56
52Literal
53ExprTuple62
54Variable
55Operationoperator: 57
operands: 58
56Operationoperator: 59
operands: 60
57Literal
58ExprTuple61, 66
59Literal
60ExprTuple62, 63
61Variable
62Variable
63Operationoperator: 64
operands: 65
64Literal
65ExprTuple66, 67
66Variable
67Literal