logo

Expression of type Forall

from the theory of proveit.logic.sets.cartesian_products

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 S, m, x, y
from proveit.logic import Boolean, CartExp, Forall, InSet
from proveit.numbers import NaturalPos
In [2]:
# build up the expression from sub-expressions
expr = Forall(instance_param_or_params = [m], instance_expr = Forall(instance_param_or_params = [x, S], instance_expr = InSet(InSet(x, CartExp(S, m)), Boolean), condition = Forall(instance_param_or_params = [y], instance_expr = InSet(InSet(y, S), Boolean))), domain = 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())
\forall_{m \in \mathbb{N}^+}~\left[\forall_{x, S~|~\forall_{y}~\left(\left(y \in S\right) \in \mathbb{B}\right)}~\left(\left(x \in S^{m}\right) \in \mathbb{B}\right)\right]
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
with_wrappingIf 'True', wrap the Expression after the parametersNoneNone/False('with_wrapping',)
condition_wrappingWrap 'before' or 'after' the condition (or None).NoneNone/False('with_wrap_after_condition', 'with_wrap_before_condition')
wrap_paramsIf 'True', wraps every two parameters AND wraps the Expression after the parametersNoneNone/False('with_params',)
justificationjustify to the 'left', 'center', or 'right' in the array cellscentercenter('with_justification',)
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Operationoperator: 16
operand: 2
1ExprTuple2
2Lambdaparameter: 30
body: 4
3ExprTuple30
4Conditionalvalue: 5
condition: 6
5Operationoperator: 16
operand: 9
6Operationoperator: 31
operands: 8
7ExprTuple9
8ExprTuple30, 10
9Lambdaparameters: 11
body: 12
10Literal
11ExprTuple23, 34
12Conditionalvalue: 13
condition: 14
13Operationoperator: 31
operands: 15
14Operationoperator: 16
operand: 19
15ExprTuple18, 29
16Literal
17ExprTuple19
18Operationoperator: 31
operands: 20
19Lambdaparameter: 33
body: 22
20ExprTuple23, 24
21ExprTuple33
22Operationoperator: 31
operands: 25
23Variable
24Operationoperator: 26
operands: 27
25ExprTuple28, 29
26Literal
27ExprTuple34, 30
28Operationoperator: 31
operands: 32
29Literal
30Variable
31Literal
32ExprTuple33, 34
33Variable
34Variable