logo

Expression of type ExprTuple

from the theory of proveit.logic.booleans.conjunction

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
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(And(A_1_to_l, B, C_1_to_m, D_1_to_n), And(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} \land  A_{2} \land  \ldots \land  A_{l} \land B\land C_{1} \land  C_{2} \land  \ldots \land  C_{m}\land D_{1} \land  D_{2} \land  \ldots \land  D_{n}\right) =  \\ \left(A_{1} \land  A_{2} \land  \ldots \land  A_{l}\land C_{1} \land  C_{2} \land  \ldots \land  C_{m} \land B\land D_{1} \land  D_{2} \land  \ldots \land  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
2ExprTuple44, 46, 49
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 9
5Operationoperator: 30
operands: 8
6Literal
7ExprTuple9
8ExprTuple10, 11, 12
9Lambdaparameters: 29
body: 13
10Operationoperator: 52
operands: 14
11Operationoperator: 52
operands: 15
12Operationoperator: 52
operands: 16
13Conditionalvalue: 17
condition: 18
14ExprTuple44, 19
15ExprTuple46, 19
16ExprTuple49, 19
17Operationoperator: 20
operands: 21
18Operationoperator: 30
operands: 22
19Literal
20Literal
21ExprTuple23, 24
22ExprTuple25, 26, 27, 28
23Operationoperator: 30
operands: 29
24Operationoperator: 30
operands: 31
25ExprRangelambda_map: 32
start_index: 48
end_index: 44
26Operationoperator: 52
operands: 33
27ExprRangelambda_map: 34
start_index: 48
end_index: 46
28ExprRangelambda_map: 35
start_index: 48
end_index: 49
29ExprTuple36, 40, 37, 38
30Literal
31ExprTuple36, 37, 40, 38
32Lambdaparameter: 62
body: 39
33ExprTuple40, 57
34Lambdaparameter: 62
body: 41
35Lambdaparameter: 62
body: 42
36ExprRangelambda_map: 43
start_index: 48
end_index: 44
37ExprRangelambda_map: 45
start_index: 48
end_index: 46
38ExprRangelambda_map: 47
start_index: 48
end_index: 49
39Operationoperator: 52
operands: 50
40Variable
41Operationoperator: 52
operands: 51
42Operationoperator: 52
operands: 53
43Lambdaparameter: 62
body: 54
44Variable
45Lambdaparameter: 62
body: 55
46Variable
47Lambdaparameter: 62
body: 56
48Literal
49Variable
50ExprTuple54, 57
51ExprTuple55, 57
52Literal
53ExprTuple56, 57
54IndexedVarvariable: 58
index: 62
55IndexedVarvariable: 59
index: 62
56IndexedVarvariable: 60
index: 62
57Literal
58Variable
59Variable
60Variable
61ExprTuple62
62Variable