logo

Expression of type Lambda

from the theory of proveit.logic.sets.functions.bijections

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 A, Lambda, f, fx, fy, x, y
from proveit.logic import Bijections, Forall, Image, Implies, InSet, NotEquals
In [2]:
# build up the expression from sub-expressions
expr = Lambda([f, A], Implies(Forall(instance_param_or_params = [x, y], instance_expr = NotEquals(fx, fy), domain = A, condition = NotEquals(x, y)), InSet(f, Bijections(A, Image(f, A)))))
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, A\right) \mapsto \left(\left[\forall_{x, y \in A~|~x \neq y}~\left(f\left(x\right) \neq f\left(y\right)\right)\right] \Rightarrow \left(f \in \left[A \xrightarrow[\text{onto}]{\text{1-to-1}} f^{\rightarrow}(A)\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: 21
body: 1
1Operationoperator: 2
operands: 3
2Literal
3ExprTuple4, 5
4Operationoperator: 6
operand: 9
5Operationoperator: 31
operands: 8
6Literal
7ExprTuple9
8ExprTuple28, 10
9Lambdaparameters: 34
body: 11
10Operationoperator: 12
operands: 13
11Conditionalvalue: 14
condition: 15
12Literal
13ExprTuple35, 16
14Operationoperator: 33
operands: 17
15Operationoperator: 18
operands: 19
16Operationoperator: 20
operands: 21
17ExprTuple22, 23
18Literal
19ExprTuple24, 25, 26
20Literal
21ExprTuple28, 35
22Operationoperator: 28
operand: 36
23Operationoperator: 28
operand: 37
24Operationoperator: 31
operands: 30
25Operationoperator: 31
operands: 32
26Operationoperator: 33
operands: 34
27ExprTuple36
28Variable
29ExprTuple37
30ExprTuple36, 35
31Literal
32ExprTuple37, 35
33Literal
34ExprTuple36, 37
35Variable
36Variable
37Variable