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, C, Conditional, ExprRange, ExprTuple, IndexedVar, Lambda, Variable, m
from proveit.core_expr_types import A_1_to_m
from proveit.logic import Boolean, Forall, Implies, InSet, Or
from proveit.numbers import Natural, one
In [2]:
# build up the expression from sub-expressions
sub_expr1 = Variable("_a", latex_format = r"{_{-}a}")
expr = ExprTuple(Lambda(m, Conditional(Forall(instance_param_or_params = [A_1_to_m], instance_expr = Forall(instance_param_or_params = [C], instance_expr = C, condition = ExprRange(sub_expr1, Implies(IndexedVar(A, sub_expr1), C), one, m)), domain = Boolean, condition = Or(A_1_to_m)), InSet(m, 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(m \mapsto \left\{\forall_{A_{1}, A_{2}, \ldots, A_{m} \in \mathbb{B}~|~A_{1} \lor  A_{2} \lor  \ldots \lor  A_{m}}~\left[\forall_{C~|~\left(A_{1} \Rightarrow C\right), \left(A_{2} \Rightarrow C\right), \ldots, \left(A_{m} \Rightarrow C\right)}~C\right] \textrm{ if } m \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
1Lambdaparameter: 36
body: 3
2ExprTuple36
3Conditionalvalue: 4
condition: 5
4Operationoperator: 13
operand: 8
5Operationoperator: 29
operands: 7
6ExprTuple8
7ExprTuple36, 9
8Lambdaparameters: 23
body: 10
9Literal
10Conditionalvalue: 11
condition: 12
11Operationoperator: 13
operand: 16
12Operationoperator: 27
operands: 15
13Literal
14ExprTuple16
15ExprTuple17, 18
16Lambdaparameter: 41
body: 20
17ExprRangelambda_map: 21
start_index: 35
end_index: 36
18Operationoperator: 22
operands: 23
19ExprTuple41
20Conditionalvalue: 41
condition: 24
21Lambdaparameter: 44
body: 25
22Literal
23ExprTuple26
24Operationoperator: 27
operands: 28
25Operationoperator: 29
operands: 30
26ExprRangelambda_map: 31
start_index: 35
end_index: 36
27Literal
28ExprTuple32
29Literal
30ExprTuple40, 33
31Lambdaparameter: 44
body: 40
32ExprRangelambda_map: 34
start_index: 35
end_index: 36
33Literal
34Lambdaparameter: 44
body: 37
35Literal
36Variable
37Operationoperator: 38
operands: 39
38Literal
39ExprTuple40, 41
40IndexedVarvariable: 42
index: 44
41Variable
42Variable
43ExprTuple44
44Variable