logo

Expression of type Lambda

from the theory of proveit.logic.booleans.quantification.existence

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, Conditional, Lambda, P, Q
from proveit.logic import Implies, SubsetEq
from proveit.logic.booleans.quantification import general_exists_in_A_Px_st_Qx, general_exists_in_B_Py_st_Qy
In [2]:
# build up the expression from sub-expressions
expr = Lambda([P, Q, A, B], Conditional(Implies(general_exists_in_A_Px_st_Qx, general_exists_in_B_Py_st_Qy).with_wrapping_at(2), SubsetEq(A, B)))
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(P, Q, A, B\right) \mapsto \left\{\begin{array}{c} \begin{array}{l} \left[\exists_{x_{1}, x_{2}, \ldots, x_{n} \in A~|~Q\left(x_{1}, x_{2}, \ldots, x_{n}\right)}~P\left(x_{1}, x_{2}, \ldots, x_{n}\right)\right] \Rightarrow  \\ \left[\exists_{y_{1}, y_{2}, \ldots, y_{n} \in B~|~Q\left(y_{1}, y_{2}, \ldots, y_{n}\right)}~P\left(y_{1}, y_{2}, \ldots, y_{n}\right)\right] \end{array} \end{array} \textrm{ if } A \subseteq B\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
1ExprTuple23, 33, 46, 48
2Conditionalvalue: 3
condition: 4
3Operationoperator: 5
operands: 6
4Operationoperator: 7
operands: 8
5Literal
6ExprTuple9, 10
7Literal
8ExprTuple46, 48
9Operationoperator: 12
operand: 14
10Operationoperator: 12
operand: 15
11ExprTuple14
12Literal
13ExprTuple15
14Lambdaparameters: 31
body: 16
15Lambdaparameters: 34
body: 17
16Conditionalvalue: 18
condition: 19
17Conditionalvalue: 20
condition: 21
18Operationoperator: 23
operands: 31
19Operationoperator: 24
operands: 22
20Operationoperator: 23
operands: 34
21Operationoperator: 24
operands: 25
22ExprTuple26, 27
23Variable
24Literal
25ExprTuple28, 29
26ExprRangelambda_map: 30
start_index: 44
end_index: 45
27Operationoperator: 33
operands: 31
28ExprRangelambda_map: 32
start_index: 44
end_index: 45
29Operationoperator: 33
operands: 34
30Lambdaparameter: 53
body: 35
31ExprTuple36
32Lambdaparameter: 53
body: 37
33Variable
34ExprTuple38
35Operationoperator: 41
operands: 39
36ExprRangelambda_map: 40
start_index: 44
end_index: 45
37Operationoperator: 41
operands: 42
38ExprRangelambda_map: 43
start_index: 44
end_index: 45
39ExprTuple47, 46
40Lambdaparameter: 53
body: 47
41Literal
42ExprTuple49, 48
43Lambdaparameter: 53
body: 49
44Literal
45Variable
46Variable
47IndexedVarvariable: 50
index: 53
48Variable
49IndexedVarvariable: 51
index: 53
50Variable
51Variable
52ExprTuple53
53Variable