Datasets:

Modalities:
Text
Languages:
English
Libraries:
Datasets
License:
File size: 6,642 Bytes
4365a98
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
(* ------------------------------------------------------------------------- *)
(* From Multivariate/misc.ml                                                 *)
(* ------------------------------------------------------------------------- *)

prioritize_real();;

let REAL_POW_LBOUND = prove
 (`!x n. &0 <= x ==> &1 + &n * x <= (&1 + x) pow n`,
  GEN_TAC THEN REWRITE_TAC[RIGHT_FORALL_IMP_THM] THEN DISCH_TAC THEN
  INDUCT_TAC THEN
  REWRITE_TAC[real_pow; REAL_MUL_LZERO; REAL_ADD_RID; REAL_LE_REFL] THEN
  REWRITE_TAC[GSYM REAL_OF_NUM_SUC] THEN
  MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `(&1 + x) * (&1 + &n * x)` THEN
  ASM_SIMP_TAC[REAL_LE_LMUL; REAL_ARITH `&0 <= x ==> &0 <= &1 + x`] THEN
  ASM_SIMP_TAC[REAL_LE_MUL; REAL_POS; REAL_ARITH
   `&1 + (n + &1) * x <= (&1 + x) * (&1 + n * x) <=> &0 <= n * x * x`]);;

let REAL_ARCH_POW = prove
 (`!x y. &1 < x ==> ?n. y < x pow n`,
  REPEAT STRIP_TAC THEN
  MP_TAC(SPEC `x - &1` REAL_ARCH) THEN ASM_REWRITE_TAC[REAL_SUB_LT] THEN
  DISCH_THEN(MP_TAC o SPEC `y:real`) THEN MATCH_MP_TAC MONO_EXISTS THEN
  X_GEN_TAC `n:num` THEN DISCH_TAC THEN MATCH_MP_TAC REAL_LTE_TRANS THEN
  EXISTS_TAC `&1 + &n * (x - &1)` THEN
  ASM_SIMP_TAC[REAL_ARITH `x < y ==> x < &1 + y`] THEN
  ASM_MESON_TAC[REAL_POW_LBOUND; REAL_SUB_ADD2; REAL_ARITH
    `&1 < x ==> &0 <= x - &1`]);;

let ABS_CASES = thm `;
  !x. x = &0 \/ &0 < abs(x)`;;

let LL =  REAL_ARITH `&1 < k ==> &0 < k`;;

(* ------------------------------------------------------------------------- *)
(* Miz3 solutions to IMO problem from ICMS 2006.                             *)
(* ------------------------------------------------------------------------- *)

horizon := 0;;

let IMO_1 = thm `;
  !k. &1 < k ==> &0 < k [LL] by REAL_ARITH;
  now
    let f g be real->real;
    let x be real;
    assume !x y. f (x + y) + f (x - y) = &2 * f x * g y [1];
    assume ~(!x. f x = &0) [2];
    assume !x. abs (f x) <= &1 [3];
    now
      let k be real;
      assume sup (IMAGE (\x. abs (f x)) (:real)) = k [4];
      ~(IMAGE (\x. abs (f x)) (:real) = {}) /\ (?b. !x. abs (f x) <= b) [5]
        by ASM SET_TAC[],-,3;
      now
        assume !x. abs (f x) <= k [6];
        assume !b. (!x. abs (f x) <= b) ==> k <= b [7];
        now
          let y be real;
          assume &1 < abs (g y) [8];
          !x. abs (f x) <= k / abs (g y) [9]
            by ASM_MESON_TAC[REAL_LE_RDIV_EQ; REAL_ABS_MUL; LL;
              REAL_ARITH (parse_term
                "u + v = &2 * z /\\ abs u <= k /\\ abs v <= k ==> abs z <= k")
             ],-,1,6;
          ~(k <= k / abs (g y))
            by TIMED_TAC 2
              (ASM_MESON_TAC[REAL_NOT_LE; REAL_LT_LDIV_EQ; REAL_LT_LMUL;
                 REAL_MUL_RID; LL; REAL_ARITH (parse_term
                  "~(z = &0) /\\ abs z <= k ==> &0 < k")
                ]),LL,2,6,8;
          (!x. abs (f x) <= k / abs (g y)) /\ ~(k <= k / abs (g y))
            by CONJ_TAC,-,9;
          ((!x. abs (f x) <= k / abs (g y)) ==> k <= k / abs (g y)) ==> F
            by SIMP_TAC[NOT_IMP; NOT_FORALL_THM],-;
          thus F by FIRST_X_ASSUM(MP_TAC o
            SPEC (parse_term "k / abs(g(y:real))")),-,7;
        end;
        ~(?y. &1 < abs (g y)) by STRIP_TAC,-;
        thus !y. abs (g y) <= &1
          by SIMP_TAC[GSYM REAL_NOT_LT; GSYM NOT_EXISTS_THM],-;
      end;
      (!x. abs (f x) <= k) /\ (!b. (!x. abs (f x) <= b) ==> k <= b)
      ==> (!y. abs (g y) <= &1) by STRIP_TAC,-;
      (~(IMAGE (\x. abs (f x)) (:real) = {}) /\ (?b. !x. abs (f x) <= b)
       ==> (!x. abs (f x) <= k) /\ (!b. (!x. abs (f x) <= b) ==> k <= b))
      ==> (!y. abs (g y) <= &1) by ANTS_TAC,-,5;
      (~(IMAGE (\x. abs (f x)) (:real) = {}) /\
       (?b. !x. x IN IMAGE (\x. abs (f x)) (:real) ==> x <= b)
       ==> (!x. x IN IMAGE (\x. abs (f x)) (:real)
                ==> x <= sup (IMAGE (\x. abs (f x)) (:real))) /\
           (!b. (!x. x IN IMAGE (\x. abs (f x)) (:real) ==> x <= b)
                ==> sup (IMAGE (\x. abs (f x)) (:real)) <= b))
      ==> (!y. abs (g y) <= &1)
        by ASM_SIMP_TAC[FORALL_IN_IMAGE; EXISTS_IN_IMAGE; IN_UNIV],-,4;
      thus !y. abs (g y) <= &1
        by MP_TAC(SPEC (parse_term "IMAGE (\\x. abs(f(x))) (:real)") SUP),-;
    end;
    !y. abs (g y) <= &1
      by ABBREV_TAC (parse_term "k = sup (IMAGE (\\x. abs(f(x))) (:real))"),-;
    thus abs (g x) <= &1
      by SPEC_TAC ((parse_term "x:real"),(parse_term "y:real")),-;
  end;
  thus !f g. (!x y. f(x + y) + f(x - y) = &2 * f(x) * g(y)) /\
             ~(!x. f(x) = &0) /\ (!x. abs(f(x)) <= &1)
             ==> !x. abs(g(x)) <= &1 by REPEAT STRIP_TAC,-`;;

