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, m, n
from proveit.core_expr_types import A_1_to_m, C_1_to_n
from proveit.logic import And, Boolean, Forall, InSet, Or
from proveit.numbers import Natural
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda([m, n], Conditional(Forall(instance_param_or_params = [A_1_to_m, B, C_1_to_n], instance_expr = Or(A_1_to_m, B, C_1_to_n), domain = Boolean, condition = B), And(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(m, n\right) \mapsto \left\{\forall_{A_{1}, A_{2}, \ldots, A_{m}, B, C_{1}, C_{2}, \ldots, C_{n} \in \mathbb{B}~|~B}~\left(A_{1} \lor  A_{2} \lor  \ldots \lor  A_{m} \lor B\lor C_{1} \lor  C_{2} \lor  \ldots \lor  C_{n}\right) \textrm{ if } 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
2ExprTuple30, 34
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 9
5Operationoperator: 20
operands: 8
6Literal
7ExprTuple9
8ExprTuple10, 11
9Lambdaparameters: 19
body: 12
10Operationoperator: 39
operands: 13
11Operationoperator: 39
operands: 14
12Conditionalvalue: 15
condition: 16
13ExprTuple30, 17
14ExprTuple34, 17
15Operationoperator: 18
operands: 19
16Operationoperator: 20
operands: 21
17Literal
18Literal
19ExprTuple22, 36, 23
20Literal
21ExprTuple24, 25, 26, 36
22ExprRangelambda_map: 27
start_index: 33
end_index: 30
23ExprRangelambda_map: 28
start_index: 33
end_index: 34
24ExprRangelambda_map: 29
start_index: 33
end_index: 30
25Operationoperator: 39
operands: 31
26ExprRangelambda_map: 32
start_index: 33
end_index: 34
27Lambdaparameter: 47
body: 41
28Lambdaparameter: 47
body: 42
29Lambdaparameter: 47
body: 35
30Variable
31ExprTuple36, 43
32Lambdaparameter: 47
body: 37
33Literal
34Variable
35Operationoperator: 39
operands: 38
36Variable
37Operationoperator: 39
operands: 40
38ExprTuple41, 43
39Literal
40ExprTuple42, 43
41IndexedVarvariable: 44
index: 47
42IndexedVarvariable: 45
index: 47
43Literal
44Variable
45Variable
46ExprTuple47
47Variable