# from the theory of proveit.core_expr_types.tuples¶

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.
# import Expression classes needed to build the expression
from proveit import b, d, i
from proveit.core_expr_types import a_1_to_i, c_1_to_i
from proveit.logic import And, Equals, Forall
from proveit.numbers import Natural

In [2]:
# build up the expression from sub-expressions
expr = Forall(instance_param_or_params = [i], instance_expr = Forall(instance_param_or_params = [a_1_to_i, b, c_1_to_i, d], instance_expr = Equals(Equals([a_1_to_i, b], [c_1_to_i, d]), And(Equals([a_1_to_i], [c_1_to_i]), Equals(b, d))).with_wrapping_at(2)), domain = 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())

\forall_{i \in \mathbb{N}}~\left[\forall_{a_{1}, a_{2}, \ldots, a_{i}, b, c_{1}, c_{2}, \ldots, c_{i}, d}~\left(\begin{array}{c} \begin{array}{l} \left(\left(a_{1}, a_{2}, \ldots, a_{i}, b\right) = \left(c_{1}, c_{2}, \ldots, c_{i}, d\right)\right) =  \\ \left(\left(\left(a_{1}, a_{2}, \ldots, a_{i}\right) = \left(c_{1}, c_{2}, \ldots, c_{i}\right)\right) \land \left(b = d\right)\right) \end{array} \end{array}\right)\right]

In [5]:
stored_expr.style_options()

namedescriptiondefaultcurrent valuerelated methods
with_wrappingIf 'True', wrap the Expression after the parametersNoneNone/False('with_wrapping',)
condition_wrappingWrap 'before' or 'after' the condition (or None).NoneNone/False('with_wrap_after_condition', 'with_wrap_before_condition')
wrap_paramsIf 'True', wraps every two parameters AND wraps the Expression after the parametersNoneNone/False('with_params',)
justificationjustify to the 'left', 'center', or 'right' in the array cellscentercenter('with_justification',)
In [6]:
# display the expression information
stored_expr.expr_info()

core typesub-expressionsexpression
0Operationoperator: 7
operand: 2
1ExprTuple2
2Lambdaparameter: 37
body: 4
3ExprTuple37
4Conditionalvalue: 5
condition: 6
5Operationoperator: 7
operand: 11
6Operationoperator: 9
operands: 10
7Literal
8ExprTuple11
9Literal
10ExprTuple37, 12
11Lambdaparameters: 13
body: 14
12Literal
13ExprTuple32, 30, 33, 31
14Operationoperator: 26
operands: 15
15ExprTuple16, 17
16Operationoperator: 26
operands: 18
17Operationoperator: 19
operands: 20
18ExprTuple21, 22
19Literal
20ExprTuple23, 24
21ExprTuple32, 30
22ExprTuple33, 31
23Operationoperator: 26
operands: 25
24Operationoperator: 26
operands: 27
25ExprTuple28, 29
26Literal
27ExprTuple30, 31
28ExprTuple32
29ExprTuple33
30Variable
31Variable
32ExprRangelambda_map: 34
start_index: 36
end_index: 37
33ExprRangelambda_map: 35
start_index: 36
end_index: 37
34Lambdaparameter: 43
body: 38
35Lambdaparameter: 43
body: 39
36Literal
37Variable
38IndexedVarvariable: 40
index: 43
39IndexedVarvariable: 41
index: 43
40Variable
41Variable
42ExprTuple43
43Variable