logo

Expression of type Conditional

from the theory of proveit.core_expr_types.tuples

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, a, i, j, k, l
from proveit.core_expr_types.tuples import neg_shift_equiv
from proveit.logic import Equals, Forall, InSet
from proveit.numbers import Integer, Natural, one, subtract
In [2]:
# build up the expression from sub-expressions
expr = Conditional(Forall(instance_param_or_params = [i, j, k, l], instance_expr = neg_shift_equiv, conditions = [InSet(subtract(subtract(j, one), i), Natural), Equals(k, subtract(i, a)), Equals(l, subtract(j, a))]), InSet(a, Integer))
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\{\forall_{i, j, k, l~|~\left(\left(j - 1\right) - i\right) \in \mathbb{N}, k = \left(i - a\right), l = \left(j - a\right)}~\left(\left(f\left(i\right), f\left(i - 1\right), \ldots, f\left(j\right)\right) = \left(f\left(k + a\right), f\left(\left(k - 1\right) + a\right), \ldots, f\left(l + a\right)\right)\right) \textrm{ if } a \in \mathbb{Z}\right..
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
condition_delimiter'comma' or 'and'commacomma('with_comma_delimiter', 'with_conjunction_delimiter')
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Conditionalvalue: 1
condition: 2
1Operationoperator: 3
operand: 6
2Operationoperator: 22
operands: 5
3Literal
4ExprTuple6
5ExprTuple62, 7
6Lambdaparameters: 8
body: 9
7Literal
8ExprTuple60, 58, 47, 48
9Conditionalvalue: 10
condition: 11
10Operationoperator: 25
operands: 12
11Operationoperator: 13
operands: 14
12ExprTuple15, 16
13Literal
14ExprTuple17, 18, 19
15ExprTuple20
16ExprTuple21
17Operationoperator: 22
operands: 23
18Operationoperator: 25
operands: 24
19Operationoperator: 25
operands: 26
20ExprRangelambda_map: 27
start_index: 50
end_index: 28
21ExprRangelambda_map: 29
start_index: 30
end_index: 31
22Literal
23ExprTuple32, 33
24ExprTuple47, 34
25Literal
26ExprTuple48, 35
27Lambdaparameter: 67
body: 36
28Operationoperator: 64
operand: 58
29Lambdaparameter: 67
body: 38
30Operationoperator: 64
operand: 47
31Operationoperator: 64
operand: 48
32Operationoperator: 56
operands: 41
33Literal
34Operationoperator: 56
operands: 42
35Operationoperator: 56
operands: 43
36Operationoperator: 45
operand: 61
37ExprTuple58
38Operationoperator: 45
operand: 52
39ExprTuple47
40ExprTuple48
41ExprTuple49, 50
42ExprTuple60, 51
43ExprTuple58, 51
44ExprTuple61
45Variable
46ExprTuple52
47Variable
48Variable
49Operationoperator: 56
operands: 53
50Operationoperator: 64
operand: 60
51Operationoperator: 64
operand: 62
52Operationoperator: 56
operands: 57
53ExprTuple58, 59
54ExprTuple60
55ExprTuple62
56Literal
57ExprTuple61, 62
58Variable
59Operationoperator: 64
operand: 66
60Variable
61Operationoperator: 64
operand: 67
62Variable
63ExprTuple66
64Literal
65ExprTuple67
66Literal
67Variable