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, a, b, c, d, e
from proveit.logic import And, Equals, Forall, InSet
from proveit.numbers import Complex, ComplexNonZero, Mult, frac
In [2]:
# build up the expression from sub-expressions
expr = Conditional(Forall(instance_param_or_params = [b, c, e], instance_expr = Equals(Mult(frac(Mult(a, b), c), frac(d, Mult(b, e))), Mult(frac(a, c), frac(d, e))), domain = ComplexNonZero), And(InSet(a, Complex), InSet(d, Complex)))
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_{b, c, e \in \mathbb{C}^{\neq 0}}~\left(\left(\frac{a \cdot b}{c} \cdot \frac{d}{b \cdot e}\right) = \left(\frac{a}{c} \cdot \frac{d}{e}\right)\right) \textrm{ if } a \in \mathbb{C} ,  d \in \mathbb{C}\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: 29
operands: 11
8Operationoperator: 29
operands: 12
9ExprTuple49, 43, 50
10Conditionalvalue: 13
condition: 14
11ExprTuple48, 15
12ExprTuple44, 15
13Operationoperator: 16
operands: 17
14Operationoperator: 18
operands: 19
15Literal
16Literal
17ExprTuple20, 21
18Literal
19ExprTuple22, 23, 24
20Operationoperator: 46
operands: 25
21Operationoperator: 46
operands: 26
22Operationoperator: 29
operands: 27
23Operationoperator: 29
operands: 28
24Operationoperator: 29
operands: 30
25ExprTuple31, 32
26ExprTuple33, 34
27ExprTuple49, 35
28ExprTuple43, 35
29Literal
30ExprTuple50, 35
31Operationoperator: 39
operands: 36
32Operationoperator: 39
operands: 37
33Operationoperator: 39
operands: 38
34Operationoperator: 39
operands: 40
35Literal
36ExprTuple41, 43
37ExprTuple44, 42
38ExprTuple48, 43
39Literal
40ExprTuple44, 50
41Operationoperator: 46
operands: 45
42Operationoperator: 46
operands: 47
43Variable
44Variable
45ExprTuple48, 49
46Literal
47ExprTuple49, 50
48Variable
49Variable
50Variable