# 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, B, C, Conditional, ExprTuple, Function, Lambda, f, fx, g, x
from proveit.logic import And, Bijections, Implies, InSet

In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda([f, g, A, B, C], Implies(And(InSet(f, Bijections(A, B)), InSet(g, Bijections(B, C))), InSet(Lambda(x, Conditional(Function(g, [fx]), InSet(x, A))), Bijections(A, C))).with_wrapping_at(1)))

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(\left(f, g, A, B, C\right) \mapsto \left(\begin{array}{c} \begin{array}{l} \left(\left(f \in \left[A \xrightarrow[\text{onto}]{\text{1-to-1}} B\right]\right) \land \left(g \in \left[B \xrightarrow[\text{onto}]{\text{1-to-1}} C\right]\right)\right) \\  \Rightarrow \left(\left[x \mapsto \left\{g\left(f\left(x\right)\right) \textrm{ if } x \in A\right..\right] \in \left[A \xrightarrow[\text{onto}]{\text{1-to-1}} C\right]\right) \end{array} \end{array}\right)\right)

In [5]:
stored_expr.style_options()

no style options
In [6]:
# display the expression information
stored_expr.expr_info()

core typesub-expressionsexpression
0ExprTuple1
1Lambdaparameters: 2
body: 3
2ExprTuple34, 26, 33, 30, 31
3Operationoperator: 4
operands: 5
4Literal
5ExprTuple6, 7
6Operationoperator: 8
operands: 9
7Operationoperator: 28
operands: 10
8Literal
9ExprTuple11, 12
10ExprTuple13, 14
11Operationoperator: 28
operands: 15
12Operationoperator: 28
operands: 16
13Lambdaparameter: 36
body: 17
14Operationoperator: 24
operands: 18
15ExprTuple34, 19
16ExprTuple26, 20
17Conditionalvalue: 21
condition: 22
18ExprTuple33, 31
19Operationoperator: 24
operands: 23
20Operationoperator: 24
operands: 25
21Operationoperator: 26
operand: 32
22Operationoperator: 28
operands: 29
23ExprTuple33, 30
24Literal
25ExprTuple30, 31
26Variable
27ExprTuple32
28Literal
29ExprTuple36, 33
30Variable
31Variable
32Operationoperator: 34
operand: 36
33Variable
34Variable
35ExprTuple36
36Variable