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 A, ExprRange, ExprTuple, IndexedVar, Variable, m
from proveit.core_expr_types import A_1_to_m
from proveit.logic import Boolean, Forall, InSet, Or
from proveit.numbers import Add, NaturalPos, one, two
In [2]:
# build up the expression from sub-expressions
sub_expr1 = Variable("_a", latex_format = r"{_{-}a}")
sub_expr2 = IndexedVar(A, one)
sub_expr3 = IndexedVar(A, sub_expr1)
sub_expr4 = Add(m, one)
expr = ExprTuple(Forall(instance_param_or_params = [sub_expr2], instance_expr = InSet(sub_expr2, Boolean), domain = Boolean), Forall(instance_param_or_params = [m], instance_expr = Forall(instance_param_or_params = [ExprRange(sub_expr1, sub_expr3, one, Add(m, two))], instance_expr = InSet(Or(ExprRange(sub_expr1, sub_expr3, one, sub_expr4)), Boolean), condition = ExprRange(sub_expr1, InSet(sub_expr3, Boolean), one, sub_expr4)), domain = NaturalPos, condition = Forall(instance_param_or_params = [A_1_to_m], instance_expr = InSet(Or(A_1_to_m), Boolean), domain = Boolean)))
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(\forall_{A_{1} \in \mathbb{B}}~\left(A_{1} \in \mathbb{B}\right), \forall_{m \in \mathbb{N}^+~|~\forall_{A_{1}, A_{2}, \ldots, A_{m} \in \mathbb{B}}~\left(\left(A_{1} \lor  A_{2} \lor  \ldots \lor  A_{m}\right) \in \mathbb{B}\right)}~\left[\forall_{A_{1}, A_{2}, \ldots, A_{m + 2}~|~\left(A_{1} \in \mathbb{B}\right), \left(A_{2} \in \mathbb{B}\right), \ldots, \left(A_{m + 1} \in \mathbb{B}\right)}~\left(\left(A_{1} \lor  A_{2} \lor  \ldots \lor  A_{m + 1}\right) \in \mathbb{B}\right)\right]\right)
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
wrap_positionsposition(s) at which wrapping is to occur; 'n' is after the nth comma.()()('with_wrapping_at',)
justificationif any wrap positions are set, justify to the 'left', 'center', or 'right'leftleft('with_justification',)
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0ExprTuple1, 2
1Operationoperator: 25
operand: 5
2Operationoperator: 25
operand: 6
3ExprTuple5
4ExprTuple6
5Lambdaparameter: 17
body: 8
6Lambdaparameter: 59
body: 10
7ExprTuple17
8Conditionalvalue: 11
condition: 11
9ExprTuple59
10Conditionalvalue: 12
condition: 13
11Operationoperator: 60
operands: 14
12Operationoperator: 25
operand: 18
13Operationoperator: 44
operands: 16
14ExprTuple17, 63
15ExprTuple18
16ExprTuple19, 20
17IndexedVarvariable: 64
index: 58
18Lambdaparameters: 22
body: 23
19Operationoperator: 60
operands: 24
20Operationoperator: 25
operand: 31
21ExprTuple58
22ExprTuple27
23Conditionalvalue: 28
condition: 29
24ExprTuple59, 30
25Literal
26ExprTuple31
27ExprRangelambda_map: 57
start_index: 58
end_index: 32
28Operationoperator: 60
operands: 33
29Operationoperator: 44
operands: 34
30Literal
31Lambdaparameters: 51
body: 35
32Operationoperator: 53
operands: 36
33ExprTuple37, 63
34ExprTuple38
35Conditionalvalue: 39
condition: 40
36ExprTuple59, 41
37Operationoperator: 50
operands: 42
38ExprRangelambda_map: 52
start_index: 58
end_index: 49
39Operationoperator: 60
operands: 43
40Operationoperator: 44
operands: 45
41Literal
42ExprTuple46
43ExprTuple47, 63
44Literal
45ExprTuple48
46ExprRangelambda_map: 57
start_index: 58
end_index: 49
47Operationoperator: 50
operands: 51
48ExprRangelambda_map: 52
start_index: 58
end_index: 59
49Operationoperator: 53
operands: 54
50Literal
51ExprTuple55
52Lambdaparameter: 66
body: 56
53Literal
54ExprTuple59, 58
55ExprRangelambda_map: 57
start_index: 58
end_index: 59
56Operationoperator: 60
operands: 61
57Lambdaparameter: 66
body: 62
58Literal
59Variable
60Literal
61ExprTuple62, 63
62IndexedVarvariable: 64
index: 66
63Literal
64Variable
65ExprTuple66
66Variable