Zulip Chat Archive

Stream: new members

Topic: Formalizing formula


Parivash (Feb 18 2022 at 20:44):

Hi,
How can I formulize this formula in Lean?
image.png

Alex J. Best (Feb 18 2022 at 20:47):

Without more context its not clear what the things in the formula are to us, so its difficult to say what formalizing that would even mean. Are they vectors with cross product for example? or is x just some multiplication operation

Parivash (Feb 18 2022 at 20:53):

x, y, teta0, and teta are variables which can be considered as positive numbers, actually I don't know how to use indices here.

Riccardo Brasca (Feb 18 2022 at 20:57):

You should try to be more precise, Lean is very very picky about precision... at the end this is one of the reason why we formalize.

What do you mean by "one dimensional variables"? Elements of a one-dimensional vector space (over ?)?

Parivash (Feb 18 2022 at 21:03):

@Riccardo Brasca
did you know how to use indices here?

Riccardo Brasca (Feb 18 2022 at 21:04):

In VS Code you can write f \ 3 (without the spaces) to get f₃.

Parivash (Feb 18 2022 at 21:05):

@Riccardo Brasca
No, my means is it change from 1 to infinity

Riccardo Brasca (Feb 18 2022 at 21:06):

I don't understand your question...

Yury G. Kudryashov (Feb 18 2022 at 21:08):

A sequence is usually represented as a map from natural numbers to some type.

Parivash (Feb 18 2022 at 21:26):

Actually, This is what I'm trying to formulize:
Proof-Shape.pdf

Yury G. Kudryashov (Feb 18 2022 at 21:48):

This is a sequence of formulas, not a text.

Yury G. Kudryashov (Feb 18 2022 at 21:51):

If you want to formalize something, I suggest that first you write it down with all the details. Imagine that you're writing a paper but the reader is going to (pretend to) be a very dumb person.

Yury G. Kudryashov (Feb 18 2022 at 21:52):

So, you should write all the "theorem", "consider a sequence of real/ rational/ integer/... numbers" etc

Parivash (Feb 18 2022 at 22:01):

@Yury G. Kudryashov
Okay, then how can I relate these theorems to each other?
Because my final formula depends on all theorems.

Yury G. Kudryashov (Feb 18 2022 at 23:15):

Before answering this question, I need to see a textbook/paper quality text, not a sequence of formulas. E.g., what mathematical theorem are you trying to prove (with all "let ..., then ...")?

Parivash (Feb 18 2022 at 23:23):

@Yury G. Kudryashov
the last formula which is written in pdf.

Yury G. Kudryashov (Feb 18 2022 at 23:24):

The last formula is a formula, not a statement of a theorem.

Parivash (Feb 18 2022 at 23:25):

@Yury G. Kudryashov
you know there are some formula like Vads, A, and \theta, that we just consider them as assumption, and then substitute them in formula.

Parivash (Feb 18 2022 at 23:26):

@Yury G. Kudryashov
Yes, that's formula, it should not be formula?

Yury G. Kudryashov (Feb 18 2022 at 23:26):

What is your background? Math/CS/...? Undergrad/grad/...?

Parivash (Feb 18 2022 at 23:27):

I'm PhD, Chemical engineering

Parivash (Feb 18 2022 at 23:28):

Now I want to formuliz equations in chemical engineering.

Yury G. Kudryashov (Feb 19 2022 at 00:02):

You can't formalize equations. You can formalize theorems. E.g.,

For any natural number nn, we have k=1nk=n(n+1)2\sum_{k=1}^n k=\frac{n(n+1)}{2}

or

If a<ba < b and b<cb < c, then a<ca < c.

Yury G. Kudryashov (Feb 19 2022 at 00:04):

Or

If a0=1a_0=1 and for all nn we have an+1=2ana_{n+1}=2a_n, then for all nn we have an=2na_n=2^n.

Yury G. Kudryashov (Feb 19 2022 at 00:20):

