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 A, Conditional, ExprRange, ExprTuple, Lambda, Variable, i, j
from proveit.logic import And, Forall, InSet
from proveit.numbers import Add, Integer, LessEq, one
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda([i, j], Conditional(Forall(instance_param_or_params = [A], instance_expr = And(ExprRange(Variable("_a", latex_format = r"{_{-}a}"), A, i, j)), conditions = [A, LessEq(i, Add(j, one))]), And(InSet(i, Integer), InSet(j, Integer)))))
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(i, j\right) \mapsto \left\{\forall_{A~|~A, i \leq \left(j + 1\right)}~\left(A \land  A \land  ..\left(j - i - 2\right) \times.. \land  A\right) \textrm{ if } i \in \mathbb{Z} ,  j \in \mathbb{Z}\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, 35
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 9
5Operationoperator: 21
operands: 8
6Literal
7ExprTuple9
8ExprTuple10, 11
9Lambdaparameter: 29
body: 13
10Operationoperator: 15
operands: 14
11Operationoperator: 15
operands: 16
12ExprTuple29
13Conditionalvalue: 17
condition: 18
14ExprTuple30, 19
15Literal
16ExprTuple35, 19
17Operationoperator: 21
operands: 20
18Operationoperator: 21
operands: 22
19Literal
20ExprTuple23
21Literal
22ExprTuple29, 24
23ExprRangelambda_map: 25
start_index: 30
end_index: 35
24Operationoperator: 26
operands: 27
25Lambdaparameter: 32
body: 29
26Literal
27ExprTuple30, 31
28ExprTuple32
29Variable
30Variable
31Operationoperator: 33
operands: 34
32Variable
33Literal
34ExprTuple35, 36
35Variable
36Literal