1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| The HELM team. *)
8 (* ||A|| http://helm.cs.unibo.it *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU General Public License Version 2 *)
13 (**************************************************************************)
15 include "static_2/syntax/sh_props.ma".
16 include "static_2/syntax/sd.ma".
18 (* SORT DEGREE **************************************************************)
20 (* Basic_2A1: includes: deg_SO_pos *)
21 inductive deg_SO (h) (s) (s0): predicate nat ≝
22 | deg_SO_succ : ∀n. (next h)^n s0 = s → deg_SO h s s0 (↑n)
23 | deg_SO_zero: (∀n. (next h)^n s0 = s → ⊥) → deg_SO h s s0 0
26 fact deg_SO_inv_succ_aux (h) (s) (s0):
27 ∀n0. deg_SO h s s0 n0 → ∀n. n0 = ↑n → (next h)^n s0 = s.
29 [ #n #Hn #x #H destruct //
34 (* Basic_2A1: was: deg_SO_inv_pos *)
35 lemma deg_SO_inv_succ (h) (s) (s0):
36 ∀n. deg_SO h s s0 (↑n) → (next h)^n s0 = s.
37 /2 width=3 by deg_SO_inv_succ_aux/ qed-.
39 lemma deg_SO_refl (h) (s): deg_SO h s s 1.
40 #h #s @(deg_SO_succ … 0 ?) //
43 definition sd_SO (h) (s): sd ≝ mk_sd (deg_SO h s).
45 lemma sd_SO_props (h) (s): sh_decidable h → sh_acyclic h →
46 sd_props h (sd_SO h s).
50 elim (nexts_dec … Hhd s0 s) -Hhd
51 [ * /3 width=2 by deg_SO_succ, ex_intro/
52 | /5 width=2 by deg_SO_zero, ex_intro/
54 | #s0 #d1 #d2 * [ #n1 ] #H1 * [1,3: #n2 ] #H2
56 lapply (nexts_inj … Hha … H) -H #H destruct //
57 | elim H1 /2 width=2 by ex_intro/
58 | elim H2 /2 width=2 by ex_intro/
62 [ #n #H destruct cases n -n normalize
63 [ @deg_SO_zero #n >iter_n_Sm #H
64 lapply (nexts_inj … Hha … (↑n) 0 H) -H #H destruct
65 | #n @deg_SO_succ >iter_n_Sm //
67 | #H0 @deg_SO_zero #n >iter_n_Sm #H destruct
73 rec definition sd_d (h:?) (s:?) (d:?) on d: sd ≝
78 | _ ⇒ sd_d h (next h s) d
82 lemma sd_d_props (h) (s) (d): sh_decidable h → sh_acyclic h →
83 sd_props h (sd_d h s d).
85 #d elim d -d /2 width=1 by sd_SO_props/
88 (* Properties with sd_d *****************************************************)
91 ∀s,d. sd_d h s (↑↑d) = sd_d h (⫯[h]s) (↑d).
94 lemma sd_d_correct (h): sh_decidable h → sh_acyclic h →
95 ∀s,d. deg (sd_d h s d) s d.
96 #h #Hhd #Hha @pull_2 #d elim d -d [ // ]
97 #d elim d -d /3 width=3 by deg_inv_pred, sd_d_props/