logo

Expression of type ExprTuple

from the theory of proveit.logic.booleans.disjunction

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 B, Conditional, ExprTuple, Lambda, l, m, n
from proveit.core_expr_types import A_1_to_l, C_1_to_m, D_1_to_n
from proveit.logic import And, Boolean, Equals, Forall, InSet, Or
from proveit.numbers import Natural
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda([l, m, n], Conditional(Forall(instance_param_or_params = [A_1_to_l, B, C_1_to_m, D_1_to_n], instance_expr = Equals(Or(A_1_to_l, B, C_1_to_m, D_1_to_n), Or(A_1_to_l, C_1_to_m, B, D_1_to_n)).with_wrapping_at(2), domain = Boolean), And(InSet(l, Natural), InSet(m, Natural), InSet(n, 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(l, m, n\right) \mapsto \left\{\forall_{A_{1}, A_{2}, \ldots, A_{l}, B, C_{1}, C_{2}, \ldots, C_{m}, D_{1}, D_{2}, \ldots, D_{n} \in \mathbb{B}}~\left(\begin{array}{c} \begin{array}{l} \left(A_{1} \lor  A_{2} \lor  \ldots \lor  A_{l} \lor B\lor C_{1} \lor  C_{2} \lor  \ldots \lor  C_{m}\lor D_{1} \lor  D_{2} \lor  \ldots \lor  D_{n}\right) =  \\ \left(A_{1} \lor  A_{2} \lor  \ldots \lor  A_{l}\lor C_{1} \lor  C_{2} \lor  \ldots \lor  C_{m} \lor B\lor D_{1} \lor  D_{2} \lor  \ldots \lor  D_{n}\right) \end{array} \end{array}\right) \textrm{ if } l \in \mathbb{N} ,  m \in \mathbb{N} ,  n \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
2ExprTuple45, 47, 50
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 9
5Operationoperator: 22
operands: 8
6Literal
7ExprTuple9
8ExprTuple10, 11, 12
9Lambdaparameters: 30
body: 13
10Operationoperator: 53
operands: 14
11Operationoperator: 53
operands: 15
12Operationoperator: 53
operands: 16
13Conditionalvalue: 17
condition: 18
14ExprTuple45, 19
15ExprTuple47, 19
16ExprTuple50, 19
17Operationoperator: 20
operands: 21
18Operationoperator: 22
operands: 23
19Literal
20Literal
21ExprTuple24, 25
22Literal
23ExprTuple26, 27, 28, 29
24Operationoperator: 31
operands: 30
25Operationoperator: 31
operands: 32
26ExprRangelambda_map: 33
start_index: 49
end_index: 45
27Operationoperator: 53
operands: 34
28ExprRangelambda_map: 35
start_index: 49
end_index: 47
29ExprRangelambda_map: 36
start_index: 49
end_index: 50
30ExprTuple37, 41, 38, 39
31Literal
32ExprTuple37, 38, 41, 39
33Lambdaparameter: 63
body: 40
34ExprTuple41, 58
35Lambdaparameter: 63
body: 42
36Lambdaparameter: 63
body: 43
37ExprRangelambda_map: 44
start_index: 49
end_index: 45
38ExprRangelambda_map: 46
start_index: 49
end_index: 47
39ExprRangelambda_map: 48
start_index: 49
end_index: 50
40Operationoperator: 53
operands: 51
41Variable
42Operationoperator: 53
operands: 52
43Operationoperator: 53
operands: 54
44Lambdaparameter: 63
body: 55
45Variable
46Lambdaparameter: 63
body: 56
47Variable
48Lambdaparameter: 63
body: 57
49Literal
50Variable
51ExprTuple55, 58
52ExprTuple56, 58
53Literal
54ExprTuple57, 58
55IndexedVarvariable: 59
index: 63
56IndexedVarvariable: 60
index: 63
57IndexedVarvariable: 61
index: 63
58Literal
59Variable
60Variable
61Variable
62ExprTuple63
63Variable