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, 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 = 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(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)
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Lambdaparameters: 1
body: 2
1ExprTuple33, 25, 32, 29, 30
2Operationoperator: 3
operands: 4
3Literal
4ExprTuple5, 6
5Operationoperator: 7
operands: 8
6Operationoperator: 27
operands: 9
7Literal
8ExprTuple10, 11
9ExprTuple12, 13
10Operationoperator: 27
operands: 14
11Operationoperator: 27
operands: 15
12Lambdaparameter: 35
body: 16
13Operationoperator: 23
operands: 17
14ExprTuple33, 18
15ExprTuple25, 19
16Conditionalvalue: 20
condition: 21
17ExprTuple32, 30
18Operationoperator: 23
operands: 22
19Operationoperator: 23
operands: 24
20Operationoperator: 25
operand: 31
21Operationoperator: 27
operands: 28
22ExprTuple32, 29
23Literal
24ExprTuple29, 30
25Variable
26ExprTuple31
27Literal
28ExprTuple35, 32
29Variable
30Variable
31Operationoperator: 33
operand: 35
32Variable
33Variable
34ExprTuple35
35Variable