(* Copyright 2012-2015 by Adam Petcher.				* * Use of this source code is governed by the license described	* * in the LICENSE file at the root of the source tree.		*)
(* A theory of limits of a sequence *)
Set Implicit Arguments.
Section Limit.
Variable A : Set.
Variable eq : A -> A -> Prop.
Hypothesis eq_dec : forall (a1 a2 : A),
{eq a1 a2} + {~eq a1 a2}.
Hypothesis eq_refl : forall (a : A),
eq a a.
Hypothesis eq_symm : forall a1 a2,
eq a1 a2 ->
eq a2 a1.
Variable distance : A -> A -> A.
Hypothesis distance_comm : forall a1 a2,
eq (distance a1 a2) (distance a2 a1).
Variable half : A -> A.
Variable zero : A.
Hypothesis half_nz : forall (a : A),
~eq a zero ->
~eq (half a) zero.
Hypothesis distance_eq_zero : forall (a1 a2 : A),
eq a1 a2 <->
eq (distance a1 a2) zero.
Hypothesis distance_eq_compat : forall a1 a2 a3 a4,
eq a1 a3 ->
eq a2 a4 ->
eq (distance a1 a2) (distance a3 a4).
Variable le : A -> A -> Prop.
Hypothesis le_eq : forall (a1 a2 : A),
eq a1 a2 ->
le a1 a2.
Hypothesis le_trans : forall (a1 a2 a3 : A),
le a1 a2 ->
le a2 a3 ->
le a1 a3.
(* all numbers positive *)
Hypothesis all_pos : forall (a : A),
le zero a.
Hypothesis le_impl_eq : forall (a1 a2 : A),
le a1 a2 ->
le a2 a1 ->
eq a1 a2.
Variable plus : A -> A -> A.
Variable plus_0_eq : forall (a1 a2 : A),
eq a2 zero ->
eq a1 (plus a1 a2).
Variable plus_le_compat : forall a1 a2 a3 a4,
le a1 a2 ->
le a3 a4 ->
le (plus a1 a3) (plus a2 a4).
Hypothesis triangle_inequality : forall (a1 a2 a3 : A),
le (distance a1 a2) (plus (distance a1 a3) (distance a3 a2)).
Hypothesis half_plus : forall (a : A),
eq (plus (half a) (half a)) a.
Hypothesis le_half : forall (a : A),
le a (half a) ->
eq a zero.

Theorem le_epsilon_zero : forall (a : A),
(forall (epsilon : A), ~eq epsilon zero -> le a epsilon) ->
eq a zero.