logo

Expression of type Lambda

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

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 Lambda, P, Q, R
from proveit.logic import Implies
from proveit.logic.booleans.quantification import general_bundled_forall_Pxy_if_Qx, general_nested_forall_Pxy_if_Qx
In [2]:
# build up the expression from sub-expressions
expr = Lambda([P, Q, R], Implies(general_nested_forall_Pxy_if_Qx, general_bundled_forall_Pxy_if_Qx).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(P, Q, R\right) \mapsto \left(\begin{array}{c} \begin{array}{l} \left[\forall_{x_{1}, x_{2}, \ldots, x_{m}~|~Q\left(x_{1}, x_{2}, \ldots, x_{m}\right)}~\left[\forall_{y_{1}, y_{2}, \ldots, y_{n}~|~R\left(x_{1}, x_{2}, \ldots, x_{m},y_{1}, y_{2}, \ldots, y_{n}\right)}~P\left(x_{1}, x_{2}, \ldots, x_{m},y_{1}, y_{2}, \ldots, y_{n}\right)\right]\right] \\  \Rightarrow \left[\forall_{x_{1}, x_{2}, \ldots, x_{m}, y_{1}, y_{2}, \ldots, y_{n}~|~Q\left(x_{1}, x_{2}, \ldots, x_{m}\right), R\left(x_{1}, x_{2}, \ldots, x_{m},y_{1}, y_{2}, \ldots, y_{n}\right)}~P\left(x_{1}, x_{2}, \ldots, x_{m},y_{1}, y_{2}, \ldots, y_{n}\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
1ExprTuple27, 23, 28
2Operationoperator: 3
operands: 4
3Literal
4ExprTuple5, 6
5Operationoperator: 15
operand: 9
6Operationoperator: 15
operand: 10
7ExprTuple9
8ExprTuple10
9Lambdaparameters: 24
body: 11
10Lambdaparameters: 29
body: 12
11Conditionalvalue: 13
condition: 20
12Conditionalvalue: 25
condition: 14
13Operationoperator: 15
operand: 19
14Operationoperator: 17
operands: 18
15Literal
16ExprTuple19
17Literal
18ExprTuple20, 26
19Lambdaparameters: 21
body: 22
20Operationoperator: 23
operands: 24
21ExprTuple31
22Conditionalvalue: 25
condition: 26
23Variable
24ExprTuple30
25Operationoperator: 27
operands: 29
26Operationoperator: 28
operands: 29
27Variable
28Variable
29ExprTuple30, 31
30ExprRangelambda_map: 32
start_index: 35
end_index: 33
31ExprRangelambda_map: 34
start_index: 35
end_index: 36
32Lambdaparameter: 42
body: 37
33Variable
34Lambdaparameter: 42
body: 38
35Literal
36Variable
37IndexedVarvariable: 39
index: 42
38IndexedVarvariable: 40
index: 42
39Variable
40Variable
41ExprTuple42
42Variable