logo

Expression of type Conditional

from the theory of proveit.numbers.division

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, m, n, x, y
from proveit.core_expr_types import w_1_to_m, z_1_to_n
from proveit.logic import And, Equals, Forall, InSet, NotEquals
from proveit.numbers import Complex, Mult, NaturalPos, frac, zero
In [2]:
# build up the expression from sub-expressions
expr = Conditional(Forall(instance_param_or_params = [w_1_to_m, x, y, z_1_to_n], instance_expr = Equals(Mult(w_1_to_m, frac(x, y), z_1_to_n), frac(Mult(w_1_to_m, x, z_1_to_n), y)), domain = Complex, condition = NotEquals(y, zero)), And(InSet(m, NaturalPos), InSet(n, NaturalPos)))
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_{w_{1}, w_{2}, \ldots, w_{m}, x, y, z_{1}, z_{2}, \ldots, z_{n} \in \mathbb{C}~|~y \neq 0}~\left(\left(w_{1} \cdot  w_{2} \cdot  \ldots \cdot  w_{m} \cdot \frac{x}{y}\cdot z_{1} \cdot  z_{2} \cdot  \ldots \cdot  z_{n}\right) = \frac{w_{1} \cdot  w_{2} \cdot  \ldots \cdot  w_{m} \cdot x\cdot z_{1} \cdot  z_{2} \cdot  \ldots \cdot  z_{n}}{y}\right) \textrm{ if } m \in \mathbb{N}^+ ,  n \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: 45
operands: 11
8Operationoperator: 45
operands: 12
9ExprTuple48, 49, 47, 50
10Conditionalvalue: 13
condition: 14
11ExprTuple53, 15
12ExprTuple56, 15
13Operationoperator: 16
operands: 17
14Operationoperator: 18
operands: 19
15Literal
16Literal
17ExprTuple20, 21
18Literal
19ExprTuple22, 23, 24, 25, 26
20Operationoperator: 42
operands: 27
21Operationoperator: 40
operands: 28
22ExprRangelambda_map: 29
start_index: 55
end_index: 53
23Operationoperator: 45
operands: 30
24Operationoperator: 45
operands: 31
25ExprRangelambda_map: 32
start_index: 55
end_index: 56
26Operationoperator: 33
operands: 34
27ExprTuple48, 35, 50
28ExprTuple36, 47
29Lambdaparameter: 62
body: 37
30ExprTuple49, 51
31ExprTuple47, 51
32Lambdaparameter: 62
body: 38
33Literal
34ExprTuple47, 39
35Operationoperator: 40
operands: 41
36Operationoperator: 42
operands: 43
37Operationoperator: 45
operands: 44
38Operationoperator: 45
operands: 46
39Literal
40Literal
41ExprTuple49, 47
42Literal
43ExprTuple48, 49, 50
44ExprTuple57, 51
45Literal
46ExprTuple58, 51
47Variable
48ExprRangelambda_map: 52
start_index: 55
end_index: 53
49Variable
50ExprRangelambda_map: 54
start_index: 55
end_index: 56
51Literal
52Lambdaparameter: 62
body: 57
53Variable
54Lambdaparameter: 62
body: 58
55Literal
56Variable
57IndexedVarvariable: 59
index: 62
58IndexedVarvariable: 60
index: 62
59Variable
60Variable
61ExprTuple62
62Variable