From ad9620f3254464378786d672d3f18e6877f08530 Mon Sep 17 00:00:00 2001 From: Leonardo de Moura Date: Tue, 9 Dec 2014 15:41:18 -0800 Subject: [PATCH] feat(hott/init): add notation for sigma types --- hott/init/default.hlean | 1 + hott/init/sigma.hlean | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 hott/init/sigma.hlean diff --git a/hott/init/default.hlean b/hott/init/default.hlean index aa59f39a7..1cbeb2a5f 100644 --- a/hott/init/default.hlean +++ b/hott/init/default.hlean @@ -7,3 +7,4 @@ Authors: Leonardo de Moura prelude import init.datatypes init.reserved_notation init.tactic init.logic import init.bool init.num init.priority init.relation init.wf init.prod +import init.sigma diff --git a/hott/init/sigma.hlean b/hott/init/sigma.hlean new file mode 100644 index 000000000..8b2c55f70 --- /dev/null +++ b/hott/init/sigma.hlean @@ -0,0 +1,25 @@ +/- +Copyright (c) 2014 Microsoft Corporation. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Leonardo de Moura, Jeremy Avigad, Floris van Doorn +-/ +prelude +import init.num init.wf init.logic init.tactic + +structure sigma {A : Type} (B : A → Type) := +dpair :: (dpr1 : A) (dpr2 : B dpr1) + +notation `Σ` binders `,` r:(scoped P, sigma P) := r + +namespace sigma + + notation `dpr₁` := dpr1 + notation `dpr₂` := dpr2 + + namespace ops + postfix `.1`:(max+1) := dpr1 + postfix `.2`:(max+1) := dpr2 + notation `⟨` t:(foldr `,` (e r, sigma.dpair e r)) `⟩`:0 := t --input ⟨ ⟩ as \< \> + end ops + +end sigma