2 include "arithmetics/nat.ma".
3 include "arithmetics/log.ma".
4 (* include "arithmetics/ord.ma". *)
5 include "arithmetics/bigops.ma".
6 include "arithmetics/bounded_quantifiers.ma".
7 include "arithmetics/pidgeon_hole.ma".
8 include "basics/sets.ma".
9 include "basics/types.ma".
11 (************************************ MAX *************************************)
12 notation "Max_{ ident i < n | p } f"
14 for @{'bigop $n max 0 (λ${ident i}. $p) (λ${ident i}. $f)}.
16 notation "Max_{ ident i < n } f"
18 for @{'bigop $n max 0 (λ${ident i}.true) (λ${ident i}. $f)}.
20 notation "Max_{ ident j ∈ [a,b[ } f"
22 for @{'bigop ($b-$a) max 0 (λ${ident j}.((λ${ident j}.true) (${ident j}+$a)))
23 (λ${ident j}.((λ${ident j}.$f)(${ident j}+$a)))}.
25 notation "Max_{ ident j ∈ [a,b[ | p } f"
27 for @{'bigop ($b-$a) max 0 (λ${ident j}.((λ${ident j}.$p) (${ident j}+$a)))
28 (λ${ident j}.((λ${ident j}.$f)(${ident j}+$a)))}.
30 lemma Max_assoc: ∀a,b,c. max (max a b) c = max a (max b c).
31 #a #b #c normalize cases (true_or_false (leb a b)) #leab >leab normalize
32 [cases (true_or_false (leb b c )) #lebc >lebc normalize
33 [>(le_to_leb_true a c) // @(transitive_le ? b) @leb_true_to_le //
36 |cases (true_or_false (leb b c )) #lebc >lebc normalize //
37 >leab normalize >(not_le_to_leb_false a c) // @lt_to_not_le
38 @(transitive_lt ? b) @not_le_to_lt @leb_false_to_not_le //
42 lemma Max0 : ∀n. max 0 n = n.
45 lemma Max0r : ∀n. max n 0 = n.
46 #n >commutative_max //
49 alias id "max" = "cic:/matita/arithmetics/nat/max#def:2".
50 alias id "mk_Aop" = "cic:/matita/arithmetics/bigops/Aop#con:0:1:2".
52 mk_Aop nat 0 max Max0 Max0r (λa,b,c.sym_eq … (Max_assoc a b c)).
54 definition MaxAC ≝ mk_ACop nat 0 MaxA commutative_max.
56 lemma le_Max: ∀f,p,n,a. a < n → p a = true →
57 f a ≤ Max_{i < n | p i}(f i).
59 >(bigop_diff p ? 0 MaxAC f a n) // @(le_maxl … (le_n ?))
62 lemma Max_le: ∀f,p,n,b.
63 (∀a.a < n → p a = true → f a ≤ b) → Max_{i < n | p i}(f i) ≤ b.
64 #f #p #n elim n #b #H //
65 #b0 #H1 cases (true_or_false (p b)) #Hb
66 [>bigop_Strue [2:@Hb] @to_max [@H1 // | @H #a #ltab #pa @H1 // @le_S //]
67 |>bigop_Sfalse [2:@Hb] @H #a #ltab #pa @H1 // @le_S //
71 (******************************** big O notation ******************************)
73 (* O f g means g ∈ O(f) *)
74 definition O: relation (nat→nat) ≝
75 λf,g. ∃c.∃n0.∀n. n0 ≤ n → g n ≤ c* (f n).
77 lemma O_refl: ∀s. O s s.
78 #s %{1} %{0} #n #_ >commutative_times <times_n_1 @le_n qed.
80 lemma O_trans: ∀s1,s2,s3. O s2 s1 → O s3 s2 → O s3 s1.
81 #s1 #s2 #s3 * #c1 * #n1 #H1 * #c2 * # n2 #H2 %{(c1*c2)}
82 %{(max n1 n2)} #n #Hmax
83 @(transitive_le … (H1 ??)) [@(le_maxl … Hmax)]
84 >associative_times @le_times [//|@H2 @(le_maxr … Hmax)]
87 lemma sub_O_to_O: ∀s1,s2. O s1 ⊆ O s2 → O s2 s1.
90 lemma O_to_sub_O: ∀s1,s2. O s2 s1 → O s1 ⊆ O s2.
91 #s1 #s2 #H #g #Hg @(O_trans … H) // qed.
93 definition sum_f ≝ λf,g:nat→nat.λn.f n + g n.
94 interpretation "function sum" 'plus f g = (sum_f f g).
96 lemma O_plus: ∀f,g,s. O s f → O s g → O s (f+g).
97 #f #g #s * #cf * #nf #Hf * #cg * #ng #Hg
98 %{(cf+cg)} %{(max nf ng)} #n #Hmax normalize
99 >distributive_times_plus_r @le_plus
100 [@Hf @(le_maxl … Hmax) |@Hg @(le_maxr … Hmax) ]
103 lemma O_plus_l: ∀f,s1,s2. O s1 f → O (s1+s2) f.
104 #f #s1 #s2 * #c * #a #Os1f %{c} %{a} #n #lean
105 @(transitive_le … (Os1f n lean)) @le_times //
108 lemma O_plus_r: ∀f,s1,s2. O s2 f → O (s1+s2) f.
109 #f #s1 #s2 * #c * #a #Os1f %{c} %{a} #n #lean
110 @(transitive_le … (Os1f n lean)) @le_times //
113 lemma O_absorbl: ∀f,g,s. O s f → O f g → O s (g+f).
114 #f #g #s #Osf #Ofg @(O_plus … Osf) @(O_trans … Osf) //
117 lemma O_absorbr: ∀f,g,s. O s f → O f g → O s (f+g).
118 #f #g #s #Osf #Ofg @(O_plus … Osf) @(O_trans … Osf) //
122 lemma O_ff: ∀f,s. O s f → O s (f+f).
126 lemma O_ext2: ∀f,g,s. O s f → (∀x.f x = g x) → O s g.
127 #f #g #s * #c * #a #Osf #eqfg %{c} %{a} #n #lean <eqfg @Osf //
131 definition not_O ≝ λf,g.∀c,n0.∃n. n0 ≤ n ∧ c* (f n) < g n .
133 (* this is the only classical result *)
134 axiom not_O_def: ∀f,g. ¬ O f g → not_O f g.
136 (******************************* small O notation *****************************)
138 (* o f g means g ∈ o(f) *)
139 definition o: relation (nat→nat) ≝
140 λf,g.∀c.∃n0.∀n. n0 ≤ n → c * (g n) < f n.
142 lemma o_irrefl: ∀s. ¬ o s s.
143 #s % #oss cases (oss 1) #n0 #H @(absurd ? (le_n (s n0)))
144 @lt_to_not_le >(times_n_1 (s n0)) in ⊢ (?%?); >commutative_times @H //
147 lemma o_trans: ∀s1,s2,s3. o s2 s1 → o s3 s2 → o s3 s1.
148 #s1 #s2 #s3 #H1 #H2 #c cases (H1 c) #n1 -H1 #H1 cases (H2 1) #n2 -H2 #H2
149 %{(max n1 n2)} #n #Hmax
150 @(transitive_lt … (H1 ??)) [@(le_maxl … Hmax)]
151 >(times_n_1 (s2 n)) in ⊢ (?%?); >commutative_times @H2 @(le_maxr … Hmax)
155 (*********************************** pairing **********************************)
157 axiom pair: nat →nat →nat.
158 axiom fst : nat → nat.
159 axiom snd : nat → nat.
160 axiom fst_pair: ∀a,b. fst (pair a b) = a.
161 axiom snd_pair: ∀a,b. snd (pair a b) = b.
163 interpretation "abstract pair" 'pair f g = (pair f g).
165 (************************ basic complexity notions ****************************)
167 (* u is the deterministic configuration relation of the universal machine (one
170 axiom u: nat → option nat.
175 | S m ⇒ match u c with
176 [ None ⇒ Some ? c (* halting case *)
181 lemma halt_U: ∀i,n,y. u i = None ? → U i n = Some ? y → y = i.
183 [normalize #H1 destruct |#m normalize >H normalize #H1 destruct //]
186 lemma Some_to_halt: ∀n,i,y. U i n = Some ? y → u y = None ? .
188 [#i #y normalize #H destruct (H)
189 |#m #Hind #i #y normalize
190 cut (u i = None ? ∨ ∃c. u i = Some ? c)
191 [cases (u i) [/2/ | #c %2 /2/ ]]
192 *[#H >H normalize #H1 destruct (H1) // |* #c #H >H normalize @Hind ]
196 axiom U: nat → nat → nat → option nat.
198 lemma monotonici_U: ∀y,n,m,i.
199 U i m = Some ? y → U i (n+m) = Some ? y.
201 [#i normalize #H destruct
202 |#p #Hind #i <plus_n_Sm normalize
203 cut (u i = None ? ∨ ∃c. u i = Some ? c)
204 [cases (u i) [/2/ | #c %2 /2/ ]]
205 *[#H1 >H1 normalize // |* #c #H >H normalize #H1 @Hind //]
209 axiom monotonic_U: ∀i,x,n,m,y.n ≤m →
210 U i x n = Some ? y → U i x m = Some ? y.
211 (* #i #n #m #y #lenm #H >(plus_minus_m_m m n) // @monotonici_U //
214 (* axiom U: nat → nat → option nat. *)
215 (* axiom monotonic_U: ∀i,n,m,y.n ≤m →
216 U i n = Some ? y → U i m = Some ? y. *)
218 lemma unique_U: ∀i,x,n,m,yn,ym.
219 U i x n = Some ? yn → U i x m = Some ? ym → yn = ym.
220 #i #x #n #m #yn #ym #Hn #Hm cases (decidable_le n m)
221 [#lenm lapply (monotonic_U … lenm Hn) >Hm #HS destruct (HS) //
222 |#ltmn lapply (monotonic_U … n … Hm) [@lt_to_le @not_le_to_lt //]
223 >Hn #HS destruct (HS) //
227 definition code_for ≝ λf,i.∀x.
228 ∃n.∀m. n ≤ m → U i x m = f x.
230 definition terminate ≝ λi,x,r. ∃y. U i x r = Some ? y.
231 notation "[i,x] ↓ r" with precedence 60 for @{terminate $i $x $r}.
233 definition lang ≝ λi,x.∃r,y. U i x r = Some ? y ∧ 0 < y.
235 lemma lang_cf :∀f,i,x. code_for f i →
236 lang i x ↔ ∃y.f x = Some ? y ∧ 0 < y.
237 #f #i #x normalize #H %
238 [* #n * #y * #H1 #posy %{y} % //
239 cases (H x) -H #m #H <(H (max n m)) [2:@(le_maxr … n) //]
240 @(monotonic_U … H1) @(le_maxl … m) //
241 |cases (H x) -H #m #Hm * #y #Hy %{m} %{y} >Hm //
245 (******************************* complexity classes ***************************)
247 axiom size: nat → nat.
248 axiom of_size: nat → nat.
250 interpretation "size" 'card n = (size n).
252 axiom size_of_size: ∀n. |of_size n| = n.
253 axiom monotonic_size: monotonic ? le size.
255 axiom of_size_max: ∀i,n. |i| = n → i ≤ of_size n.
257 axiom size_fst : ∀n. |fst n| ≤ |n|.
259 definition size_f ≝ λf,n.Max_{i < S (of_size n) | eqb (|i|) n}|(f i)|.
261 lemma size_f_def: ∀f,n. size_f f n =
262 Max_{i < S (of_size n) | eqb (|i|) n}|(f i)|.
266 definition Max_const : ∀f,p,n,a. a < n → p a →
268 Max_{i < n | p n}(f n) = *)
270 lemma size_f_size : ∀f,n. size_f (f ∘ size) n = |(f n)|.
271 #f #n @le_to_le_to_eq
272 [@Max_le #a #lta #Ha normalize >(eqb_true_to_eq … Ha) //
273 |<(size_of_size n) in ⊢ (?%?); >size_f_def
274 @(le_Max (λi.|f (|i|)|) ? (S (of_size n)) (of_size n) ??)
275 [@le_S_S // | @eq_to_eqb_true //]
279 lemma size_f_id : ∀n. size_f (λx.x) n = n.
281 [@Max_le #a #lta #Ha >(eqb_true_to_eq … Ha) //
282 |<(size_of_size n) in ⊢ (?%?); >size_f_def
283 @(le_Max (λi.|i|) ? (S (of_size n)) (of_size n) ??)
284 [@le_S_S // | @eq_to_eqb_true //]
288 lemma size_f_fst : ∀n. size_f fst n ≤ n.
289 #n @Max_le #a #lta #Ha <(eqb_true_to_eq … Ha) //
292 (* definition def ≝ λf:nat → option nat.λx.∃y. f x = Some ? y.*)
294 (* C s i means that the complexity of i is O(s) *)
296 definition C ≝ λs,i.∃c.∃a.∀x.a ≤ |x| → ∃y.
297 U i x (c*(s(|x|))) = Some ? y.
299 definition CF ≝ λs,f.∃i.code_for f i ∧ C s i.
301 lemma ext_CF : ∀f,g,s. (∀n. f n = g n) → CF s f → CF s g.
302 #f #g #s #Hext * #i * #Hcode #HC %{i} %
303 [#x cases (Hcode x) #a #H %{a} <Hext @H | //]
306 lemma monotonic_CF: ∀s1,s2,f. O s2 s1 → CF s1 f → CF s2 f.
307 #s1 #s2 #f * #c1 * #a #H * #i * #Hcodef #HCs1 %{i} % //
308 cases HCs1 #c2 * #b #H2 %{(c2*c1)} %{(max a b)}
309 #x #Hmax cases (H2 x ?) [2:@(le_maxr … Hmax)] #y #Hy
310 %{y} @(monotonic_U …Hy) >associative_times @le_times // @H @(le_maxl … Hmax)
313 (************************** The diagonal language *****************************)
315 (* the diagonal language used for the hierarchy theorem *)
317 definition diag ≝ λs,i.
318 U (fst i) i (s (|i|)) = Some ? 0.
320 lemma equiv_diag: ∀s,i.
321 diag s i ↔ [fst i,i] ↓ s (|i|) ∧ ¬lang (fst i) i.
323 [whd in ⊢ (%→?); #H % [%{0} //] % * #x * #y *
324 #H1 #Hy cut (0 = y) [@(unique_U … H H1)] #eqy /2/
326 #y0 #H * #H1 @False_ind @H1 -H1 whd %{(s (|i|))} %{(S y0)} % //
330 (* Let us define the characteristic function diag_cf for diag, and prove
333 definition diag_cf ≝ λs,i.
334 match U (fst i) i (s (|i|)) with
336 | Some y ⇒ if (eqb y 0) then (Some ? 1) else (Some ? 0)].
338 lemma diag_cf_OK: ∀s,x. diag s x ↔ ∃y.diag_cf s x = Some ? y ∧ 0 < y.
340 [whd in ⊢ (%→?); #H %{1} % // whd in ⊢ (??%?); >H //
341 |* #y * whd in ⊢ (??%?→?→%);
342 cases (U (fst x) x (s (|x|))) normalize
344 |#x cases (true_or_false (eqb x 0)) #Hx >Hx
345 [>(eqb_true_to_eq … Hx) //
346 |normalize #H destruct #H @False_ind @(absurd ? H) @lt_to_not_le //
352 lemma diag_spec: ∀s,i. code_for (diag_cf s) i → ∀x. lang i x ↔ diag s x.
353 #s #i #Hcode #x @(iff_trans … (lang_cf … Hcode)) @iff_sym @diag_cf_OK
356 (******************************************************************************)
358 lemma absurd1: ∀P. iff P (¬ P) →False.
359 #P * #H1 #H2 cut (¬P) [% #H2 @(absurd … H2) @H1 //]
360 #H3 @(absurd ?? H3) @H2 @H3
363 (* axiom weak_pad : ∀a,∃a0.∀n. a0 < n → ∃b. |〈a,b〉| = n. *)
364 lemma weak_pad1 :∀n,a.∃b. n ≤ 〈a,b〉.
366 cut (∀i.decidable (〈a,i〉 < n))
368 #Hdec cases(decidable_forall (λb. 〈a,b〉 < n) Hdec n)
369 [#H cut (∀i. i < n → ∃b. b < n ∧ 〈a,b〉 = i)
370 [@(injective_to_exists … H) //]
371 #Hcut %{n} @not_lt_to_le % #Han
372 lapply(Hcut ? Han) * #x * #Hx #Hx2
373 cut (x = n) [//] #Hxn >Hxn in Hx; /2 by absurd/
374 |#H lapply(not_forall_to_exists … Hdec H)
375 * #b * #H1 #H2 %{b} @not_lt_to_le @H2
379 lemma pad : ∀n,a. ∃b. n ≤ |〈a,b〉|.
380 #n #a cases (weak_pad1 (of_size n) a) #b #Hb
381 %{b} <(size_of_size n) @monotonic_size //
384 lemma o_to_ex: ∀s1,s2. o s1 s2 → ∀i. C s2 i →
385 ∃b.[i, 〈i,b〉] ↓ s1 (|〈i,b〉|).
386 #s1 #s2 #H #i * #c * #x0 #H1
387 cases (H c) #n0 #H2 cases (pad (max x0 n0) i) #b #Hmax
388 %{b} cases (H1 〈i,b〉 ?)
389 [#z #H3 %{z} @(monotonic_U … H3) @lt_to_le @H2
395 lemma diag1_not_s1: ∀s1,s2. o s1 s2 → ¬ CF s2 (diag_cf s1).
396 #s1 #s2 #H1 % * #i * #Hcode_i #Hs2_i
397 cases (o_to_ex … H1 ? Hs2_i) #b #H2
398 lapply (diag_spec … Hcode_i) #H3
399 @(absurd1 (lang i 〈i,b〉))
400 @(iff_trans … (H3 〈i,b〉))
401 @(iff_trans … (equiv_diag …)) >fst_pair
402 %[* #_ // |#H6 % // ]
405 (******************************************************************************)
407 definition to_Some ≝ λf.λx:nat. Some nat (f x).
409 definition deopt ≝ λn. match n with
413 definition opt_comp ≝ λf,g:nat → option nat. λx.
418 (* axiom CFU: ∀h,g,s. CF s (to_Some h) → CF s (to_Some (of_size ∘ g)) →
419 CF (Slow s) (λx.U (h x) (g x)). *)
421 axiom sU2: nat → nat → nat.
422 axiom sU: nat → nat → nat → nat.
424 (* axiom CFU: CF sU (λx.U (fst x) (snd x)). *)
426 axiom CFU_new: ∀h,g,f,s.
427 CF s (to_Some h) → CF s (to_Some g) → CF s (to_Some f) →
428 O s (λx. sU (size_f h x) (size_f g x) (size_f f x)) →
429 CF s (λx.U (h x) (g x) (|f x|)).
431 lemma CFU: ∀h,g,f,s1,s2,s3.
432 CF s1 (to_Some h) → CF s2 (to_Some g) → CF s3 (to_Some f) →
433 CF (λx. s1 x + s2 x + s3 x + sU (size_f h x) (size_f g x) (size_f f x))
434 (λx.U (h x) (g x) (|f x|)).
435 #h #g #f #s1 #s2 #s3 #Hh #Hg #Hf @CFU_new
436 [@(monotonic_CF … Hh) @O_plus_l @O_plus_l @O_plus_l //
437 |@(monotonic_CF … Hg) @O_plus_l @O_plus_l @O_plus_r //
438 |@(monotonic_CF … Hf) @O_plus_l @O_plus_r //
443 axiom monotonic_sU: ∀a1,a2,b1,b2,c1,c2. a1 ≤ a2 → b1 ≤ b2 → c1 ≤c2 →
444 sU a1 b1 c1 ≤ sU a2 b2 c2.
446 axiom superlinear_sU: ∀i,x,r. r ≤ sU i x r.
448 definition sU_space ≝ λi,x,r.i+x+r.
449 definition sU_time ≝ λi,x,r.i+x+(i^2)*r*(log 2 r).
452 axiom CF_comp: ∀f,g,s1, s2. CF s1 f → CF s2 g →
453 CF (λx.s2 x + s1 (size (deopt (g x)))) (opt_comp f g).
455 (* axiom CF_comp: ∀f,g,s1, s2. CF s1 f → CF s2 g →
456 CF (s1 ∘ (λx. size (deopt (g x)))) (opt_comp f g). *)
458 axiom CF_comp_strong: ∀f,g,s1,s2. CF s1 f → CF s2 g →
459 CF (s1 ∘ s2) (opt_comp f g). *)
461 definition IF ≝ λb,f,g:nat →option nat. λx.
464 |Some n ⇒ if (eqb n 0) then f x else g x].
466 axiom IF_CF_new: ∀b,f,g,s. CF s b → CF s f → CF s g → CF s (IF b f g).
468 lemma IF_CF: ∀b,f,g,sb,sf,sg. CF sb b → CF sf f → CF sg g →
469 CF (λn. sb n + sf n + sg n) (IF b f g).
470 #b #f #g #sb #sf #sg #Hb #Hf #Hg @IF_CF_new
471 [@(monotonic_CF … Hb) @O_plus_l @O_plus_l //
472 |@(monotonic_CF … Hf) @O_plus_l @O_plus_r //
473 |@(monotonic_CF … Hg) @O_plus_r //
477 lemma diag_cf_def : ∀s.∀i.
479 IF (λi.U (fst i) i (|of_size (s (|i|))|)) (λi.Some ? 1) (λi.Some ? 0) i.
480 #s #i normalize >size_of_size // qed.
483 axiom CF_pair: ∀f,g,s. CF s (λx.Some ? (f x)) → CF s (λx.Some ? (g x)) →
484 CF s (λx.Some ? (pair (f x) (g x))).
486 axiom CF_fst: ∀f,s. CF s (λx.Some ? (f x)) → CF s (λx.Some ? (fst (f x))).
488 definition minimal ≝ λs. CF s (λn. Some ? n) ∧ ∀c. CF s (λn. Some ? c).
492 axiom le_snd: ∀n. |snd n| ≤ |n|.
493 axiom daemon: ∀P:Prop.P. *)
495 definition constructible ≝ λs. CF s (λx.Some ? (of_size (s (|x|)))).
497 lemma diag_s: ∀s. minimal s → constructible s →
498 CF (λx.sU x x (s x)) (diag_cf s).
499 #s * #Hs_id #Hs_c #Hs_constr
500 cut (O (λx:ℕ.sU x x (s x)) s) [%{1} %{0} #n //]
501 #O_sU_s @ext_CF [2: #n @sym_eq @diag_cf_def | skip]
502 @IF_CF_new [2,3:@(monotonic_CF … (Hs_c ?)) // ]
504 [@CF_fst @(monotonic_CF … Hs_id) //
505 |@(monotonic_CF … Hs_id) //
506 |@(monotonic_CF … Hs_constr) //
507 |%{1} %{0} #n #_ >commutative_times <times_n_1
508 @monotonic_sU // >size_f_size >size_of_size //
513 lemma diag_s: ∀s. minimal s → constructible s →
514 CF (λx.s x + sU x x (s x)) (diag_cf s).
515 #s * #Hs_id #Hs_c #Hs_constr
516 @ext_CF [2: #n @sym_eq @diag_cf_def | skip]
517 @IF_CF_new [2,3:@(monotonic_CF … (Hs_c ?)) @O_plus_l //]
519 [@CF_fst @(monotonic_CF … Hs_id) @O_plus_l //
520 |@(monotonic_CF … Hs_id) @O_plus_l //
521 |@(monotonic_CF … Hs_constr) @O_plus_l //
522 |@O_plus_r %{1} %{0} #n #_ >commutative_times <times_n_1
523 @monotonic_sU // >size_f_size >size_of_size //
527 (* proof with old axioms
528 lemma diag_s: ∀s. minimal s → constructible s →
529 CF (λx.s x + sU x x (s x)) (diag_cf s).
530 #s * #Hs_id #Hs_c #Hs_constr
531 @ext_CF [2: #n @sym_eq @diag_cf_def | skip]
532 @(monotonic_CF ???? (IF_CF (λi:ℕ.U (pair (fst i) i) (|of_size (s (|i|))|))
533 … (λi.s i + s i + s i + (sU (size_f fst i) (size_f (λi.i) i) (size_f (λi.of_size (s (|i|))) i))) … (Hs_c 1) (Hs_c 0) … ))
534 [2: @CFU [@CF_fst // | // |@Hs_constr]
535 |@(O_ext2 (λn:ℕ.s n+sU (size_f fst n) n (s n) + (s n+s n+s n+s n)))
536 [2: #i >size_f_size >size_of_size >size_f_id //]
538 [%{1} %{0} #n #_ >commutative_times <times_n_1 @le_plus //
540 |@O_plus_l @(O_plus … (O_refl s)) @(O_plus … (O_refl s))
541 @(O_plus … (O_refl s)) //
546 (*************************** The hierachy theorem *****************************)
549 theorem hierarchy_theorem_right: ∀s1,s2:nat→nat.
550 O s1 idN → constructible s1 →
551 not_O s2 s1 → ¬ CF s1 ⊆ CF s2.
552 #s1 #s2 #Hs1 #monos1 #H % #H1
553 @(absurd … (CF s2 (diag_cf s1)))
554 [@H1 @diag_s // |@(diag1_not_s1 … H)]
558 theorem hierarchy_theorem_left: ∀s1,s2:nat→nat.
559 O(s1) ⊆ O(s2) → CF s1 ⊆ CF s2.
560 #s1 #s2 #HO #f * #i * #Hcode * #c * #a #Hs1_i %{i} % //
561 cases (sub_O_to_O … HO) -HO #c1 * #b #Hs1s2
562 %{(c*c1)} %{(max a b)} #x #lemax
563 cases (Hs1_i x ?) [2: @(le_maxl …lemax)]
564 #y #Hy %{y} @(monotonic_U … Hy) >associative_times
565 @le_times // @Hs1s2 @(le_maxr … lemax)