0
votes

I have been working with limits and topology in and I want to prove the following lemma:

lemma fixes f g :: "real ⇒ real"
assumes
"open S"
"∀a b. a < b <--> f a < f b"
"∀a. (f a)>0"
"continuous_on UNIV (f)"
"∀w∈S. ∀h. (w+h)∈S --> h * (f w) ≤ g (w+h) - g w"
shows  "∀w∈S. eventually (λh. f w ≤ (g (w + h) - g w)/h) (at 0)"
using assms unfolding eventually_at
apply (auto simp: divide_simps mult_ac)

I have managed to prove it for two different scenerios:

Here, all instances of h in the inequalities is replaced by |h|. A solution is found almost instantly.

lemma 
fixes f g :: "real ⇒ real"
assumes "open S" "∀w∈S. ∀h. (w+h)∈S --> abs(h) * (f w) ≤ g (w+abs(h)) - g w"
shows "∀w∈S. eventually (λh. f w ≤ (g (w + abs(h)) - g w)/abs(h)) (at 0)"
using assms unfolding eventually_at
apply (simp add: divide_simps mult_ac)
by (metis (no_types, hide_lams) add.commute diff_0 diff_add_cancel 
diff_minus_eq_add dist_norm open_real_def)

In another scenerio, instead of having a set S, I use the set of real numbers instead (UNIV), and after (simp add: ) I am left with only one case to prove for which sledgehammer finds a solution.

lemma compuniv:
fixes f g :: "real ⇒ real"
assumes "S=UNIV" "open S"
"∀w∈S. ∀h. (w+h)∈S --> h * (f w) ≤ g (w+h) - g w"
shows  "∀w∈S. eventually (λh. f w ≤ (g (w + h) - g w)/h) (at 0)"
using assms unfolding eventually_at
apply (simp add: divide_simps mult_ac)

Specifically, I am struggling to understand why when S=UNIV, a solution can be found. Even a method to reduce the problem to proving one sub-case (as when S=UNIV) will help greatly. How can I extend the proofs of the above two cases to prove the main problem?

The bigger picture

