logo

Expression of type ExprTuple

from the theory of proveit.numbers.number_sets.natural_numbers

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 ExprTuple, Lambda, P, m, n
from proveit.logic import And, Forall, Implies
from proveit.numbers import NaturalPos, P_mAddOne, Pm, Pn, Pone
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda(P, Implies(And(Pone, Forall(instance_param_or_params = [m], instance_expr = P_mAddOne, domain = NaturalPos, condition = Pm)), Forall(instance_param_or_params = [n], instance_expr = Pn, domain = NaturalPos))))
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(1\right) \land \left[\forall_{m \in \mathbb{N}^+~|~P\left(m\right)}~P\left(m + 1\right)\right]\right) \Rightarrow \left[\forall_{n \in \mathbb{N}^+}~P\left(n\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: 36
body: 3
2ExprTuple36
3Operationoperator: 4
operands: 5
4Literal
5ExprTuple6, 7
6Operationoperator: 27
operands: 8
7Operationoperator: 14
operand: 12
8ExprTuple10, 11
9ExprTuple12
10Operationoperator: 36
operand: 38
11Operationoperator: 14
operand: 17
12Lambdaparameter: 25
body: 16
13ExprTuple38
14Literal
15ExprTuple17
16Conditionalvalue: 18
condition: 19
17Lambdaparameter: 40
body: 20
18Operationoperator: 36
operand: 25
19Operationoperator: 34
operands: 22
20Conditionalvalue: 23
condition: 24
21ExprTuple25
22ExprTuple25, 39
23Operationoperator: 36
operand: 29
24Operationoperator: 27
operands: 28
25Variable
26ExprTuple29
27Literal
28ExprTuple30, 31
29Operationoperator: 32
operands: 33
30Operationoperator: 34
operands: 35
31Operationoperator: 36
operand: 40
32Literal
33ExprTuple40, 38
34Literal
35ExprTuple40, 39
36Variable
37ExprTuple40
38Literal
39Literal
40Variable