logo

Expression of type ExprTuple

from the theory of proveit.core_expr_types.tuples

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
from proveit.core_expr_types import f_i_to_j, fk, g_i_to_j, gk
from proveit.logic import And, Equals, Forall, Implies, InSet
from proveit.numbers import Integer, Interval
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda([i, j], Conditional(Implies(Forall(instance_param_or_params = [k], instance_expr = Equals(fk, gk), domain = Interval(i, j)), Equals([f_i_to_j], [g_i_to_j])), And(InSet(i, Integer), InSet(j, 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(\left(i, j\right) \mapsto \left\{\left[\forall_{k \in \{i~\ldotp \ldotp~j\}}~\left(f\left(k\right) = g\left(k\right)\right)\right] \Rightarrow \left(\left(f\left(i\right), f\left(i + 1\right), \ldots, f\left(j\right)\right) = \left(g\left(i\right), g\left(i + 1\right), \ldots, g\left(j\right)\right)\right) \textrm{ if } i \in \mathbb{Z} ,  j \in \mathbb{Z}\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: 43
body: 2
2Conditionalvalue: 3
condition: 4
3Operationoperator: 5
operands: 6
4Operationoperator: 7
operands: 8
5Literal
6ExprTuple9, 10
7Literal
8ExprTuple11, 12
9Operationoperator: 13
operand: 18
10Operationoperator: 29
operands: 15
11Operationoperator: 31
operands: 16
12Operationoperator: 31
operands: 17
13Literal
14ExprTuple18
15ExprTuple19, 20
16ExprTuple46, 21
17ExprTuple47, 21
18Lambdaparameter: 45
body: 22
19ExprTuple23
20ExprTuple24
21Literal
22Conditionalvalue: 25
condition: 26
23ExprRangelambda_map: 27
start_index: 46
end_index: 47
24ExprRangelambda_map: 28
start_index: 46
end_index: 47
25Operationoperator: 29
operands: 30
26Operationoperator: 31
operands: 32
27Lambdaparameter: 44
body: 33
28Lambdaparameter: 44
body: 34
29Literal
30ExprTuple35, 36
31Literal
32ExprTuple45, 37
33Operationoperator: 39
operand: 44
34Operationoperator: 40
operand: 44
35Operationoperator: 39
operand: 45
36Operationoperator: 40
operand: 45
37Operationoperator: 42
operands: 43
38ExprTuple44
39Variable
40Variable
41ExprTuple45
42Literal
43ExprTuple46, 47
44Variable
45Variable
46Variable
47Variable