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 ExprTuple, alpha, n
from proveit.core_expr_types import P__x_1_to_n, Q__x_1_to_n, x_1_to_n
from proveit.logic import And, Boolean, Forall, Implies, InSet
from proveit.logic.booleans.quantification import general_exists_Py_st_Qy
from proveit.numbers import NaturalPos
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(And(InSet(n, NaturalPos), InSet(alpha, Boolean)), And(general_exists_Py_st_Qy, Forall(instance_param_or_params = [x_1_to_n], instance_expr = Implies(P__x_1_to_n, alpha), condition = Q__x_1_to_n)))
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(n \in \mathbb{N}^+\right) \land \left(\alpha \in \mathbb{B}\right), \left[\exists_{y_{1}, y_{2}, \ldots, y_{n}~|~Q\left(y_{1}, y_{2}, \ldots, y_{n}\right)}~P\left(y_{1}, y_{2}, \ldots, y_{n}\right)\right] \land \left[\forall_{x_{1}, x_{2}, \ldots, x_{n}~|~Q\left(x_{1}, x_{2}, \ldots, x_{n}\right)}~\left(P\left(x_{1}, x_{2}, \ldots, x_{n}\right) \Rightarrow \alpha\right)\right]\right)
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
wrap_positionsposition(s) at which wrapping is to occur; 'n' is after the nth comma.()()('with_wrapping_at',)
justificationif any wrap positions are set, justify to the 'left', 'center', or 'right'leftleft('with_justification',)
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0ExprTuple1, 2
1Operationoperator: 4
operands: 3
2Operationoperator: 4
operands: 5
3ExprTuple6, 7
4Literal
5ExprTuple8, 9
6Operationoperator: 11
operands: 10
7Operationoperator: 11
operands: 12
8Operationoperator: 13
operand: 19
9Operationoperator: 15
operand: 20
10ExprTuple42, 17
11Literal
12ExprTuple33, 18
13Literal
14ExprTuple19
15Literal
16ExprTuple20
17Literal
18Literal
19Lambdaparameters: 27
body: 21
20Lambdaparameters: 36
body: 22
21Conditionalvalue: 23
condition: 24
22Conditionalvalue: 25
condition: 26
23Operationoperator: 35
operands: 27
24Operationoperator: 30
operands: 27
25Operationoperator: 28
operands: 29
26Operationoperator: 30
operands: 36
27ExprTuple31
28Literal
29ExprTuple32, 33
30Variable
31ExprRangelambda_map: 34
start_index: 41
end_index: 42
32Operationoperator: 35
operands: 36
33Variable
34Lambdaparameter: 46
body: 37
35Variable
36ExprTuple38
37IndexedVarvariable: 39
index: 46
38ExprRangelambda_map: 40
start_index: 41
end_index: 42
39Variable
40Lambdaparameter: 46
body: 43
41Literal
42Variable
43IndexedVarvariable: 44
index: 46
44Variable
45ExprTuple46
46Variable