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
from proveit.logic import Not
from proveit.logic.booleans.quantification import general_exists_Px_st_Qx, general_forall__Py_not_T__st_Qy
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda([P, Q], Conditional(general_exists_Px_st_Qx, Not(general_forall__Py_not_T__st_Qy))))
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(\left(P, Q\right) \mapsto \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) \textrm{ if } \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]\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
1Lambdaparameters: 2
body: 3
2ExprTuple31, 26
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 10
5Operationoperator: 8
operand: 11
6Literal
7ExprTuple10
8Literal
9ExprTuple11
10Lambdaparameters: 18
body: 12
11Operationoperator: 13
operand: 17
12Conditionalvalue: 15
condition: 16
13Literal
14ExprTuple17
15Operationoperator: 31
operands: 18
16Operationoperator: 26
operands: 18
17Lambdaparameters: 32
body: 19
18ExprTuple20
19Conditionalvalue: 21
condition: 22
20ExprRangelambda_map: 23
start_index: 35
end_index: 36
21Operationoperator: 24
operands: 25
22Operationoperator: 26
operands: 32
23Lambdaparameter: 40
body: 27
24Literal
25ExprTuple28, 29
26Variable
27IndexedVarvariable: 30
index: 40
28Operationoperator: 31
operands: 32
29Literal
30Variable
31Variable
32ExprTuple33
33ExprRangelambda_map: 34
start_index: 35
end_index: 36
34Lambdaparameter: 40
body: 37
35Literal
36Variable
37IndexedVarvariable: 38
index: 40
38Variable
39ExprTuple40
40Variable