X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=matita%2Fmatita%2Fcontribs%2Flambdadelta%2Fbasic_2A%2Fstatic%2Fsd.ma;fp=matita%2Fmatita%2Fcontribs%2Flambdadelta%2Fbasic_2A%2Fstatic%2Fsd.ma;h=7b0947d02810e66a0fcab9d40bba53aad7496d63;hb=d2545ffd201b1aa49887313791386add78fa8603;hp=0000000000000000000000000000000000000000;hpb=57ae1762497a5f3ea75740e2908e04adb8642cc2;p=helm.git diff --git a/matita/matita/contribs/lambdadelta/basic_2A/static/sd.ma b/matita/matita/contribs/lambdadelta/basic_2A/static/sd.ma new file mode 100644 index 000000000..7b0947d02 --- /dev/null +++ b/matita/matita/contribs/lambdadelta/basic_2A/static/sd.ma @@ -0,0 +1,131 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +include "basic_2A/static/sh.ma". + +(* SORT DEGREE **************************************************************) + +(* sort degree specification *) +record sd (h:sh): Type[0] ≝ { + deg : relation nat; (* degree of the sort *) + deg_total: ∀k. ∃d. deg k d; (* functional relation axioms *) + deg_mono : ∀k,d1,d2. deg k d1 → deg k d2 → d1 = d2; + deg_next : ∀k,d. deg k d → deg (next h k) (d - 1) (* compatibility condition *) +}. + +(* Notable specifications ***************************************************) + +definition deg_O: relation nat ≝ λk,d. d = 0. + +definition sd_O: ∀h. sd h ≝ λh. mk_sd h deg_O …. +/2 width=2 by le_n_O_to_eq, le_n, ex_intro/ defined. + +inductive deg_SO (h:sh) (k:nat) (k0:nat): predicate nat ≝ +| deg_SO_pos : ∀d0. (next h)^d0 k0 = k → deg_SO h k k0 (d0 + 1) +| deg_SO_zero: ((∃d0. (next h)^d0 k0 = k) → ⊥) → deg_SO h k k0 0 +. + +fact deg_SO_inv_pos_aux: ∀h,k,k0,d0. deg_SO h k k0 d0 → ∀d. d0 = d + 1 → + (next h)^d k0 = k. +#h #k #k0 #d0 * -d0 +[ #d0 #Hd0 #d #H + lapply (injective_plus_l … H) -H #H destruct // +| #_ #d0 H -H #H + lapply (transitive_lt … H HK12) -k1 #H1 + lapply (nexts_le h k2 d) #H2 + lapply (le_to_lt_to_lt … H2 H1) -h -d #H + elim (lt_refl_false … H) +] +qed. + +definition sd_SO: ∀h. nat → sd h ≝ λh,k. mk_sd h (deg_SO h k) …. +[ #k0 + lapply (nexts_dec h k0 k) * + [ * /3 width=2 by deg_SO_pos, ex_intro/ | /4 width=2 by deg_SO_zero, ex_intro/ ] +| #K0 #d1 #d2 * [ #d01 ] #H1 * [1,3: #d02 ] #H2 // + [ < H2 in H1; -H2 #H + lapply (nexts_inj … H) -H #H destruct // + | elim H1 /2 width=2 by ex_intro/ + | elim H2 /2 width=2 by ex_intro/ + ] +| #k0 #d0 * + [ #d #H destruct elim d -d normalize + /2 width=1 by deg_SO_gt, deg_SO_pos, next_lt/ + | #H1 @deg_SO_zero * #d #H2 destruct + @H1 -H1 @(ex_intro … (S d)) /2 width=1 by sym_eq/ (**) (* explicit constructor *) + ] +] +defined. + +let rec sd_d (h:sh) (k:nat) (d:nat) on d : sd h ≝ + match d with + [ O ⇒ sd_O h + | S d ⇒ match d with + [ O ⇒ sd_SO h k + | _ ⇒ sd_d h (next h k) d + ] + ]. + +(* Basic inversion lemmas ***************************************************) + +lemma deg_inv_pred: ∀h,g,k,d. deg h g (next h k) (d+1) → deg h g k (d+2). +#h #g #k #d #H1 +elim (deg_total h g k) #d0 #H0 +lapply (deg_next … H0) #H2 +lapply (deg_mono … H1 H2) -H1 -H2 #H +<(associative_plus d 1 1) >H iter_SO #H +lapply (deg_inv_pred … H) -H <(associative_plus d0 1 1) #H +lapply (IHd … H) -IHd -H // +qed-. + +(* Basic properties *********************************************************) + +lemma deg_iter: ∀h,g,k,d1,d2. deg h g k d1 → deg h g ((next h)^d2 k) (d1-d2). +#h #g #k #d1 #d2 @(nat_ind_plus … d2) -d2 [ iter_SO