X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Fmatita%2Fnlibrary%2Fhints_declaration.ma;h=99aca7fa6e79fe01a6f086cded9bbc146b309a9a;hb=7d7f1e8403bebcfc759d0955bd2f5a4837c414b2;hp=29d17382b420c8bf99803ce7f212ef4e8f5482db;hpb=f5f35ef830b1335dad2fcc3c1aae2b57815f73b1;p=helm.git diff --git a/helm/software/matita/nlibrary/hints_declaration.ma b/helm/software/matita/nlibrary/hints_declaration.ma index 29d17382b..99aca7fa6 100644 --- a/helm/software/matita/nlibrary/hints_declaration.ma +++ b/helm/software/matita/nlibrary/hints_declaration.ma @@ -12,21 +12,95 @@ (* *) (**************************************************************************) -include "logic/pts.ma". -ndefinition hint_declaration_Type0 ≝ λA:Type[0] .λa,b:A.a. -ndefinition hint_declaration_Type1 ≝ λA:Type[1].λa,b:A.a. -ndefinition hint_declaration_Type2 ≝ λa,b:Type[1].a. -ndefinition hint_declaration_CProp0 ≝ λA:CProp[0].λa,b:A.a. -ndefinition hint_declaration_CProp1 ≝ λA:CProp[1].λa,b:A.a. -ndefinition hint_declaration_CProp2 ≝ λa,b:CProp[1].a. - -notation > "≔ (list0 (ident x : T )sep ,) ⊢ term 19 Px ≡ term 19 Py" +(* + +Notation for hint declaration +============================== + +The idea is to write a context, with abstraction first, then +recursive calls (let-in) and finally the two equivalent terms. +The context can be empty. Note the ; to begin the second part of +the context (necessary even if the first part is empty). + + unification hint PREC \coloneq + ID : TY, ..., ID : TY + ; ID \equest T, ..., ID \equest T + \vdash T1 \equiv T2 + +With unidoce and some ASCII art it looks like the following: + + unification hint PREC ≔ ID : TY, ..., ID : TY; + ID ≟ T, ..., ID ≟ T + (*---------------------*) ⊢ + T1 ≡ T2 + +The order of premises is relevant, since they are processed in order +(left to right). + +*) + +(* it seems unbelivable, but it works! *) +notation > "≔ (list0 ( (list1 (ident x) sep , ) opt (: T) ) sep ,) opt (; (list1 (ident U ≟ term 19 V ) sep ,)) ⊢ term 19 Px ≡ term 19 Py" with precedence 90 - for @{ ${ fold right @{'hint_decl $Px $Py} rec acc @{ ∀${ident x}:$T.$acc } } }. + for @{ ${ fold right + @{ ${ default + @{ ${ fold right + @{ 'hint_decl $Px $Py } + rec acc1 @{ let ( ${ident U} : ?) ≝ $V in $acc1} } } + @{ 'hint_decl $Px $Py } + } + } + rec acc @{ + ${ fold right @{ $acc } rec acc2 + @{ ∀${ident x}:${ default @{ $T } @{ ? } }.$acc2 } } + } + }}. + +include "logic/pts.ma". +ndefinition hint_declaration_Type0 ≝ λA:Type[0] .λa,b:A.Prop. +ndefinition hint_declaration_Type1 ≝ λA:Type[1].λa,b:A.Prop. +ndefinition hint_declaration_Type2 ≝ λa,b:Type[2].Prop. +ndefinition hint_declaration_CProp0 ≝ λA:CProp[0].λa,b:A.Prop. +ndefinition hint_declaration_CProp1 ≝ λA:CProp[1].λa,b:A.Prop. +ndefinition hint_declaration_CProp2 ≝ λa,b:CProp[2].Prop. + interpretation "hint_decl_Type2" 'hint_decl a b = (hint_declaration_Type2 a b). interpretation "hint_decl_CProp2" 'hint_decl a b = (hint_declaration_CProp2 a b). interpretation "hint_decl_Type1" 'hint_decl a b = (hint_declaration_Type1 ? a b). interpretation "hint_decl_CProp1" 'hint_decl a b = (hint_declaration_CProp1 ? a b). interpretation "hint_decl_CProp0" 'hint_decl a b = (hint_declaration_CProp0 ? a b). interpretation "hint_decl_Type0" 'hint_decl a b = (hint_declaration_Type0 ? a b). + +(* Non uniform coercions support *) +nrecord lock2 (S : Type[2]) (s : S) : Type[3] ≝ { + force2 : Type[2]; + lift2 : force2 +}. + +nrecord lock1 (S : Type[1]) (s : S) : Type[2] ≝ { + force1 : Type[1]; + lift1 : force1 +}. + +ncoercion lift1 : ∀S:Type[1].∀s:S.∀l:lock1 S s. force1 S s l ≝ lift1 + on s : ? to force1 ???. + +ncoercion lift2 : ∀S:Type[2].∀s:S.∀l:lock2 S s. force2 S s l ≝ lift2 + on s : ? to force2 ???. + +(* Example of a non uniform coercion declaration + + Type[0] setoid + >---> + MR R + + provided MR = carr R + +unification hint 0 ≔ R : setoid; + MR ≟ carr R, + lock ≟ mk_lock1 Type[0] MR setoid R +(* ---------------------------------------- *) ⊢ + setoid ≡ force1 ? MR lock. + +*) \ No newline at end of file