(* ========================================================================= *)
(* Elementary topology in Euclidean space. *)
(* ========================================================================= *)
parse_as_infix ("open_in",(12,"right"));;
parse_as_infix ("closed_in",(12,"right"));;
let OPEN_IN_INTER = prove
(`!s t u. s
open_in u /\ t
open_in u ==> (s
INTER t)
open_in u`,
REPEAT GEN_TAC THEN REWRITE_TAC[
open_in;
IN_INTER] THEN MATCH_MP_TAC(TAUT
`(a /\ c ==> e) /\ (b /\ d ==> f) ==> (a /\ b) /\ (c /\ d) ==> e /\ f`) THEN
CONJ_TAC THENL [SET_TAC[]; ALL_TAC] THEN
REWRITE_TAC[
AND_FORALL_THM] THEN MATCH_MP_TAC
MONO_FORALL THEN
GEN_TAC THEN DISCH_THEN(fun
th -> STRIP_TAC THEN MP_TAC
th) THEN
ASM_REWRITE_TAC[] THEN DISCH_THEN(CONJUNCTS_THEN2
(X_CHOOSE_TAC `d1:real`) (X_CHOOSE_TAC `d2:real`)) THEN
MP_TAC(SPECL [`d1:real`; `d2:real`]
REAL_DOWN2) THEN
ASM_MESON_TAC[
REAL_LT_TRANS]);;
(* ------------------------------------------------------------------------- *)
(* The "universal" versions are what we use most of the time. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* Open balls. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* Basic "localization" results are handy for connectedness. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* These "transitivity" results are handy too. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* Connectedness. *)
(* ------------------------------------------------------------------------- *)
(* error in old file*)
(* ------------------------------------------------------------------------- *)
(* Limit points. *)
(* ------------------------------------------------------------------------- *)
parse_as_infix ("limit_point_of_fan",(12,"right"));;
(* ------------------------------------------------------------------------- *)
(* Interior of a set. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* Closure of a set. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* Frontier (aka boundary). *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* A variant of nets (slightly non-standard but good for our purposes). *)
(* ------------------------------------------------------------------------- *)
let net_tybij_fan = new_type_definition "net_fan" ("mk_net_fan","netord_fan")
(prove
(`?g:A->A->bool. !x y. (!z. g z x ==> g z y) \/ (!z. g z y ==> g z x)`,
EXISTS_TAC `\x:A y:A. F` THEN REWRITE_TAC[]));;
let NET_FAN = prove
(`!n x y. (!z. netord_fan n z x ==> netord_fan n z y) \/
(!z. netord_fan n z y ==> netord_fan n z x)`,
REWRITE_TAC[net_tybij_fan; ETA_AX]);;
let OLDNET_FAN = prove
(`!n x y. netord_fan n x x /\ netord_fan n y y
==> ?z. netord_fan n z z /\
!w. netord_fan n w z ==> netord_fan n w x /\ netord_fan n w y`,
(* ------------------------------------------------------------------------- *)
(* Common nets and the "within" modifier for nets. *)
(* ------------------------------------------------------------------------- *)
parse_as_infix("within_fan",(14,"right"));;
parse_as_infix("in_direction_fan",(14,"right"));;
(* ------------------------------------------------------------------------- *)
(* Prove that they are all nets. *)
(* ------------------------------------------------------------------------- *)
let NET_PROVE_FAN_TAC[def] =
REWRITE_TAC[GSYM FUN_EQ_THM; def] THEN
REWRITE_TAC[ETA_AX] THEN
ASM_SIMP_TAC[GSYM(CONJUNCT2 net_tybij_fan)];;
(* ------------------------------------------------------------------------- *)
(* Identify trivial limits, where we can't approach arbitrarily closely. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* Limits, defined as vacuously true when the limit is trivial. *)
(* ------------------------------------------------------------------------- *)
parse_as_infix("-->",(12,"right"));;
let lim_fan = new_definition
`(f --> l) net_fan <=>
trivial_limit_fan net_fan \/
!e. &0 < e ==> ?y. (?x. netord_fan(net_fan) x y) /\
!x. netord_fan(net_fan) x y ==> dist(f(x),l) < e`;;
(* ------------------------------------------------------------------------- *)
(* Show that they yield usual definitions in the various cases. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* The expected monotonicity property. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* Interrelations between restricted and unrestricted limits. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* Another limit point characterization. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* Basic arithmetical combining theorems for limits. *)
(* ------------------------------------------------------------------------- *)
let NET_DILEMMA_FAN = prove
(`!net. (?a. (?x. netord_fan net_fan x a) /\ (!x. netord_fan net_fan x a ==> P x)) /\
(?b. (?x. netord_fan net_fan x b) /\ (!x. netord_fan net_fan x b ==> Q x))
==> ?c. (?x. netord_fan net_fan x c) /\ (!x. netord_fan net_fan x c ==> P x /\ Q x)`,
let LIM_NEG_FAN = prove
(`!f l:real^N. (f --> l) net_fan ==> ((\x. --(f x)) --> --l) net_fan`,
REPEAT GEN_TAC THEN REWRITE_TAC[
lim_fan;
dist] THEN
REWRITE_TAC[VECTOR_ARITH `--x - --y = --(x - y:real^N)`;
NORM_NEG]);;
(* error in old file*)
let LIM_ADD_FAN = prove
(`!net_fan:(A)net_fan f g l m.
(f --> l) net_fan /\ (g --> m) net_fan ==> ((\x. f(x) + g(x)) --> l + m) net_fan`,
let LIM_SUB_FAN = prove
(`!net_fan:(A)net_fan f g l m.
(f --> l) net_fan /\ (g --> m) net_fan ==> ((\x. f(x) - g(x)) --> l - m) net_fan`,
(* ------------------------------------------------------------------------- *)
(* We need some non-triviality conditions on these two. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* Limit under bilinear function (surprisingly tedious, but important). *)
(* ------------------------------------------------------------------------- *)
(*let LIM_BILINEAR_FAN = prove
(;;
g`!net_fan:(A)net_fan (h:real^M->real^N->real^P) f g l m.
(f --> l) net_fan /\ (g --> m) net_fan /\ bilinear h
==> ((\x. h (f x) (g x)) --> (h l m)) net_fan`;;
,;;
e( REPEAT GEN_TAC THEN REWRITE_TAC[lim_fan] THEN
ASM_CASES_TAC `trivial_limit_fan (net_fan:(A)net_fan)` THEN
ASM_REWRITE_TAC[AND_FORALL_THM; CONJ_ASSOC] THEN
STRIP_TAC THEN X_GEN_TAC `e:real` THEN DISCH_TAC THEN
FIRST_ASSUM(X_CHOOSE_THEN `B:real` STRIP_ASSUME_TAC o MATCH_MP
BILINEAR_BOUNDED_POS) THEN
MP_TAC(ISPECL [`l:real^M`; `m:real^N`; `e / B`] NORM_BOUND_LEMMA_FAN) THEN
ASM_SIMP_TAC[REAL_LT_RDIV_EQ; REAL_MUL_LZERO] THEN
DISCH_THEN(X_CHOOSE_THEN `d:real` STRIP_ASSUME_TAC) THEN
FIRST_X_ASSUM(MP_TAC o SPEC `d:real`) THEN ASM_REWRITE_TAC[] THEN
DISCH_THEN(MP_TAC o MATCH_MP NET_DILEMMA_FAN));;
THEN
;;
e(REWRITE_TAC[MONO_EXISTS]);;
THEN;;
e(X_GEN_TAC `c:A`);;
MONO_AND;;
e(DISCH_TAC);;
e( MATCH_MP_TAC MONO_AND);;
THEN REWRITE_TAC[] THEN
MATCH_MP_TAC MONO_FORALL THEN X_GEN_TAC `a:A` THEN
MATCH_MP_TAC MONO_IMP THEN REWRITE_TAC[dist] THEN
DISCH_THEN(fun th -> FIRST_X_ASSUM(ASSUME_TAC o C MATCH_MP th)) THEN
ONCE_REWRITE_TAC[VECTOR_ARITH
`h a b - h c d :real^N = (h a b - h a d) + (h a d - h c d)`] THEN
MATCH_MP_TAC NORM_TRIANGLE_LT THEN
ASM_SIMP_TAC[GSYM BILINEAR_LSUB; GSYM BILINEAR_RSUB] THEN
FIRST_X_ASSUM(fun th ->
MP_TAC(SPECL [`(f:A->real^M) a`; `(g:A->real^N) a - m`] th) THEN
MP_TAC(SPECL [`(f:A->real^M) a - l`; `m:real^N`] th)) THEN
REPEAT(POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC);;
*)
(* ------------------------------------------------------------------------- *)
(* These are special for limits out of the same vector space. *)
(* ------------------------------------------------------------------------- *)
let LIM_AT_ZERO_FAN = prove
(`!f:real^M->real^N l a.
(f --> l) (
at_fan a) <=> ((\x. f(a + x)) --> l) (
at_fan(
vec 0))`,
REPEAT GEN_TAC THEN REWRITE_TAC[
LIM_AT_FAN] THEN
AP_TERM_TAC THEN ABS_TAC THEN
ASM_CASES_TAC `&0 < e` THEN ASM_REWRITE_TAC[] THEN
AP_TERM_TAC THEN ABS_TAC THEN
ASM_CASES_TAC `&0 < d` THEN ASM_REWRITE_TAC[] THEN
EQ_TAC THEN DISCH_TAC THEN X_GEN_TAC `x:real^M` THENL
[FIRST_X_ASSUM(MP_TAC o SPEC `a + x:real^M`) THEN
REWRITE_TAC[
dist;
VECTOR_ADD_SUB;
VECTOR_SUB_RZERO];
FIRST_X_ASSUM(MP_TAC o SPEC `x - a:real^M`) THEN
REWRITE_TAC[
dist;
VECTOR_SUB_RZERO;
VECTOR_SUB_ADD2]]);;
(* ------------------------------------------------------------------------- *)
(* It's also sometimes useful to extract the limit point from the net. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* Useful lemmas on closure and set of possible sequential limits. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* Closed balls. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* Boundedness. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* Compactness (the definition is the one based on convegent subsequences). *)
(* ------------------------------------------------------------------------- *)
let MONOTONE_BIGGER_FAN = prove
(`!r. (!m n. m < n ==> r(m) < r(n)) ==> !n:num. n <= r(n)`,
GEN_TAC THEN DISCH_TAC THEN INDUCT_TAC THEN
ASM_MESON_TAC[
LE_0; ARITH_RULE `n <= m /\ m < p ==> SUC n <= p`;
LT]);;
let MONOTONE_SUBSEQUENCE_FAN = prove
(`!s:num->real. ?r:num->num.
(!m n. m < n ==> r(m) < r(n)) /\
((!m n. m <= n ==> s(r(m)) <= s(r(n))) \/
(!m n. m <= n ==> s(r(n)) <= s(r(m))))`,
GEN_TAC THEN
ASM_CASES_TAC `!n:num. ?p. n < p /\ !m. p <= m ==> s(m) <= s(p)` THEN
POP_ASSUM MP_TAC THEN
REWRITE_TAC[
NOT_FORALL_THM;
NOT_EXISTS_THM; NOT_IMP; DE_MORGAN_THM] THEN
REWRITE_TAC[
RIGHT_OR_EXISTS_THM;
SKOLEM_THM;
REAL_NOT_LE;
REAL_NOT_LT] THENL
[ABBREV_TAC `N = 0`; DISCH_THEN(X_CHOOSE_THEN `N:num` MP_TAC)] THEN
DISCH_THEN(X_CHOOSE_THEN `next:num->num` STRIP_ASSUME_TAC) THEN
(MP_TAC o prove_recursive_functions_exist num_RECURSION)
`(r 0 =
next(SUC N)) /\ (!n. r(SUC n) =
next(r n))` THEN
MATCH_MP_TAC
MONO_EXISTS THEN GEN_TAC THEN STRIP_TAC THENL
[SUBGOAL_THEN `!m:num n:num. r n <= m ==> s(m) <= s(r n):real`
ASSUME_TAC THEN TRY CONJ_TAC THEN TRY DISJ2_TAC THEN
GEN_TAC THEN INDUCT_TAC THEN ASM_REWRITE_TAC[
LT;
LE] THEN
ASM_MESON_TAC[
REAL_LE_TRANS;
REAL_LE_REFL;
LT_IMP_LE;
LT_TRANS];
SUBGOAL_THEN `!n. N < (r:num->num) n` ASSUME_TAC THEN
TRY(CONJ_TAC THENL [GEN_TAC; DISJ1_TAC THEN GEN_TAC]) THEN
INDUCT_TAC THEN ASM_REWRITE_TAC[
LT;
LE] THEN
TRY STRIP_TAC THEN ASM_REWRITE_TAC[] THEN
ASM_MESON_TAC[
REAL_LT_REFL;
LT_LE;
LTE_TRANS;
REAL_LE_REFL;
REAL_LT_LE;
REAL_LE_TRANS;
LT]]);;
let CONVERGENT_BOUNDED_INCREASING_FAN = prove
(`!s:num->
real b. (!m n. m <= n ==> s m <= s n) /\ (!n. abs(s n) <= b)
==> ?l. !e. &0 < e ==> ?N. !n. N <= n ==> abs(s n - l) < e`,
REPEAT STRIP_TAC THEN
MP_TAC(SPEC `\x. ?n. (s:num->
real) n = x`
REAL_COMPLETE) THEN
REWRITE_TAC[] THEN ANTS_TAC THENL
[ASM_MESON_TAC[REAL_ARITH `abs(x) <= b ==> x <= b`]; ALL_TAC] THEN
MATCH_MP_TAC
MONO_EXISTS THEN X_GEN_TAC `l:real` THEN STRIP_TAC THEN
X_GEN_TAC `e:real` THEN STRIP_TAC THEN
FIRST_X_ASSUM(MP_TAC o SPEC `l - e`) THEN
ASM_MESON_TAC[REAL_ARITH `&0 < e ==> ~(l <= l - e)`;
REAL_ARITH `x <= y /\ y <= l /\ ~(x <= l - e) ==> abs(y - l) < e`]);;
let COMPACT_REAL_LEMMA_FAN = prove
(`!s b. (!n:num. abs(s n) <= b)
==> ?l r. (!m n:num. m < n ==> r(m) < r(n)) /\
!e. &0 < e ==> ?N. !n. N <= n ==> abs(s(r n) - l) < e`,
let COMPACT_LEMMA_FAN = prove
(`!s.
bounded_fan s /\ (!n. (x:num->real^N) n
IN s)
==> !d. d <=
dimindex(:N)
==> ?l:real^N r. (!m n. m < n ==> r m < (r:num->num) n) /\
!e. &0 < e
==> ?N. !n i. 1 <= i /\ i <= d
==> N <= n
==> abs(x(r n)$i - l$i) < e`,
GEN_TAC THEN REWRITE_TAC[
bounded_fan] THEN
DISCH_THEN(CONJUNCTS_THEN2 (X_CHOOSE_TAC `b:real`) ASSUME_TAC) THEN
INDUCT_TAC THENL
[REWRITE_TAC[ARITH_RULE `1 <= i /\ i <= 0 <=> F`;
CONJ_ASSOC] THEN
DISCH_TAC THEN EXISTS_TAC `\n:num. n` THEN REWRITE_TAC[];
ALL_TAC] THEN
DISCH_TAC THEN FIRST_X_ASSUM(MP_TAC o check (is_imp o concl)) THEN
ASM_SIMP_TAC[ARITH_RULE `SUC d <= n ==> d <= n`] THEN STRIP_TAC THEN
MP_TAC(SPECL [`\n:num. (x:num->real^N) (r n) $ (SUC d)`; `b:real`]
COMPACT_REAL_LEMMA_FAN) THEN
REWRITE_TAC[] THEN ANTS_TAC THENL
[ASM_MESON_TAC[
REAL_LE_TRANS;
COMPONENT_LE_NORM; ARITH_RULE `1 <= SUC n`];
ALL_TAC] THEN
DISCH_THEN(X_CHOOSE_THEN `y:real` (X_CHOOSE_THEN `s:num->num`
STRIP_ASSUME_TAC)) THEN
MAP_EVERY EXISTS_TAC
[`(
lambda k. if k = SUC d then y else (l:real^N)$k):real^N`;
`(r:num->num) o (s:num->num)`] THEN
ASM_SIMP_TAC[
o_THM] THEN X_GEN_TAC `e:real` THEN DISCH_TAC THEN
REPEAT(FIRST_ASSUM(C UNDISCH_THEN (MP_TAC o SPEC `e:real`) o concl)) THEN
ASM_REWRITE_TAC[] THEN DISCH_THEN(X_CHOOSE_TAC `N1:num`) THEN
DISCH_THEN(X_CHOOSE_TAC `N2:num`) THEN EXISTS_TAC `N1 + N2:num` THEN
FIRST_ASSUM(fun
th -> SIMP_TAC[
LAMBDA_BETA; MATCH_MP(ARITH_RULE
`SUC d <= n ==> !i. 1 <= i /\ i <= SUC d ==> 1 <= i /\ i <= n`)
th]) THEN
REWRITE_TAC[
LE] THEN REPEAT STRIP_TAC THEN
ASM_REWRITE_TAC[] THEN TRY COND_CASES_TAC THEN
ASM_MESON_TAC[
MONOTONE_BIGGER_FAN;
LE_TRANS;
ARITH_RULE `N1 + N2 <= n ==> N2 <= n:num /\ N1 <= n`;
ARITH_RULE `1 <= i /\ i <= d /\ SUC d <= n
==> ~(i = SUC d) /\ 1 <= SUC d /\ d <= n /\ i <= n`]);;
(* ------------------------------------------------------------------------- *)
(* Completeness. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* Total boundedness. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* Heine-Borel theorem (following Burkill & Burkill vol. 2) *)
(* ------------------------------------------------------------------------- *)
let HEINE_BOREL_LEMMA_FAN = prove
(`!s:real^N->bool.
compact_fan s
==> !t. s
SUBSET (
UNIONS t) /\ (!b. b
IN t ==> open_fan b)
==> ?e. &0 < e /\
!x. x
IN s ==> ?b. b
IN t /\
ball_fan(x,e)
SUBSET b`,
GEN_TAC THEN ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN
REWRITE_TAC[
NOT_FORALL_THM; NOT_IMP;
NOT_EXISTS_THM] THEN
DISCH_THEN(CHOOSE_THEN (CONJUNCTS_THEN2 ASSUME_TAC MP_TAC)) THEN
DISCH_THEN(MP_TAC o GEN `n:num` o SPEC `&1 / (&n + &1)`) THEN
SIMP_TAC[
REAL_LT_DIV;
REAL_LT_01; REAL_ARITH `x <= y ==> x < y + &1`;
FORALL_AND_THM;
REAL_POS;
NOT_FORALL_THM; NOT_IMP;
SKOLEM_THM;
compact_fan] THEN
MATCH_MP_TAC
MONO_EXISTS THEN GEN_TAC THEN REWRITE_TAC[
NOT_EXISTS_THM] THEN
DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) THEN ASM_REWRITE_TAC[] THEN
DISCH_TAC THEN MAP_EVERY X_GEN_TAC [`l:real^N`; `r:num->num`] THEN
STRIP_TAC THEN
SUBGOAL_THEN `?b:real^N->bool. l
IN b /\ b
IN t` STRIP_ASSUME_TAC THENL
[ASM_MESON_TAC[
SUBSET;
IN_UNIONS]; ALL_TAC] THEN
SUBGOAL_THEN `?e. &0 < e /\ !z:real^N.
dist(z,l) < e ==> z
IN b`
STRIP_ASSUME_TAC THENL [ASM_MESON_TAC[
open_def_fan]; ALL_TAC] THEN
FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I [
LIM_SEQUENTIALLY_FAN]) THEN
DISCH_THEN(MP_TAC o SPEC `e / &2`) THEN
SUBGOAL_THEN `&0 < e / &2` (fun
th ->
REWRITE_TAC[
th;
o_THM] THEN MP_TAC(GEN_REWRITE_RULE I [
REAL_ARCH_INV]
th))
THENL [ASM_REWRITE_TAC[
REAL_HALF]; ALL_TAC] THEN
DISCH_THEN(X_CHOOSE_THEN `N1:num` STRIP_ASSUME_TAC) THEN
DISCH_THEN(X_CHOOSE_THEN `N2:num` STRIP_ASSUME_TAC) THEN
FIRST_X_ASSUM(MP_TAC o SPECL
[`(r:num->num)(N1 + N2)`; `b:real^N->bool`]) THEN
ASM_REWRITE_TAC[
SUBSET] THEN X_GEN_TAC `x:real^N` THEN DISCH_TAC THEN
FIRST_X_ASSUM MATCH_MP_TAC THEN MATCH_MP_TAC
DIST_TRIANGLE_HALF_R THEN
EXISTS_TAC `(f:num->real^N)(r(N1 + N2:num))` THEN CONJ_TAC THENL
[ALL_TAC; FIRST_X_ASSUM MATCH_MP_TAC THEN ARITH_TAC] THEN
FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I [
IN_BALL_FAN]) THEN
MATCH_MP_TAC(REAL_ARITH `a <= b ==> x < a ==> x < b`) THEN
MATCH_MP_TAC
REAL_LE_TRANS THEN EXISTS_TAC `inv(&N1)` THEN
ASM_SIMP_TAC[
REAL_LT_IMP_LE] THEN REWRITE_TAC[
real_div; REAL_MUL_LID] THEN
MATCH_MP_TAC
REAL_LE_INV2 THEN
REWRITE_TAC[REAL_OF_NUM_ADD; REAL_OF_NUM_LE;
REAL_OF_NUM_LT] THEN
ASM_MESON_TAC[ARITH_RULE `(~(n = 0) ==> 0 < n)`;
LE_ADD;
MONOTONE_BIGGER_FAN;
LT_IMP_LE;
LE_TRANS]);;
(* ------------------------------------------------------------------------- *)
(* Bolzano-Weierstrass property. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* Complete the chain of compactness variants. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* Hence express everything as an equivalence. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* In particular, some common special cases. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* Finite intersection property. I could make it an equivalence in fact. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* Bounded closed nest property (proof does not use Heine-Borel). *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* Decreasing case does not even need compactness, just completeness. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* Strengthen it to the intersection actually being a singleton. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* Define continuity over a net to take in restrictions of the set. *)
(* ------------------------------------------------------------------------- *)
parse_as_infix ("continuous_fan",(12,"right"));;
(* ------------------------------------------------------------------------- *)
(* Derive the epsilon-delta forms, which we often use as "definitions" *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* For setwise continuity, just start from the epsilon-delta definitions. *)
(* ------------------------------------------------------------------------- *)
parse_as_infix ("continuous_on_fan",(12,"right"));;
parse_as_infix ("uniformly_continuous_on_fan",(12,"right"));;
(* ------------------------------------------------------------------------- *)
(* Some simple consequential lemmas. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* Characterization of various kinds of continuity in terms of sequences. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* Combination results for pointwise continuity. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* Same thing for setwise continuity. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* Same thing for uniform continuity, using sequential formulations. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* Identity function is continuous in every sense. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* Continuity of all kinds is preserved under composition. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* Continuity in terms of open preimages. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* Similarly in terms of closed sets. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* The "global" cases. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* Preservation of compactness and connectedness under continuous function. *)
(* ------------------------------------------------------------------------- *)
let COMPACT_CONTINUOUS_IMAGE_FAN = prove
(`!f:real^M->real^N s.
f
continuous_on_fan s /\
compact_fan s ==>
compact_fan(
IMAGE f s)`,
REPEAT GEN_TAC THEN REWRITE_TAC[
continuous_on_fan;
compact_fan] THEN
STRIP_TAC THEN X_GEN_TAC `y:num->real^N` THEN
REWRITE_TAC[
IN_IMAGE;
SKOLEM_THM;
FORALL_AND_THM] THEN
DISCH_THEN(X_CHOOSE_THEN `x:num->real^M` STRIP_ASSUME_TAC) THEN
FIRST_X_ASSUM(MP_TAC o SPEC `x:num->real^M`) THEN ASM_REWRITE_TAC[] THEN
ONCE_REWRITE_TAC[
SWAP_EXISTS_THM] THEN MATCH_MP_TAC
MONO_EXISTS THEN
X_GEN_TAC `r:num->num` THEN
DISCH_THEN(X_CHOOSE_THEN `l:real^M` STRIP_ASSUME_TAC) THEN
EXISTS_TAC `(f:real^M->real^N) l` THEN ASM_REWRITE_TAC[] THEN
CONJ_TAC THENL [ASM_MESON_TAC[]; ALL_TAC] THEN
REWRITE_TAC[
LIM_SEQUENTIALLY_FAN] THEN
FIRST_X_ASSUM(MP_TAC o SPEC `l:real^M`) THEN
ASM_REWRITE_TAC[] THEN MATCH_MP_TAC
MONO_FORALL THEN X_GEN_TAC `e:real` THEN
DISCH_THEN(fun
th -> DISCH_TAC THEN MP_TAC
th) THEN ASM_REWRITE_TAC[] THEN
DISCH_THEN(X_CHOOSE_THEN `d:real` STRIP_ASSUME_TAC) THEN
FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I [
LIM_SEQUENTIALLY_FAN]) THEN
DISCH_THEN(MP_TAC o SPEC `d:real`) THEN ASM_REWRITE_TAC[
o_THM] THEN
ASM_MESON_TAC[]);;
(* ------------------------------------------------------------------------- *)
(* Continuity implies uniform continuity on a compact domain. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* Continuity of inverse function on compact domain. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* Topological properties of linear functions. *)
(* ------------------------------------------------------------------------- *)
(*error in old file*)
(* ------------------------------------------------------------------------- *)
(* Topological stuff lifted from and dropped to R *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* Hence some handy theorems on distance, diameter etc. of/from a set. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* For *minimal* distance, we only need closure, not compactness. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* And so we have continuity of inverse. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* Preservation properties for pasted sets. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* Hence some useful properties follow quite easily. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* Hence we get the following. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* We can state this in terms of diameter of a set. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* Related results with closure as the conclusion. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* A cute way of denoting open and closed intervals using overloading. *)
(* ------------------------------------------------------------------------- *)
make_overloadable "interval_fan" `:A`;;
overload_interface("interval_fan",`open_interval_fan`);;
overload_interface("interval_fan",`closed_interval_fan`);;
(* ------------------------------------------------------------------------- *)
(* Some stuff for half-infinite intervals too; maybe I need a notation? *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* Closure of halfspaces and hyperplanes. *)
(* ------------------------------------------------------------------------- *)