E.g., in your PDF you try to prove

qV0=C×x(1x)21+C×x1x\frac{q}{V_0}=\frac{C\times \frac{x}{(1-x)^2}}{1+C\times\frac{x}{1-x}}

based on some assumptions on qq, V0V_0, CC, and xx listed above.

Yury G. Kudryashov (Feb 19 2022 at 00:21):

But it is not clear what you assume about these numbers and what you deduce from the assumptions.

Yury G. Kudryashov (Feb 19 2022 at 00:24):

If you want to formalize some statement, you need to list all of your assumptions. What are the types of these variables (real/rational/elements of any field/...)? What are the constraints (probably, you should assume x1x\ne 1 and 1+Cxx1+Cx\ne x, otherwise you'll have a zero in the denominator)? What relations on these variables do you assume?

Parivash (Feb 19 2022 at 01:17):

@Yury G. Kudryashov
assumption1.pdf
the assumption is showen in this file.

Eric Wieser (Feb 19 2022 at 01:20):

Note you can type LaTeX\LaTeX directly into Zulip between double $$s (like $$this$$)

Eric Wieser (Feb 19 2022 at 01:29):

docs#tsum_geometric_of_lt_1 looks like the closest thing to "assumption" 8 (using assumption 9), and docs#tsum_coe_mul_geometric_of_norm_lt_1 is alost "assumption" 7. Both sum from i=0 instead of i=1, but that's manageable.

Yury G. Kudryashov (Feb 19 2022 at 02:22):

Assumption 8 is not an assumption. It is a formula that is true for all 0<x<10<x<1.

Yury G. Kudryashov (Feb 19 2022 at 02:22):

You need to separate assumptions from intermediate computations etc.

Yury G. Kudryashov (Feb 19 2022 at 02:25):

The first few lines look like

Given real numbers xx, yy, and θ0\theta_0, consider the sequence $$\theta_i=x^{i-1}y\theta_0$. Put C=yxC=\frac{y}{x}, then we can rewrite the previous formula as θi=Cxiθ0\theta_i=Cx^i\theta_0.

Yury G. Kudryashov (Feb 19 2022 at 02:26):

Please try to rewrite the rest of the page in this style. State explicitly whether you introduce new notation, use a well-known fact, or draw conclusions from previous formulae.

Parivash (Feb 19 2022 at 03:36):

@Yury G. Kudryashov
Great, How can I write $$ \theta_i=C*x^{i)\*theta_0$$ and introduce them in lean, and how can I relate multiple theorem to each other?

Yury G. Kudryashov (Feb 19 2022 at 03:39):

Let me repeat again. To start this discussion, I need a complete text written in the style outlined above. Not a bunch of formulas.

Yury G. Kudryashov (Feb 19 2022 at 03:40):

Or at least a list of all assumptions (not intermediate calculations!) and the conclusion.

Yury G. Kudryashov (Feb 19 2022 at 03:43):

The quoted text can be written as

import data.real.basic

example (x y C : ) (θ :   ) ( :  k : , θ k = x ^ (k - 1 : ) * y * θ 0)
  (hC : C = y / x) : sorry :=
begin
  have hθ' :  k : , θ k = C * x ^ k * θ 0,
  { sorry },
  sorry
end

Yury G. Kudryashov (Feb 19 2022 at 03:44):

Here the first sorry is the main statement you're going to prove (and probably you're going to have more assumptions) while the other two sorry's are for missing proof parts

Yury G. Kudryashov (Feb 19 2022 at 03:46):

If I take you final formula as the goal, then it looks like

import data.real.basic

example (x y C : ) (θ :   ) ( :  k : , θ k = x ^ (k - 1 : ) * y * θ 0)
  (hC : C = y / x) (q V₀ : ) /- missing assumptions -/ :
  q / V₀ = (C * (x / (1 - x) ^ 2)) / (1 + C * (x / (1 - x))) :=
