0

I want to define a continuous function on an interval of the real line -- [a,b), [a,b], (a,b), or (a,b] (where a < b and either could possibly be infinite) -- in Isabelle, or state that a function is continuous on such an interval.

I believe what I want is continuous_on s f because

"continuous_on s f ⟷ (∀x∈s. (f ⤏ f x) (at x within s))"

(which I got from here:https://isabelle.in.tum.de/library/HOL/HOL/Topological_Spaces.html#Topological_Spaces.topological_space_class.at_within|const)

So I think "s" should be an interval but I'm not sure how best to represent that.

So I would like to know how I could set "s" to any of the types of set intervals I list above. Thank you!

Squirtle
  • 129
  • 8
  • I would like to also add that I wanted to try to post this question on the site recommended from the Isabelle website (https://isabelle.in.tum.de) namely Zulip Chat (https://isabelle.zulipchat.com) but it would not successfully load for me so I am curious if Zulip Chat is still operational or if it is possibly something on my end. – Squirtle Dec 16 '22 at 02:07
  • 1
    The Zulip chat works fine for me. – Manuel Eberl Dec 16 '22 at 09:12

1 Answers1

1

The answer to your question

In every ordered type you can write {a..b} for the closed interval from a to b. For the open/half-open variants there are {a<..b}, {a..<b}, {a<..<b}, {a..}, {..b}, {a<..}, and {..<b}.

These are defined in HOL.Set_Interval and there internal names are things like lessThan, atLeastAtMost, etc.

So in your case, you can simply write something like continuous_on {a..b} f.

It takes some time to understand how to do arguments about limits, continuity, etc. in a theorem prover efficiently. Don't be afraid to ask, either here or on the Zulip. You can of course always do things the hard way (with e.g. ε–δ reasoning) but once you become more proficient in using the library a lot of things become much easier. Which brings me to:

Addendum: Filters

Note however that to really reason about continuity in Isabelle in an idiomatic way you will have to understand filters, which are (among other things) a way to talk about ‘neighbourhoods of points’. There is the definition continuous which takes a function at a filter and can be used to say that a function is continuous at a given point with some conditions.

For instance, there are filters

  • nhds x, which describes the neighbourhoods of x (i.e. everything that is sufficiently close to x)
  • at x within A, which describes the pointed neighbourhood of x intersected with A – i.e. you approach x without every reaching it and while staying fully inside the set A
  • at x, which is simply at x within UNIV, i.e. the pointed neighbourhood of x without further restricitions
  • at_left x and at_right x for e.g. the real numbers, which are defined as at x within {..<x} and at x within {x<..}, i.e. the left and right neighbourhoods of x

Then you can write things like continuous (at x) F or continuous (at_right x) F. If I recall correctly, continuous_on A f is equivalent to ∀x∈A. continuous (at x within A) f.

Filters are also useful for many other related things, like limits, open/closed sets, uniform continuity, and derivatives.

This paper explains how filters are used in the Isabelle analysis library. It also has a short section about continuity.

Manuel Eberl
  • 7,858
  • 15
  • 24
  • Hi. For some reason this wants to convert reals to their integer part!? Example: Suppose we have a continuous function f on the interval [a,b] such that f(a)*f(b) < 0 then we know there should be a root. However, when I state this as: assumes a_less_than_b: "(a::real) < (b::real)" assumes continuous_f: "continuous_on {a..b} f" assumes opposite_signs: "f(a)*f(b)<0" shows "∃ (c::real). (f(c) = 0 ∧ a < c ∧ c < b)" I get the following goal: "∃c. f c = 0 ∧ real_of_int a < c ∧ c < real_of_int b" But "real_of_int" takes nats and ints and coerces them to reals! – Squirtle Jan 11 '23 at 23:32
  • Also if I just remove the continuity condition ("continuous_on {a..b} f") (which is obviously necessary for the proof) then my goal is just the "shows" statement. I'm curious as to why "continuous_on" seems to want integers. – Squirtle Jan 11 '23 at 23:34
  • I cannot reproduce that at all. My guess would be that you already have one of the variables `f`, `a`, `b` floating around in the context with an integer type. Most of your type annotations are also redundant, but what you *are* missing is that the result type of `f` has to be `real`. The easiest way is to add `fixes f :: "real ⇒ real"` to the beginning of your lemma. It can then be proven fairly easily using the theorems `IVT'` and `IVT2'` (the naming scheme for the intermediate value theorem is unfortunately somewhat annoying). – Manuel Eberl Jan 12 '23 at 09:05