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

In [2]:
# build up the expression from sub-expressions
expr = 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())

\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}

In [5]:
stored_expr.style_options()

namedescriptiondefaultcurrent valuerelated methods
operation'infix' or 'function' style formattinginfixinfix
wrap_positionsposition(s) at which wrapping is to occur; '2 n - 1' is after the nth operand, '2 n' is after the nth operation.()(1)('with_wrapping_at', 'with_wrap_before_operator', 'with_wrap_after_operator', 'without_wrapping', 'wrap_positions')
justificationif any wrap positions are set, justify to the 'left', 'center', or 'right'centercenter('with_justification',)
directionDirection of the relation (normal or reversed)normalnormal('with_direction_reversed', 'is_reversed')
In [6]:
# display the expression information
stored_expr.expr_info()

core typesub-expressionsexpression
0Operationoperator: 1
operands: 2
1Literal
2ExprTuple3, 4
3Operationoperator: 5
operands: 6
4Operationoperator: 25
operands: 7
5Literal
6ExprTuple8, 9
7ExprTuple10, 11
8Operationoperator: 25
operands: 12
9Operationoperator: 25
operands: 13
10Lambdaparameter: 33
body: 14
11Operationoperator: 21
operands: 15
12ExprTuple31, 16
13ExprTuple23, 17
14Conditionalvalue: 18
condition: 19
15ExprTuple30, 28
16Operationoperator: 21
operands: 20
17Operationoperator: 21
operands: 22
18Operationoperator: 23
operand: 29
19Operationoperator: 25
operands: 26
20ExprTuple30, 27
21Literal
22ExprTuple27, 28
23Variable
24ExprTuple29
25Literal
26ExprTuple33, 30
27Variable
28Variable
29Operationoperator: 31
operand: 33
30Variable
31Variable
32ExprTuple33
33Variable