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. ⇡*[h,n]s0 = s → deg_SO h s s0 (↑n)
23 | deg_SO_zero: (∀n. ⇡*[h,n]s0 = s → ⊥) → deg_SO h s s0 𝟎
26 fact deg_SO_inv_succ_aux (h) (s) (s0):
27 ∀n0. deg_SO h s s0 n0 → ∀n. n0 = ↑n → ⇡*[h,n]s0 = s.
29 [ #n #Hn #x #H destruct //
30 | #_ #x #H elim (eq_inv_zero_nsucc … H)
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) → ⇡*[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 𝟏.
40 #h #s @(deg_SO_succ … 𝟎 ?) //
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 (sh_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 (sh_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/
63 <npred_succ @(nat_ind_succ … n) -n
64 [ @deg_SO_zero #n >(sh_nexts_succ_next h n s0) #H
65 lapply (sh_nexts_inj … Hha ???) -H #H destruct
66 | #n @deg_SO_succ >sh_nexts_swap //
68 | #H0 @deg_SO_zero #n >sh_nexts_swap #H destruct
74 rec definition sd_d (h:?) (s:?) (d:?) on d: sd ≝
79 | _ ⇒ sd_d h (pr_next h s) d
83 lemma sd_d_props (h) (s) (d): sh_decidable h → sh_acyclic h →
84 sd_props h (sd_d h s d).
86 #d elim d -d /2 width=1 by sd_SO_props/
89 (* Properties with sd_d *****************************************************)
92 ∀s,d. sd_d h s (↑↑d) = sd_d h (⫯[h]s) (↑d).
95 lemma sd_d_correct (h): sh_decidable h → sh_acyclic h →
96 ∀s,d. deg (sd_d h s d) s d.
97 #h #Hhd #Hha @pull_2 #d elim d -d [ // ]
98 #d elim d -d /3 width=3 by deg_inv_pred, sd_d_props/