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, c, 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, c], Implies(And(Equals(x, a), Equals(y, b)), Implies(Equals(fab, c), Equals(fxy, c))))
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, c\right) \mapsto \left(\left(\left(x = a\right) \land \left(y = b\right)\right) \Rightarrow \left(\left(f\left(a, b\right) = c\right) \Rightarrow \left(f\left(x, y\right) = c\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
1ExprTuple23, 27, 28, 25, 26, 21
2Operationoperator: 8
operands: 3
3ExprTuple4, 5
4Operationoperator: 6
operands: 7
5Operationoperator: 8
operands: 9
6Literal
7ExprTuple10, 11
8Literal
9ExprTuple12, 13
10Operationoperator: 17
operands: 14
11Operationoperator: 17
operands: 15
12Operationoperator: 17
operands: 16
13Operationoperator: 17
operands: 18
14ExprTuple27, 25
15ExprTuple28, 26
16ExprTuple19, 21
17Literal
18ExprTuple20, 21
19Operationoperator: 23
operands: 22
20Operationoperator: 23
operands: 24
21Variable
22ExprTuple25, 26
23Variable
24ExprTuple27, 28
25Variable
26Variable
27Variable
28Variable