This result forms the foundation to proof a result using the real_tendsto_sandwich theorem.

 lemma 
 fixes f g :: "real ⇒ real"
 assumes
 "open S"
 "∀a b. a < b <-> f a < f b"
 "∀a. f a > 0"
 "continuous_on S (f)"
 "∀w∈S. (λh. f (w+h)) -- 0 --> f w"
 "∀w∈S. (λh. f w) -- 0 --> f w"
 "∀w∈S. eventually (λh. (h ≥ 0 --> f (w+h) ≥ (g (w + h) - g w)/h) ∧ 
 (h ≤ 0 --> f (w+h) ≤ (g (w + h) - g w)/h)) (at 0)"
 "∀w∈S. eventually (λh. (h ≥ 0 --> f w ≤ (g (w + h) - g w)/h) ∧ 
 (h ≤ 0 --> f w ≥ (g (w + h) - g w)/h)) (at 0)"
 shows "∀w∈S. ((λh. (g (w+h) - g w)/h) ---> f w) (at 0)"
 using assms real_tendsto_sandwich`

From the assumptions, it is clear (g (w + h) - g w)/h) is bounded by the f (w+h) and f w when h ≥ 0 and h ≤ 0 therefore taking the limit has h --> 0 yields the result (g (w + h) - g w)/h) --> f w in both cases. Therefore mathematically the final result would be the same. The difficulty is that how can I combine the result when h ≥ 0 and h ≤ 0 to prove the final result?

1

1 Answers

1
votes

(Update: I was wrong in my informal explanation, but I think I fixed it. I added some opinions of mine, but I put them at the end, since you didn't ask for them.)

(I assume your use of <--> is a mistake, and it should be <->.)

In all this, I'm working with intuitive ideas of what I think the math means in Topological_Spaces.thy. It's good that you're working on some calculus; this give me a little hope.

(General complaining: The level of formalism in the THY is fairly high, it doesn't sync up directly with ZFC based theories, and as is typical with all the developers of src/HOL and the AFP, the authors don't explain any of it in textbook style, not even in monograph style, not in any style. Style requires the absence of a void.)

If what I give you here is not what you want, you can tell me to delete it, to keep it unanswered so that maybe someone else will come along with something better.

Overview

Below, first I discuss some things about UNIV, and mention some other problems in your last lemma, and with what you say in the last two paragraphs.

I then focus on the fact that the key to all of this is figuring out how h > 0 and h < 0 affects the inequalities, when moving the h from one side to the other.

You might not understand what UNIV is

A key phrase you use in your 2nd to last paragraph is "instead of having a set S, I use the set of real numbers instead (UNIV)".

If you mean S::real set as any subset of the real numbers, versus UNIV::real set, which is all of the real numbers, then that makes sense, but S in all your lemmas is of type real set, type inference, as can be seen in the output panel if types are shown.

Additionally, UNIV is a polymorphic type, 'a set, as shown by this source in src/HOL/Set.thy#l60.

subsubsection {* The universal set -- UNIV *}

abbreviation UNIV :: "'a set" where
  "UNIV ≡ top"

lemma UNIV_def:
  "UNIV = {x. True}"
  by (simp add: top_set_def top_fun_def)

I don't understand what solution you're talking about with "I am struggling to understand why when S=UNIV, a solution can be found", or what two cases you're talking about. I only see one proof goal in all the lemmas. Below, though, I end up using 2 cases as part of a conjunction.

Eliminating UNIV from your lemmas

I don't think UNIV is of key importance here. Also, there might be some conditions in your lemmas that aren't required, though I try to change things as little as possible.

I do get rid of UNIV, because if I can prove a theorem for any real set, then it's also true for UNIV::real set. Consider this:

lemma "(∀S. continuous_on S f) ==> continuous_on UNIV f"
  by(simp)

There is also this:

lemma "open (UNIV::real set)"
  by(simp)

The first part of your last theorem is this:

lemma
  fixes f g :: "real => real"
  assumes "S = UNIV" 
      and "open S"
...

Because you assume S = UNIV, then you don't need open S. Because of that, and because not understanding some things you've said, I now move away from your last lemma, and the last two paragraphs.

I put two use of abs in your 1st lemma, and get rid of UNIV

My goal, like your goal, is to prove theorems with no use of abs h. A mid-level point was inserting two uses of abs h in your 1st lemma, based on what you did:

lemma
  fixes f g :: "real => real"
  assumes "open S"
      and "∀a b. a < b <-> f a < f b"
      and "∀a. f a > 0"
      and "continuous_on S f"
      and "∀w∈S. ∀h. (w + h)∈S --> abs h * f w ≤ g (w + h) - g w"
  shows  "∀w∈S. eventually (λh. f w ≤ (g (w + h) - g w)/abs h) (at 0)"
using assms unfolding eventually_at
apply (auto simp: divide_simps mult_ac)
by(metis (no_types, hide_lams) add.commute add_diff_cancel add_left_cancel 
  assms(2) assms(3) diff_0 diff_0_right diff_minus_eq_add dist_norm 
  monoid_add_class.add.left_neutral mult.commute open_real_def)

There, I eliminated the use of UNIV, and used S, any set of reals.

What's positive or negative in the inequalities is a key point

Related to this is the following basic inequality:

lemma "∀h > 0::real. h * x ≤ y <-> x ≤ y/h"
  by(auto simp add: mult_imp_le_div_pos less_eq_real_def mult.commute 
    pos_less_divide_eq)

In the equality, when the multiplier h is positive, then life is easy, because the direction of the inequality won't change, regardless of the sign of x and y.

At least with Sledgehammer, that's why it's easy to prove the theorems when abs h is used. We don't have to worry about the formula f w ≤ g (w + h) - g w, about whether either side is positive or negative.

Here's how I finally modified your 1st lemma

It's likes this:

lemma 
  fixes f g :: "real => real"
  assumes "open S"
      and "∀a b. a < b <-> f a < f b"
      and "∀a. f a > 0"
      and "continuous_on S f"
      and "∀w∈S. ∀h. (w + h)∈S --> h * f w ≤ g (w + h) - g w"
  shows  "∀w∈S. eventually (λh. 
    (h > 0 --> f w ≤ (g (w + h) - g w)/h) ∧ 
    (h < 0 --> f w ≥ (g (w + h) - g w)/h)) (at 0)"
using assms unfolding eventually_at
apply (auto simp: divide_simps mult_ac)
by(metis add.commute add_diff_cancel assms(3) assms(4) assms(5) diff_0_right 
  dist_norm not_less open_real_def)

Here's my explanation (cases: for h > 0 and h < 0)

Two of the conditions in the lemma are these, ∀a b. a < b <-> f a < f b and ∀a. f a > 0, and so f is a positive, monotone increasing function. I don't see that either of those gets used.

Case: h > 0 and (w + h) an element of S

Because ∀w ∈ S. ∀h. (w + h) ∈ S --> h * f w ≤ g (w + h) - g w, then when h > 0 and (w + h) ∈ S, then

h * f w ≤ g (w + h) - g w.

We can multiply by 1/h, if h is not equal to 0, and the direction of the inequality stays the same. In the eventually, I assume the dummy variable is never equal to 0, so the first half the conjunction will eventually be true as h goes to 0.

Case: h < 0 and (w + h) an element of S

Likewise, when h < 0 and (w + h) ∈ S, then

h * f w ≤ g (w + h) - g w.

But because h < 0, if we multiply by 1/h, we have to reverse the direction of the inequality.

Therefore, the second half of the conjunction in the lambda function will eventually be true, as h goes to 0.

Obnoxious update: You didn't ask for my opinion about Stackoverflow etiquette, and I can be an abuser of etiquette myself, such as maybe with this answer, but I think each "tag community" should work to police their own. Unfortunately, etiquette rules aren't clearly stated here, such as at the reddit Rust site, reddit.com/r/rust. I end up doing this, and that's no good either, but maybe it could help influence someone who actually has some influence.

I don't care if you accept my answer here, and you may have reasons for not accepting some of the answers already given to you, but as an example, it's my opinion that you should accept the answer given by R. Thiemann for Substitution in Isabelle.

By not accepting an answer, you're basically saying, "I've not yet received an answer which gives me the information that I want". Additionally, answers not accepted show under the Isabelle tag unanswered category.

I think everyone should understand how few people there are in the world who can answer questions about non-trivial math problems, when implemented in Isabelle/HOL. I'll guess that's there's about 200 people worldwide who actively use Isabelle, who can be considered knowledgeable, proficient users. Out of those, there are fewer even who keep calculus, real analysis, and topology fresh on their mind, and as it's implemented in Isabelle/HOL

The use of Isabelle is a hybrid discipline, combining formal math, logic, and computer science, and at a level of formalism that would typically be at the post-4-year-degree level, partly because there aren't textbooks that explain the Isabelle/HOL logic and math, at an undergraduate level, and partly because it's just hard, graduate-level logic and mathematics.

The quantity of people needed, who have graduate-level knowledge about topology, and who have the time and desire to answers questions about topology, are more likely to operate on mathoverflow.net (this links to a question), and math.stackexchange.com. (Note: I picked that question and answer to show that many answers, on that site, are long or longish, because they try to explain the underlying math of proofs. With Isabelle, if a person is into that kind of thing, like me, then there's even more to explain many times. There can be the math to explain, and then the details of what the Isabelle/HOL syntax means mathematically, such as my comments about UNIV below.)

I say the above because, personally, when I ask a question, I start out with the assumption that I'm not going to get an answer, if a person has to think more than, lets say, 15 minutes. No, make that 5 minutes.

If I get useful information that gives me some insight, then I accept the answer. I would not accept an answer if it was extremely important I get the right information. For math problems, there are always more questions to ask than can be explained by people, so at best, generally, you can only expect to be pointed in the right direction.

You didn't ask for 8 paragraphs of my opinion, but I'm sort of not just talking to you. The problem of people trying to learn to do mathematics in Isabelle/HOL is a big problem, as I see it. We can't say, "Oh, you need to look at Topology in Isabelle/HOL, by James Munkres. There are things like Topology on the AFP, but that's a far cry from a decently written textbook or monograph.

I can delete this answer, or this part of the answer, if that ends up being what I should do.