logo

Expression of type ExprTuple

from the theory of proveit.logic.sets.enumeration

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, c, i, j, k
from proveit.core_expr_types import a_1_to_i, b_1_to_j, d_1_to_k
from proveit.logic import And, Equals, Forall, InSet, Set
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, d_1_to_k], instance_expr = Equals(Set(a_1_to_i, b_1_to_j, c, d_1_to_k), Set(a_1_to_i, c, b_1_to_j, d_1_to_k))), 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, d_{1}, d_{2}, \ldots, d_{k}}~\left(\left\{a_{1}, a_{2}, \ldots, a_{i},b_{1}, b_{2}, \ldots, b_{j}, c,d_{1}, d_{2}, \ldots, d_{k}\right\} = \left\{a_{1}, a_{2}, \ldots, a_{i}, c,b_{1}, b_{2}, \ldots, b_{j},d_{1}, d_{2}, \ldots, d_{k}\right\}\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
2ExprTuple32, 34, 37
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 10
5Operationoperator: 8
operands: 9
6Literal
7ExprTuple10
8Literal
9ExprTuple11, 12, 13
10Lambdaparameters: 24
body: 14
11Operationoperator: 17
operands: 15
12Operationoperator: 17
operands: 16
13Operationoperator: 17
operands: 18
14Operationoperator: 19
operands: 20
15ExprTuple32, 21
16ExprTuple34, 21
17Literal
18ExprTuple37, 21
19Literal
20ExprTuple22, 23
21Literal
22Operationoperator: 25
operands: 24
23Operationoperator: 25
operands: 26
24ExprTuple27, 29, 28, 30
25Literal
26ExprTuple27, 28, 29, 30
27ExprRangelambda_map: 31
start_index: 36
end_index: 32
28Variable
29ExprRangelambda_map: 33
start_index: 36
end_index: 34
30ExprRangelambda_map: 35
start_index: 36
end_index: 37
31Lambdaparameter: 45
body: 38
32Variable
33Lambdaparameter: 45
body: 39
34Variable
35Lambdaparameter: 45
body: 40
36Literal
37Variable
38IndexedVarvariable: 41
index: 45
39IndexedVarvariable: 42
index: 45
40IndexedVarvariable: 43
index: 45
41Variable
42Variable
43Variable
44ExprTuple45
45Variable