logo

Expression of type Lambda

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, 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 = 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())
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..
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Lambdaparameter: 30
body: 2
1ExprTuple30
2Conditionalvalue: 3
condition: 4
3Operationoperator: 5
operands: 6
4Operationoperator: 7
operands: 13
5Literal
6ExprTuple8, 9
7Literal
8Operationoperator: 10
operands: 11
9Operationoperator: 12
operands: 13
10Literal
11ExprTuple14, 15
12Literal
13ExprTuple30, 16
14Operationoperator: 27
operands: 17
15Operationoperator: 18
operand: 21
16Literal
17ExprTuple20, 30
18Literal
19ExprTuple21
20Literal
21Lambdaparameter: 33
body: 23
22ExprTuple33
23Conditionalvalue: 24
condition: 25
24Operationoperator: 27
operands: 26
25Operationoperator: 27
operands: 28
26ExprTuple29, 30
27Literal
28ExprTuple33, 30
29Operationoperator: 31
operands: 32
30Variable
31Literal
32ExprTuple33, 34
33Variable
34Literal