begin
  have hθ' :  k : , θ k = C * x ^ k * θ 0,
  { sorry },
  sorry
end

Yury G. Kudryashov (Feb 19 2022 at 03:49):

Now I'll wait till you write a readable text that you're going to formalize. Imagine that you're writing a section for a calculus textbook.

Parivash (Feb 19 2022 at 03:51):

Like this one you means?
Proof-Shape.pdf

Mario Carneiro (Feb 19 2022 at 03:58):

No. That is a list of equations lacking any context for what is an assumption, what is a definition and what is an assertion. It is very important to distinguish these things in formalization

Mario Carneiro (Feb 19 2022 at 04:00):

(There is also another category of thing, a "typing assertion", represented as (x y C : ℝ) (θ : ℕ → ℝ) in Yury's example and omitted entirely in yours. In mathematics this is usually done by some sentence like "Suppose x,y,Cx,y,C are real numbers and θn\theta_n is a sequence of reals. Then..." This is also important for giving context for the theorem statement, and it is required in lean.)

Yury G. Kudryashov (Feb 19 2022 at 04:09):

I did show how the text may start above

Yury G. Kudryashov (Feb 19 2022 at 04:10):

Again: you don't see pages like your Proof-Shape.pdf in a good calculus textbook.

Yury G. Kudryashov (Feb 19 2022 at 04:10):

You see lots of words that explain what happens.

Mario Carneiro (Feb 19 2022 at 04:13):

That point is worth underscoring. Formalizing mathematics is not just "remove all the words". Instead the words correspond to specific bits of lean syntax, and without them it's impossible to tell which bits of lean syntax to stick together to get the proof you want

Yury G. Kudryashov (Feb 19 2022 at 04:16):

(and you see quite a few words in a well-documented lean file too)

Parivash (Feb 19 2022 at 04:30):

@Yury G. Kudryashov
Okay, I know what is your mean, you are right I should explain variable with more detail, let's arrange it and send it tomorrow, if you are okay?

Parivash (Feb 21 2022 at 01:50):

@Yury G. Kudryashov
Sorry for my delay in sending Pdf
Please find sequence formula in this file. Sequence-of-Equations.pdf

Yury G. Kudryashov (Feb 21 2022 at 01:51):

This is still a sequence of formulas, not a readable mathematical text.

Parivash (Feb 21 2022 at 01:52):

@Yury G. Kudryashov
at the end of file I explained type of all variables and constrains.

Yury G. Kudryashov (Feb 21 2022 at 01:55):

Here is a readable mathematical text: https://ncatlab.org/nlab/show/Urysohn%27s+lemma (of course, on a completely different topic)

Yury G. Kudryashov (Feb 21 2022 at 01:56):

We can't help you before you write a text with at least this amount of details.

Yury G. Kudryashov (Feb 21 2022 at 01:56):

Start with a statement of a theorem.

Parivash (Feb 21 2022 at 02:07):

@Yury G. Kudryashov
Okay, I'll separate a final equation which we want to prove with Axioms

Parivash (Feb 21 2022 at 19:02):

@Yury G. Kudryashov
Hi, I hope that this file provide enough detail. Editted.pdf

Yury G. Kudryashov (Feb 21 2022 at 19:11):

This is better. A few more questions.

  • Am I right that you forgot to add the assumption x<1x<1? Otherwise, the series i=0θi\sum_{i=0}^\infty \theta_i diverges.
  • You write θR\theta\in\mathbb R. Do you actually mean θiR\theta_i\in\mathbb R?
  • What is V0V0? Is it V0V_0?
  • You have kik_i, reir_{ei}, rCi1r_{Ci-1}, and rci1r_{ci-1}. Am I right that you never use these and Axioms 4-7 in the rest of the text?

Yury G. Kudryashov (Feb 21 2022 at 19:14):

BTW, Axiom 9 for i=0i=0 implies C=1C=1.

Yury G. Kudryashov (Feb 21 2022 at 19:14):

(assuming θ00\theta_0\ne 0)

Parivash (Feb 21 2022 at 19:15):

Thanks for looking,
Yes, V0 V_{0} is my means
θiR \theta_{i} \in \mathbb{R}
all k R \in \mathbb{R}
Actually, Axiom 4-7 is necessary for proofing θi \theta_{i} which is θi=Cxiθ0 \theta_{i} = C*x_{i}*\theta_{0} that here I consider it as axiom, So, now we can ignore them.

  • Yes, θ00 \theta_{0} \neq 0

Yury G. Kudryashov (Feb 21 2022 at 19:24):

If you want to prove a formula for θi\theta_i, then you should define them in some other way.

Yury G. Kudryashov (Feb 21 2022 at 19:24):

What about the formula for θi\theta_i for i=0i=0?

Yury G. Kudryashov (Feb 21 2022 at 19:25):

You get θ0=Cx0θ0=Cθ0\theta_0 = Cx^0\theta_0=C\theta_0, hence C=1C=1.

Parivash (Feb 21 2022 at 19:25):

can we define two goals here?
proofing it is so simple if we can prove them let me provide its formula.

Parivash (Feb 21 2022 at 19:28):

Please consider θ00 \theta_{0} \neq 0 all through the proofing.

Parivash (Feb 21 2022 at 19:29):

Yes, C=1 make sense that is a constant.

Yury G. Kudryashov (Feb 21 2022 at 19:40):

So, you want to prove this:

import analysis.specific_limits

lemma some_name (θ :   ) (a b C P q A V₀ Vads x : )
  ( :  k, θ k = x ^ k * θ 0) (hA : A = ∑' k, θ k)
  (hVads : Vads = V₀ * ∑' k : , k * θ k) (hq : q = Vads / A) :
  q = a * P / ((1 - b * P) * (1 - b * P + C * P)) :=

Yury G. Kudryashov (Feb 21 2022 at 19:40):

(probably, you need more assumptions like hx0 : 0 ≤ x and hx1 : x < 1)

Yury G. Kudryashov (Feb 21 2022 at 19:41):

You can use docs#tsum_geometric_of_lt_1 and docs#tsum_coe_mul_geometric_of_norm_lt_1

Parivash (Feb 21 2022 at 19:44):

@Yury G. Kudryashov
the assumption that you mentioned works, that's correct.

Parivash (Feb 21 2022 at 19:46):

@Yury G. Kudryashov
Yes, that is what I'm trying to proof.

Yury G. Kudryashov (Feb 21 2022 at 19:49):

OK, it only took a few days to formalize the statement... Now you should try to prove it. Have you done some tutorials (e.g., the natural numbers game)?

Yury G. Kudryashov (Feb 21 2022 at 19:49):

If not, then I recommend to start with tutorials.

Parivash (Feb 21 2022 at 19:50):

@Yury G. Kudryashov
Yes, I played natural number game

Yury G. Kudryashov (Feb 21 2022 at 19:50):

Then you can try to prove your lemma using lemmas I mentioned above.

Parivash (Feb 21 2022 at 19:52):

@Yury G. Kudryashov
Okay,
One more question, if I want to prove θi \theta_{i} along with mentioned final goal, How can I do it?
we can prove it in a way that we say θ2=(x1)θ1 \theta_{2} = (x^{1})*\theta_{1} and θ3=(x2)θ1 \theta_{3} = (x^{2})*\theta_{1} So, finally we reach result that θi=(xi1)θ1 \theta_{i} = (x^{i-1})*\theta_{1}
Actually, I'm not sure this is a reliable way for proofing or not!
if yes, how we can relate. them to each other?

Yakov Pechersky (Feb 21 2022 at 20:17):

Yes, you can prove it using the htheta assumption that Yury wrote it. In a sense, your theta_i is the way you wrote it by definition


Last updated: Dec 20 2023 at 11:08 UTC