logo

Expression of type Forall

from the theory of proveit.numbers.multiplication

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 i, j, x, y
from proveit.core_expr_types import a_1_to_i, b_1_to_j
from proveit.logic import Forall
from proveit.numbers import Less, Mult, Natural, RealPos
In [2]:
# build up the expression from sub-expressions
expr = Forall(instance_param_or_params = [i, j], instance_expr = Forall(instance_param_or_params = [x, y], instance_expr = Forall(instance_param_or_params = [a_1_to_i, b_1_to_j], instance_expr = Less(Mult(a_1_to_i, x, b_1_to_j), Mult(a_1_to_i, y, b_1_to_j)), domain = RealPos, condition = Less(x, y))), domain = Natural)
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_{i, j \in \mathbb{N}}~\left[\forall_{x, y}~\left[\forall_{a_{1}, a_{2}, \ldots, a_{i}, b_{1}, b_{2}, \ldots, b_{j} \in \mathbb{R}^+~|~x < y}~\left(\left(a_{1} \cdot  a_{2} \cdot  \ldots \cdot  a_{i} \cdot x\cdot b_{1} \cdot  b_{2} \cdot  \ldots \cdot  b_{j}\right) < \left(a_{1} \cdot  a_{2} \cdot  \ldots \cdot  a_{i} \cdot y\cdot b_{1} \cdot  b_{2} \cdot  \ldots \cdot  b_{j}\right)\right)\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: 15
operand: 2
1ExprTuple2
2Lambdaparameters: 3
body: 4
3ExprTuple45, 48
4Conditionalvalue: 5
condition: 6
5Operationoperator: 15
operand: 9
6Operationoperator: 24
operands: 8
7ExprTuple9
8ExprTuple10, 11
9Lambdaparameters: 37
body: 12
10Operationoperator: 50
operands: 13
11Operationoperator: 50
operands: 14
12Operationoperator: 15
operand: 18
13ExprTuple45, 17
14ExprTuple48, 17
15Literal
16ExprTuple18
17Literal
18Lambdaparameters: 19
body: 20
19ExprTuple38, 39
20Conditionalvalue: 21
condition: 22
21Operationoperator: 36
operands: 23
22Operationoperator: 24
operands: 25
23ExprTuple26, 27
24Literal
25ExprTuple28, 29, 30
26Operationoperator: 32
operands: 31
27Operationoperator: 32
operands: 33
28ExprRangelambda_map: 34
start_index: 47
end_index: 45
29ExprRangelambda_map: 35
start_index: 47
end_index: 48
30Operationoperator: 36
operands: 37
31ExprTuple38, 42, 39
32Literal
33ExprTuple38, 43, 39
34Lambdaparameter: 58
body: 40
35Lambdaparameter: 58
body: 41
36Literal
37ExprTuple42, 43
38ExprRangelambda_map: 44
start_index: 47
end_index: 45
39ExprRangelambda_map: 46
start_index: 47
end_index: 48
40Operationoperator: 50
operands: 49
41Operationoperator: 50
operands: 51
42Variable
43Variable
44Lambdaparameter: 58
body: 52
45Variable
46Lambdaparameter: 58
body: 53
47Literal
48Variable
49ExprTuple52, 54
50Literal
51ExprTuple53, 54
52IndexedVarvariable: 55
index: 58
53IndexedVarvariable: 56
index: 58
54Literal
55Variable
56Variable
57ExprTuple58
58Variable