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, b, i, j
from proveit.core_expr_types import a_1_to_i, c_1_to_j
from proveit.logic import And, Equals, Forall, InSet
from proveit.numbers import Complex, Mult, Natural, Neg
In [2]:
# build up the expression from sub-expressions
expr = Conditional(Forall(instance_param_or_params = [a_1_to_i, b, c_1_to_j], instance_expr = Equals(Mult(a_1_to_i, Neg(b), c_1_to_j), Neg(Mult(a_1_to_i, b, c_1_to_j))), 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}, b, c_{1}, c_{2}, \ldots, c_{j} \in \mathbb{C}}~\left(\left(a_{1} \cdot  a_{2} \cdot  \ldots \cdot  a_{i} \cdot \left(-b\right)\cdot c_{1} \cdot  c_{2} \cdot  \ldots \cdot  c_{j}\right) = \left(-\left(a_{1} \cdot  a_{2} \cdot  \ldots \cdot  a_{i} \cdot b\cdot c_{1} \cdot  c_{2} \cdot  \ldots \cdot  c_{j}\right)\right)\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: 17
operands: 5
3Literal
4ExprTuple6
5ExprTuple7, 8
6Lambdaparameters: 36
body: 9
7Operationoperator: 38
operands: 10
8Operationoperator: 38
operands: 11
9Conditionalvalue: 12
condition: 13
10ExprTuple45, 14
11ExprTuple48, 14
12Operationoperator: 15
operands: 16
13Operationoperator: 17
operands: 18
14Literal
15Literal
16ExprTuple19, 20
17Literal
18ExprTuple21, 22, 23
19Operationoperator: 35
operands: 24
20Operationoperator: 33
operand: 30
21ExprRangelambda_map: 26
start_index: 47
end_index: 45
22Operationoperator: 38
operands: 27
23ExprRangelambda_map: 28
start_index: 47
end_index: 48
24ExprTuple40, 29, 42
25ExprTuple30
26Lambdaparameter: 54
body: 31
27ExprTuple41, 43
28Lambdaparameter: 54
body: 32
29Operationoperator: 33
operand: 41
30Operationoperator: 35
operands: 36
31Operationoperator: 38
operands: 37
32Operationoperator: 38
operands: 39
33Literal
34ExprTuple41
35Literal
36ExprTuple40, 41, 42
37ExprTuple49, 43
38Literal
39ExprTuple50, 43
40ExprRangelambda_map: 44
start_index: 47
end_index: 45
41Variable
42ExprRangelambda_map: 46
start_index: 47
end_index: 48
43Literal
44Lambdaparameter: 54
body: 49
45Variable
46Lambdaparameter: 54
body: 50
47Literal
48Variable
49IndexedVarvariable: 51
index: 54
50IndexedVarvariable: 52
index: 54
51Variable
52Variable
53ExprTuple54
54Variable