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, w, x, y, z
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 = [z, w], instance_expr = Equals(Mult(frac(x, z), frac(y, w)), frac(Mult(x, y), Mult(z, w))), domain = ComplexNonZero), And(InSet(x, Complex), InSet(y, 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_{z, w \in \mathbb{C}^{\neq 0}}~\left(\left(\frac{x}{z} \cdot \frac{y}{w}\right) = \frac{x \cdot y}{z \cdot w}\right) \textrm{ if } x \in \mathbb{C} ,  y \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: 17
operands: 5
3Literal
4ExprTuple6
5ExprTuple7, 8
6Lambdaparameters: 38
body: 9
7Operationoperator: 26
operands: 10
8Operationoperator: 26
operands: 11
9Conditionalvalue: 12
condition: 13
10ExprTuple39, 14
11ExprTuple40, 14
12Operationoperator: 15
operands: 16
13Operationoperator: 17
operands: 18
14Literal
15Literal
16ExprTuple19, 20
17Literal
18ExprTuple21, 22
19Operationoperator: 37
operands: 23
20Operationoperator: 34
operands: 24
21Operationoperator: 26
operands: 25
22Operationoperator: 26
operands: 27
23ExprTuple28, 29
24ExprTuple30, 31
25ExprTuple41, 32
26Literal
27ExprTuple42, 32
28Operationoperator: 34
operands: 33
29Operationoperator: 34
operands: 35
30Operationoperator: 37
operands: 36
31Operationoperator: 37
operands: 38
32Literal
33ExprTuple39, 41
34Literal
35ExprTuple40, 42
36ExprTuple39, 40
37Literal
38ExprTuple41, 42
39Variable
40Variable
41Variable
42Variable