logo

Expression of type Conditional

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 Conditional, i, j, x, y
from proveit.core_expr_types import a_1_to_i, b_1_to_j
from proveit.logic import And, Equals, Forall, InSet
from proveit.numbers import Complex, Mult, Natural, subtract
In [2]:
# build up the expression from sub-expressions
expr = Conditional(Forall(instance_param_or_params = [a_1_to_i, x, y, b_1_to_j], instance_expr = Equals(Mult(a_1_to_i, subtract(x, y), b_1_to_j), subtract(Mult(a_1_to_i, x, b_1_to_j), Mult(a_1_to_i, y, b_1_to_j))).with_wrapping_at(2), domain = Complex), And(InSet(i, Natural), InSet(j, 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())
\left\{\forall_{a_{1}, a_{2}, \ldots, a_{i}, x, y, b_{1}, b_{2}, \ldots, b_{j} \in \mathbb{C}}~\left(\begin{array}{c} \begin{array}{l} \left(a_{1} \cdot  a_{2} \cdot  \ldots \cdot  a_{i} \cdot \left(x - y\right)\cdot b_{1} \cdot  b_{2} \cdot  \ldots \cdot  b_{j}\right) =  \\ \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) \end{array} \end{array}\right) \textrm{ if } i \in \mathbb{N} ,  j \in \mathbb{N}\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: 18
operands: 5
3Literal
4ExprTuple6
5ExprTuple7, 8
6Lambdaparameters: 9
body: 10
7Operationoperator: 42
operands: 11
8Operationoperator: 42
operands: 12
9ExprTuple52, 45, 53, 54
10Conditionalvalue: 13
condition: 14
11ExprTuple56, 15
12ExprTuple59, 15
13Operationoperator: 16
operands: 17
14Operationoperator: 18
operands: 19
15Literal
16Literal
17ExprTuple20, 21
18Literal
19ExprTuple22, 23, 24, 25
20Operationoperator: 50
operands: 26
21Operationoperator: 37
operands: 27
22ExprRangelambda_map: 28
start_index: 58
end_index: 56
23Operationoperator: 42
operands: 29
24Operationoperator: 42
operands: 30
25ExprRangelambda_map: 31
start_index: 58
end_index: 59
26ExprTuple52, 32, 54
27ExprTuple33, 34
28Lambdaparameter: 65
body: 35
29ExprTuple45, 47
30ExprTuple53, 47
31Lambdaparameter: 65
body: 36
32Operationoperator: 37
operands: 38
33Operationoperator: 50
operands: 39
34Operationoperator: 48
operand: 46
35Operationoperator: 42
operands: 41
36Operationoperator: 42
operands: 43
37Literal
38ExprTuple45, 44
39ExprTuple52, 45, 54
40ExprTuple46
41ExprTuple60, 47
42Literal
43ExprTuple61, 47
44Operationoperator: 48
operand: 53
45Variable
46Operationoperator: 50
operands: 51
47Literal
48Literal
49ExprTuple53
50Literal
51ExprTuple52, 53, 54
52ExprRangelambda_map: 55
start_index: 58
end_index: 56
53Variable
54ExprRangelambda_map: 57
start_index: 58
end_index: 59
55Lambdaparameter: 65
body: 60
56Variable
57Lambdaparameter: 65
body: 61
58Literal
59Variable
60IndexedVarvariable: 62
index: 65
61IndexedVarvariable: 63
index: 65
62Variable
63Variable
64ExprTuple65
65Variable