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