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 Conditional, ExprTuple, Lambda, l, m, n
from proveit.core_expr_types import A_1_to_l, B_1_to_m, C_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_1_to_m, C_1_to_n], instance_expr = Equals(And(A_1_to_l, B_1_to_m, C_1_to_n), And(A_1_to_l, And(B_1_to_m), C_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_{1}, B_{2}, \ldots, B_{m}, C_{1}, C_{2}, \ldots, C_{n} \in \mathbb{B}}~\left(\begin{array}{c} \begin{array}{l} \left(A_{1} \land  A_{2} \land  \ldots \land  A_{l}\land B_{1} \land  B_{2} \land  \ldots \land  B_{m}\land C_{1} \land  C_{2} \land  \ldots \land  C_{n}\right) =  \\ \left(A_{1} \land  A_{2} \land  \ldots \land  A_{l} \land \left(B_{1} \land  B_{2} \land  \ldots \land  B_{m}\right)\land C_{1} \land  C_{2} \land  \ldots \land  C_{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
2ExprTuple40, 55, 44
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 9
5Operationoperator: 41
operands: 8
6Literal
7ExprTuple9
8ExprTuple10, 11, 12
9Lambdaparameters: 28
body: 13
10Operationoperator: 47
operands: 14
11Operationoperator: 47
operands: 15
12Operationoperator: 47
operands: 16
13Conditionalvalue: 17
condition: 18
14ExprTuple40, 19
15ExprTuple55, 19
16ExprTuple44, 19
17Operationoperator: 20
operands: 21
18Operationoperator: 41
operands: 22
19Literal
20Literal
21ExprTuple23, 24
22ExprTuple25, 26, 27
23Operationoperator: 41
operands: 28
24Operationoperator: 41
operands: 29
25ExprRangelambda_map: 30
start_index: 54
end_index: 40
26ExprRangelambda_map: 31
start_index: 54
end_index: 55
27ExprRangelambda_map: 32
start_index: 54
end_index: 44
28ExprTuple33, 49, 35
29ExprTuple33, 34, 35
30Lambdaparameter: 61
body: 36
31Lambdaparameter: 61
body: 37
32Lambdaparameter: 61
body: 38
33ExprRangelambda_map: 39
start_index: 54
end_index: 40
34Operationoperator: 41
operands: 42
35ExprRangelambda_map: 43
start_index: 54
end_index: 44
36Operationoperator: 47
operands: 45
37Operationoperator: 47
operands: 46
38Operationoperator: 47
operands: 48
39Lambdaparameter: 61
body: 50
40Variable
41Literal
42ExprTuple49
43Lambdaparameter: 61
body: 51
44Variable
45ExprTuple50, 52
46ExprTuple58, 52
47Literal
48ExprTuple51, 52
49ExprRangelambda_map: 53
start_index: 54
end_index: 55
50IndexedVarvariable: 56
index: 61
51IndexedVarvariable: 57
index: 61
52Literal
53Lambdaparameter: 61
body: 58
54Literal
55Variable
56Variable
57Variable
58IndexedVarvariable: 59
index: 61
59Variable
60ExprTuple61
61Variable