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 Conditional, ExprTuple, Lambda, P, Q, n
from proveit.logic import Forall, InSet, Not
from proveit.logic.booleans.quantification import general_exists_Px_st_Qx, general_forall__Py_not_T__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], instance_expr = general_exists_Px_st_Qx, condition = Not(general_forall__Py_not_T__st_Qy)), 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~|~\lnot \left[\forall_{y_{1}, y_{2}, \ldots, y_{n}~|~Q\left(y_{1}, y_{2}, \ldots, y_{n}\right)}~\left(P\left(y_{1}, y_{2}, \ldots, y_{n}\right) \neq \top\right)\right]}~\left[\exists_{x_{1}, x_{2}, \ldots, x_{n}~|~Q\left(x_{1}, x_{2}, \ldots, x_{n}\right)}~P\left(x_{1}, x_{2}, \ldots, x_{n}\right)\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: 45
body: 3
2ExprTuple45
3Conditionalvalue: 4
condition: 5
4Operationoperator: 22
operand: 9
5Operationoperator: 7
operands: 8
6ExprTuple9
7Literal
8ExprTuple45, 10
9Lambdaparameters: 11
body: 12
10Literal
11ExprTuple40, 35
12Conditionalvalue: 13
condition: 14
13Operationoperator: 15
operand: 19
14Operationoperator: 17
operand: 20
15Literal
16ExprTuple19
17Literal
18ExprTuple20
19Lambdaparameters: 27
body: 21
20Operationoperator: 22
operand: 26
21Conditionalvalue: 24
condition: 25
22Literal
23ExprTuple26
24Operationoperator: 40
operands: 27
25Operationoperator: 35
operands: 27
26Lambdaparameters: 41
body: 28
27ExprTuple29
28Conditionalvalue: 30
condition: 31
29ExprRangelambda_map: 32
start_index: 44
end_index: 45
30Operationoperator: 33
operands: 34
31Operationoperator: 35
operands: 41
32Lambdaparameter: 49
body: 36
33Literal
34ExprTuple37, 38
35Variable
36IndexedVarvariable: 39
index: 49
37Operationoperator: 40
operands: 41
38Literal
39Variable
40Variable
41ExprTuple42
42ExprRangelambda_map: 43
start_index: 44
end_index: 45
43Lambdaparameter: 49
body: 46
44Literal
45Variable
46IndexedVarvariable: 47
index: 49
47Variable
48ExprTuple49
49Variable