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 Conditional, ExprTuple, Lambda, S, x
from proveit.logic import And, Forall, Implies, InSet, SetEquiv, SubsetEq
from proveit.numbers import Add, Natural, one, zero
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda(S, Conditional(Implies(And(InSet(zero, S), Forall(instance_param_or_params = [x], instance_expr = InSet(Add(x, one), S), domain = S)), SetEquiv(S, Natural)), SubsetEq(S, 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(S \mapsto \left\{\left(\left(0 \in S\right) \land \left[\forall_{x \in S}~\left(\left(x + 1\right) \in S\right)\right]\right) \Rightarrow \left(S \cong \mathbb{N}\right) \textrm{ if } S \subseteq \mathbb{N}\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: 31
body: 3
2ExprTuple31
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operands: 7
5Operationoperator: 8
operands: 14
6Literal
7ExprTuple9, 10
8Literal
9Operationoperator: 11
operands: 12
10Operationoperator: 13
operands: 14
11Literal
12ExprTuple15, 16
13Literal
14ExprTuple31, 17
15Operationoperator: 28
operands: 18
16Operationoperator: 19
operand: 22
17Literal
18ExprTuple21, 31
19Literal
20ExprTuple22
21Literal
22Lambdaparameter: 34
body: 24
23ExprTuple34
24Conditionalvalue: 25
condition: 26
25Operationoperator: 28
operands: 27
26Operationoperator: 28
operands: 29
27ExprTuple30, 31
28Literal
29ExprTuple34, 31
30Operationoperator: 32
operands: 33
31Variable
32Literal
33ExprTuple34, 35
34Variable
35Literal