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(Neg(Mult(a_1_to_i, Neg(b), c_1_to_j)), 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(-\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)\right) = \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) \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: 25
body: 9
7Operationoperator: 35
operands: 10
8Operationoperator: 35
operands: 11
9Conditionalvalue: 12
condition: 13
10ExprTuple42, 14
11ExprTuple47, 14
12Operationoperator: 15
operands: 16
13Operationoperator: 17
operands: 18
14Literal
15Literal
16ExprTuple19, 20
17Literal
18ExprTuple21, 22, 23
19Operationoperator: 43
operand: 29
20Operationoperator: 32
operands: 25
21ExprRangelambda_map: 26
start_index: 46
end_index: 42
22Operationoperator: 35
operands: 27
23ExprRangelambda_map: 28
start_index: 46
end_index: 47
24ExprTuple29
25ExprTuple37, 49, 39
26Lambdaparameter: 54
body: 30
27ExprTuple49, 40
28Lambdaparameter: 54
body: 31
29Operationoperator: 32
operands: 33
30Operationoperator: 35
operands: 34
31Operationoperator: 35
operands: 36
32Literal
33ExprTuple37, 38, 39
34ExprTuple48, 40
35Literal
36ExprTuple50, 40
37ExprRangelambda_map: 41
start_index: 46
end_index: 42
38Operationoperator: 43
operand: 49
39ExprRangelambda_map: 45
start_index: 46
end_index: 47
40Literal
41Lambdaparameter: 54
body: 48
42Variable
43Literal
44ExprTuple49
45Lambdaparameter: 54
body: 50
46Literal
47Variable
48IndexedVarvariable: 51
index: 54
49Variable
50IndexedVarvariable: 52
index: 54
51Variable
52Variable
53ExprTuple54
54Variable