logo

Expression of type Lambda

from the theory of proveit.logic.equality

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 Lambda, a, b, f, fab, fxy, x, y
from proveit.logic import And, Equals, Implies
In [2]:
# build up the expression from sub-expressions
expr = Lambda([f, x, y, a, b], Implies(And(Equals(x, a), Equals(y, b)), Equals(fxy, fab)))
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, y, a, b\right) \mapsto \left(\left(\left(x = a\right) \land \left(y = b\right)\right) \Rightarrow \left(f\left(x, y\right) = f\left(a, b\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
1ExprTuple18, 20, 21, 22, 23
2Operationoperator: 3
operands: 4
3Literal
4ExprTuple5, 6
5Operationoperator: 7
operands: 8
6Operationoperator: 15
operands: 9
7Literal
8ExprTuple10, 11
9ExprTuple12, 13
10Operationoperator: 15
operands: 14
11Operationoperator: 15
operands: 16
12Operationoperator: 18
operands: 17
13Operationoperator: 18
operands: 19
14ExprTuple20, 22
15Literal
16ExprTuple21, 23
17ExprTuple20, 21
18Variable
19ExprTuple22, 23
20Variable
21Variable
22Variable
23Variable