# 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.
# import Expression classes needed to build the expression
from proveit import A, 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 = Forall(instance_param_or_params = [f, A], instance_expr = 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())

\forall_{f, A}~\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()

namedescriptiondefaultcurrent valuerelated methods
with_wrappingIf 'True', wrap the Expression after the parametersNoneNone/False('with_wrapping',)
condition_wrappingWrap 'before' or 'after' the condition (or None).NoneNone/False('with_wrap_after_condition', 'with_wrap_before_condition')
wrap_paramsIf 'True', wraps every two parameters AND wraps the Expression after the parametersNoneNone/False('with_params',)
justificationjustify to the 'left', 'center', or 'right' in the array cellscentercenter('with_justification',)
In [6]:
# display the expression information
stored_expr.expr_info()

core typesub-expressionsexpression
0Operationoperator: 8
operand: 2
1ExprTuple2
2Lambdaparameters: 23
body: 3
3Operationoperator: 4
operands: 5
4Literal
5ExprTuple6, 7
6Operationoperator: 8
operand: 11
7Operationoperator: 33
operands: 10
8Literal
9ExprTuple11
10ExprTuple30, 12
11Lambdaparameters: 36
body: 13
12Operationoperator: 14
operands: 15
13Conditionalvalue: 16
condition: 17
14Literal
15ExprTuple37, 18
16Operationoperator: 35
operands: 19
17Operationoperator: 20
operands: 21
18Operationoperator: 22
operands: 23
19ExprTuple24, 25
20Literal
21ExprTuple26, 27, 28
22Literal
23ExprTuple30, 37
24Operationoperator: 30
operand: 38
25Operationoperator: 30
operand: 39
26Operationoperator: 33
operands: 32
27Operationoperator: 33
operands: 34
28Operationoperator: 35
operands: 36
29ExprTuple38
30Variable
31ExprTuple39
32ExprTuple38, 37
33Literal
34ExprTuple39, 37
35Literal
36ExprTuple38, 39
37Variable
38Variable
39Variable