logo

Expression of type ExprTuple

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, ExprTuple, Lambda, P, Q, n
from proveit.logic import Forall, Implies, InSet, SubsetEq
from proveit.logic.booleans.quantification import general_exists_in_A_Px_st_Qx, general_exists_in_B_Py_st_Qy
from proveit.numbers import NaturalPos
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda(n, Conditional(Forall(instance_param_or_params = [P, Q, A, B], instance_expr = Implies(general_exists_in_A_Px_st_Qx, general_exists_in_B_Py_st_Qy).with_wrapping_at(2), condition = SubsetEq(A, B)), InSet(n, NaturalPos))))
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(n \mapsto \left\{\forall_{P, Q, A, B~|~A \subseteq B}~\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}\right) \textrm{ if } n \in \mathbb{N}^+\right..\right)
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0ExprTuple1
1Lambdaparameter: 55
body: 3
2ExprTuple55
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 9
5Operationoperator: 51
operands: 8
6Literal
7ExprTuple9
8ExprTuple55, 10
9Lambdaparameters: 11
body: 12
10Literal
11ExprTuple33, 43, 56, 58
12Conditionalvalue: 13
condition: 14
13Operationoperator: 15
operands: 16
14Operationoperator: 17
operands: 18
15Literal
16ExprTuple19, 20
17Literal
18ExprTuple56, 58
19Operationoperator: 22
operand: 24
20Operationoperator: 22
operand: 25
21ExprTuple24
22Literal
23ExprTuple25
24Lambdaparameters: 41
body: 26
25Lambdaparameters: 44
body: 27
26Conditionalvalue: 28
condition: 29
27Conditionalvalue: 30
condition: 31
28Operationoperator: 33
operands: 41
29Operationoperator: 34
operands: 32
30Operationoperator: 33
operands: 44
31Operationoperator: 34
operands: 35
32ExprTuple36, 37
33Variable
34Literal
35ExprTuple38, 39
36ExprRangelambda_map: 40
start_index: 54
end_index: 55
37Operationoperator: 43
operands: 41
38ExprRangelambda_map: 42
start_index: 54
end_index: 55
39Operationoperator: 43
operands: 44
40Lambdaparameter: 63
body: 45
41ExprTuple46
42Lambdaparameter: 63
body: 47
43Variable
44ExprTuple48
45Operationoperator: 51
operands: 49
46ExprRangelambda_map: 50
start_index: 54
end_index: 55
47Operationoperator: 51
operands: 52
48ExprRangelambda_map: 53
start_index: 54
end_index: 55
49ExprTuple57, 56
50Lambdaparameter: 63
body: 57
51Literal
52ExprTuple59, 58
53Lambdaparameter: 63
body: 59
54Literal
55Variable
56Variable
57IndexedVarvariable: 60
index: 63
58Variable
59IndexedVarvariable: 61
index: 63
60Variable
61Variable
62ExprTuple63
63Variable