]> matita.cs.unibo.it Git - helm.git/blob - matitaB/matita/contribs/ng_assembly2/common/sigma.ma
529ca7ada03fc8e242df4987af656be8b0b9ac7d
[helm.git] / matitaB / matita / contribs / ng_assembly2 / common / sigma.ma
1 (**************************************************************************)
2 (*       ___                                                              *)
3 (*      ||M||                                                             *)
4 (*      ||A||       A project by Andrea Asperti                           *)
5 (*      ||T||                                                             *)
6 (*      ||I||       Developers:                                           *)
7 (*      ||T||         The HELM team.                                      *)
8 (*      ||A||         http://helm.cs.unibo.it                             *)
9 (*      \   /                                                             *)
10 (*       \ /        This file is distributed under the terms of the       *)
11 (*        v         GNU General Public License Version 2                  *)
12 (*                                                                        *)
13 (**************************************************************************)
14
15 (* ********************************************************************** *)
16 (*                          Progetto FreeScale                            *)
17 (*                                                                        *)
18 (*   Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it              *)
19 (*   Sviluppo: 2008-2010                                                  *)
20 (*                                                                        *)
21 (* ********************************************************************** *)
22
23 include "common/theory.ma".
24
25 (* coppia dipendente *)
26
27 ninductive sigma (A:Type) (P:A → Type) : Type ≝
28     sigma_intro: ∀x:A.P x → sigma A P.
29
30 notation < "hvbox(\Sigma ident i opt (: tx) break . p)"
31   right associative with precedence 20
32 for @{ 'Sigma ${default
33   @{\lambda ${ident i} : $tx. $p}  
34   @{\lambda ${ident i} . $p}}}.
35
36 notation > "\Sigma list1 ident x sep , opt (: T). term 19 Px"
37   with precedence 20
38   for ${ default
39           @{ ${ fold right @{$Px} rec acc @{'Sigma (λ${ident x}:$T.$acc)} } }
40           @{ ${ fold right @{$Px} rec acc @{'Sigma (λ${ident x}.$acc)} } }
41        }.
42
43 notation "\ll term 19 a, break term 19 b \gg"
44 with precedence 90 for @{'dependent_pair (λx:?.? x) $a $b}.
45 interpretation "dependent pair" 'dependent_pair \eta.c a b = (sigma_intro ? c a b).
46
47 interpretation "sigma" 'Sigma \eta.x = (sigma ? x).
48
49 ndefinition sigmaFst ≝
50 λT:Type.λf:T → Type.λs:sigma T f.match s with [ sigma_intro x _ ⇒ x ].
51 ndefinition sigmaSnd ≝
52 λT:Type.λf:T → Type.λs:sigma T f.match s return λs.f (sigmaFst ?? s) with [ sigma_intro _ x ⇒ x ].