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 , we have
or
If and , then .
Yury G. Kudryashov (Feb 19 2022 at 00:04):
Or
If and for all we have , then for all we have .
Yury G. Kudryashov (Feb 19 2022 at 00:20):
E.g., in your PDF you try to prove
based on some assumptions on , , , and 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 and , 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 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 .
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 , , and , consider the sequence $$\theta_i=x^{i-1}y\theta_0$. Put , then we can rewrite the previous formula as .
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 : ℝ) (θ : ℕ → ℝ) (hθ : ∀ 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 : ℝ) (θ : ℕ → ℝ) (hθ : ∀ 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 are real numbers and 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 ? Otherwise, the series diverges.
- You write . Do you actually mean ?
- What is ? Is it ?
- You have , , , and . 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 implies .
Yury G. Kudryashov (Feb 21 2022 at 19:14):
(assuming )
Parivash (Feb 21 2022 at 19:15):
Thanks for looking,
Yes, is my means
all k
Actually, Axiom 4-7 is necessary for proofing which is that here I consider it as axiom, So, now we can ignore them.
- Yes,
Yury G. Kudryashov (Feb 21 2022 at 19:24):
If you want to prove a formula for , then you should define them in some other way.
Yury G. Kudryashov (Feb 21 2022 at 19:24):
What about the formula for for ?
Yury G. Kudryashov (Feb 21 2022 at 19:25):
You get , hence .
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 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 : ℝ)
(hθ : ∀ 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 along with mentioned final goal, How can I do it?
we can prove it in a way that we say and So, finally we reach result that
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