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, Forall, Implies, InSet

In [2]:
# build up the expression from sub-expressions
expr = Forall(instance_param_or_params = [f, g, A, B, C], instance_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())

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

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: 1
operand: 3
1Literal
2ExprTuple3
3Lambdaparameters: 4
body: 5
4ExprTuple36, 28, 35, 32, 33
5Operationoperator: 6
operands: 7
6Literal
7ExprTuple8, 9
8Operationoperator: 10
operands: 11
9Operationoperator: 30
operands: 12
10Literal
11ExprTuple13, 14
12ExprTuple15, 16
13Operationoperator: 30
operands: 17
14Operationoperator: 30
operands: 18
15Lambdaparameter: 38
body: 19
16Operationoperator: 26
operands: 20
17ExprTuple36, 21
18ExprTuple28, 22
19Conditionalvalue: 23
condition: 24
20ExprTuple35, 33
21Operationoperator: 26
operands: 25
22Operationoperator: 26
operands: 27
23Operationoperator: 28
operand: 34
24Operationoperator: 30
operands: 31
25ExprTuple35, 32
26Literal
27ExprTuple32, 33
28Variable
29ExprTuple34
30Literal
31ExprTuple38, 35
32Variable
33Variable
34Operationoperator: 36
operand: 38
35Variable
36Variable
37ExprTuple38
38Variable