horizon := 1;;

let IMO_2 = thm `;
  let f g be real->real;
  assume !x y. f (x + y) + f (x - y) = &2 * f x * g y [1];
  assume ~(!x. f x = &0) [2];
  assume !x. abs (f x) <= &1 [3];
  thus !x. abs (g x) <= &1
  proof set s = IMAGE (\x. abs (f x)) (:real);
    ~(s = {}) [4] by SET_TAC;
    !b. (!y. y IN s ==> y <= b) <=> (!x. abs (f x) <= b) by IN_IMAGE,IN_UNIV;
    set k = sup s;
    (!x. abs (f x) <= k) /\ !b. (!x. abs (f x) <= b) ==> k <= b [5] by 3,4,SUP;
    assume ~thesis;
    consider y such that &1 < abs (g y) [6] by REAL_NOT_LT;
    &0 < abs (g y) [7] by REAL_ARITH;
    !x. abs (f x) <= k / abs (g y) [8]
    proof let x be real;
      abs (f (x + y)) <= k /\ abs (f (x - y)) <= k /\
      f (x + y) + f (x - y) = &2 * f x * g y by 1,5;
      abs (f x * g y) <= k by REAL_ARITH;
    qed by 7,REAL_ABS_MUL,REAL_LE_RDIV_EQ;
    consider x such that &0 < abs (f x) /\ abs (f x) <= k by 2,5,ABS_CASES;
    &0 < k by REAL_ARITH;
    k / abs (g y) < k by 6,7,REAL_LT_LMUL,REAL_MUL_RID,REAL_LT_LDIV_EQ;
  qed by 5,8,REAL_NOT_LE`;;

let IMO_3 = thm `;
  let f g be real->real;
  assume !x y. f (x + y) + f (x - y) = &2 * f x * g y [1];
  assume ~(!x. f x = &0) [2];
  assume !x. abs (f x) <= &1 [3];
  thus !x. abs (g x) <= &1
  proof
    now [4] let y be real;
      !x. abs (f x * g y pow 0) <= &1 [5] by 3,real_pow,REAL_MUL_RID;
      now let l be num;
        assume !x. abs (f x * g y pow l) <= &1;
        let x be real;
        abs (f (x + y) * g y pow l) <= &1 /\
        abs (f (x - y) * g y pow l) <= &1;
        abs ((f (x + y) + f (x - y)) * g y pow l) <= &2 by REAL_ARITH;
        abs ((&2 * f x * g y) * g y pow l) <= &2 by 1;
        abs (f x * g y * g y pow l) <= &1 by REAL_ARITH;
        thus abs (f x * g y pow SUC l) <= &1 by real_pow,REAL_MUL_RID;
      end;
      thus !l x. abs (f x * g y pow l) <= &1 by INDUCT_TAC,5;
    end;
    !x y. ~(x = &0) /\ &1 < abs(y) ==> ?n. &1 < abs(y pow n * x)
      by SIMP_TAC,REAL_ABS_MUL,REAL_ABS_POW,GSYM REAL_LT_LDIV_EQ,
        GSYM REAL_ABS_NZ,REAL_ARCH_POW;
  qed by 2,4,REAL_NOT_LE,REAL_MUL_SYM`;;