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 ExprRange, ExprTuple, Function, Lambda, P, Pk, Variable, i, j, k
from proveit.logic import And, Forall, Implies
from proveit.numbers import Interval
In [2]:
# build up the expression from sub-expressions
sub_expr1 = Variable("_a", latex_format = r"{_{-}a}")
expr = ExprTuple(Lambda(P, Implies(And(ExprRange(sub_expr1, Function(P, [sub_expr1]), i, j)), Forall(instance_param_or_params = [k], instance_expr = Pk, domain = Interval(i, j)))))
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(P \mapsto \left(\left(P\left(i\right) \land  P\left(i + 1\right) \land  \ldots \land  P\left(j\right)\right) \Rightarrow \left[\forall_{k \in \{i~\ldotp \ldotp~j\}}~P\left(k\right)\right]\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: 20
body: 3
2ExprTuple20
3Operationoperator: 4
operands: 5
4Literal
5ExprTuple6, 7
6Operationoperator: 8
operands: 9
7Operationoperator: 10
operand: 13
8Literal
9ExprTuple12
10Literal
11ExprTuple13
12ExprRangelambda_map: 14
start_index: 29
end_index: 30
13Lambdaparameter: 25
body: 15
14Lambdaparameter: 24
body: 16
15Conditionalvalue: 17
condition: 18
16Operationoperator: 20
operand: 24
17Operationoperator: 20
operand: 25
18Operationoperator: 22
operands: 23
19ExprTuple24
20Variable
21ExprTuple25
22Literal
23ExprTuple25, 26
24Variable
25Variable
26Operationoperator: 27
operands: 28
27Literal
28ExprTuple29, 30
29Variable
30Variable