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 a_1_to_i, b_1_to_j, c_1_to_k, d_1_to_j
from proveit.logic import And, Equals, Forall, InSet
from proveit.numbers import Natural
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda([i, j, k], Conditional(Forall(instance_param_or_params = [a_1_to_i, b_1_to_j, c_1_to_k, d_1_to_j], instance_expr = Equals([a_1_to_i, b_1_to_j, c_1_to_k], [a_1_to_i, d_1_to_j, c_1_to_k]).with_wrapping_at(2), condition = Equals([b_1_to_j], [d_1_to_j])), And(InSet(i, Natural), InSet(j, Natural), InSet(k, Natural)))))
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, k\right) \mapsto \left\{\forall_{a_{1}, a_{2}, \ldots, a_{i}, b_{1}, b_{2}, \ldots, b_{j}, c_{1}, c_{2}, \ldots, c_{k}, d_{1}, d_{2}, \ldots, d_{j}~|~\left(b_{1}, b_{2}, \ldots, b_{j}\right) = \left(d_{1}, d_{2}, \ldots, d_{j}\right)}~\left(\begin{array}{c} \begin{array}{l} \left(a_{1}, a_{2}, \ldots, a_{i},b_{1}, b_{2}, \ldots, b_{j},c_{1}, c_{2}, \ldots, c_{k}\right) =  \\ \left(a_{1}, a_{2}, \ldots, a_{i},d_{1}, d_{2}, \ldots, d_{j},c_{1}, c_{2}, \ldots, c_{k}\right) \end{array} \end{array}\right) \textrm{ if } i \in \mathbb{N} ,  j \in \mathbb{N} ,  k \in \mathbb{N}\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
2ExprTuple35, 41, 37
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 10
5Operationoperator: 8
operands: 9
6Literal
7ExprTuple10
8Literal
9ExprTuple11, 12, 13
10Lambdaparameters: 14
body: 15
11Operationoperator: 18
operands: 16
12Operationoperator: 18
operands: 17
13Operationoperator: 18
operands: 19
14ExprTuple30, 32, 31, 33
15Conditionalvalue: 20
condition: 21
16ExprTuple35, 22
17ExprTuple41, 22
18Literal
19ExprTuple37, 22
20Operationoperator: 24
operands: 23
21Operationoperator: 24
operands: 25
22Literal
23ExprTuple26, 27
24Literal
25ExprTuple28, 29
26ExprTuple30, 32, 31
27ExprTuple30, 33, 31
28ExprTuple32
29ExprTuple33
30ExprRangelambda_map: 34
start_index: 40
end_index: 35
31ExprRangelambda_map: 36
start_index: 40
end_index: 37
32ExprRangelambda_map: 38
start_index: 40
end_index: 41
33ExprRangelambda_map: 39
start_index: 40
end_index: 41
34Lambdaparameter: 51
body: 42
35Variable
36Lambdaparameter: 51
body: 43
37Variable
38Lambdaparameter: 51
body: 44
39Lambdaparameter: 51
body: 45
40Literal
41Variable
42IndexedVarvariable: 46
index: 51
43IndexedVarvariable: 47
index: 51
44IndexedVarvariable: 48
index: 51
45IndexedVarvariable: 49
index: 51
46Variable
47Variable
48Variable
49Variable
50ExprTuple51
51Variable