fix(library/init/{prod,sigma},library/data/sum): move notation in/out of namespaces

This commit is contained in:
Jeremy Avigad 2015-02-01 14:14:01 -05:00 committed by Leonardo de Moura
parent d48a332876
commit 90da0290f4
4 changed files with 12 additions and 14 deletions

View file

@ -11,9 +11,9 @@ import logic.connectives
open inhabited eq.ops
notation A ⊎ B := sum A B
notation A + B := sum A B
namespace sum
notation A + B := sum A B
namespace low_precedence_plus
reserve infixr `+`:25 -- conflicts with notation for addition
infixr `+` := sum

View file

@ -69,6 +69,9 @@ or.inl Ha
definition or.intro_right (a : Prop) {b : Prop} (Hb : b) : or a b :=
or.inr Hb
structure sigma {A : Type} (B : A → Type) :=
mk :: (pr1 : A) (pr2 : B pr1)
-- pos_num and num are two auxiliary datatypes used when parsing numerals such as 13, 0, 26.
-- The parser will generate the terms (pos (bit1 (bit1 (bit0 one)))), zero, and (pos (bit0 (bit1 (bit1 one)))).
-- This representation can be coerced in whatever we want (e.g., naturals, integers, reals, etc).

View file

@ -9,21 +9,21 @@ prelude
import init.num init.wf
definition pair := @prod.mk
notation A × B := prod A B
-- notation for n-ary tuples
notation `(` h `,` t:(foldl `,` (e r, prod.mk r e) h) `)` := t
namespace prod
notation A * B := prod A B
notation A × B := prod A B
notation A × B := prod A B -- repeat, so this takes precedence
namespace low_precedence_times
reserve infixr `*`:30 -- conflicts with notation for multiplication
reserve infixr `*`:30 -- conflicts with notation for multiplication
infixr `*` := prod
end low_precedence_times
notation `pr₁` := pr1
notation `pr₂` := pr2
-- notation for n-ary tuples
notation `(` h `,` t:(foldl `,` (e r, prod.mk r e) h) `)` := t
namespace ops
postfix `.1`:(max+1) := pr1
postfix `.2`:(max+1) := pr2

View file

@ -6,21 +6,16 @@ Module: init.sigma
Author: 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) :=
mk :: (pr1 : A) (pr2 : B pr1)
import init.datatypes init.num init.wf init.logic init.tactic
definition dpair := @sigma.mk
definition dpr1 := @sigma.pr1
definition dpr2 := @sigma.pr2
notation `Σ` binders `,` r:(scoped P, sigma P) := r
-- notation for n-ary tuples; input ⟨ ⟩ as \< \>
notation `⟨`:max t:(foldr `,` (e r, sigma.mk e r)) `⟩`:0 := t
namespace sigma
notation `pr₁` := pr1
notation `pr₂` := pr2
notation `⟨`:max t:(foldr `,` (e r, mk e r)) `⟩`:0 := t --input ⟨ ⟩ as \< \>
namespace ops
postfix `.1`:(max+1) := pr1