# 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 Lambda, f, i, x
from proveit.core_expr_types import Len, f_1_to_i, range_1_to_ip1
from proveit.logic import Equals, Forall
from proveit.numbers import Natural

In [2]:
# build up the expression from sub-expressions
expr = Lambda([f, x], Forall(instance_param_or_params = [i], instance_expr = Equals(Len(operands = [f_1_to_i, x]), Len(operands = [range_1_to_ip1])), 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())

\left(f, x\right) \mapsto \left[\forall_{i \in \mathbb{N}}~\left(|\left(f\left(1\right), f\left(2\right), \ldots, f\left(i\right), x\right)| = |\left(1, 2, \ldots, \left(i + 1\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
0Lambdaparameters: 1
body: 2
1ExprTuple29, 21
2Operationoperator: 3
operand: 5
3Literal
4ExprTuple5
5Lambdaparameter: 31
body: 7
6ExprTuple31
7Conditionalvalue: 8
condition: 9
8Operationoperator: 10
operands: 11
9Operationoperator: 12
operands: 13
10Literal
11ExprTuple14, 15
12Literal
13ExprTuple31, 16
14Operationoperator: 18
operands: 17
15Operationoperator: 18
operands: 19
16Literal
17ExprTuple20, 21
18Literal
19ExprTuple22
20ExprRangelambda_map: 23
start_index: 32
end_index: 31
21Variable
22ExprRangelambda_map: 24
start_index: 32
end_index: 25
23Lambdaparameter: 33
body: 26
24Lambdaparameter: 33
body: 33
25Operationoperator: 27
operands: 28
26Operationoperator: 29
operand: 33
27Literal
28ExprTuple31, 32
29Variable
30ExprTuple33
31Variable
32Literal
33Variable