feat(hott,library): add additional spacing hints

This commit is contained in:
Leonardo de Moura 2015-09-30 16:52:34 -07:00
parent c9af007994
commit ede23a3267
11 changed files with 70 additions and 74 deletions

View file

@ -114,7 +114,7 @@ namespace trunc
notation `exists` binders `,` r:(scoped P, Exists P) := r
notation `∃` binders `,` r:(scoped P, Exists P) := r
notation A `\/` B := or A B
notation A ` \/ ` B := or A B
notation A B := or A B
definition merely.intro [reducible] [constructor] (a : A) : ∥ A ∥ := tr a

View file

@ -58,11 +58,11 @@ precedence `on`:1
precedence `$`:1
infixr ∘ := compose
infixr ∘' := dcompose
infixl on := on_fun
infixr $ := app
notation f `-[` op `]-` g := combine f op g
infixr ∘ := compose
infixr ∘' := dcompose
infixl on := on_fun
infixr $ := app
notation f ` -[` op `]- ` g := combine f op g
end function

View file

@ -458,14 +458,14 @@ namespace eq
-- In Coq the variables P, Q and b are explicit, but in Lean we can probably have them implicit
-- using the following notation
notation p `▸D`:65 x:64 := transportD _ p _ x
notation p ` ▸D `:65 x:64 := transportD _ p _ x
-- Transporting along higher-dimensional paths
definition transport2 [unfold 7] (P : A → Type) {x y : A} {p q : x = y} (r : p = q) (z : P x) :
p ▸ z = q ▸ z :=
ap (λp', p' ▸ z) r
notation p `▸2`:65 x:64 := transport2 _ p _ x
notation p ` ▸2 `:65 x:64 := transport2 _ p _ x
-- An alternative definition.
definition tr2_eq_ap10 (Q : A → Type) {x y : A} {p q : x = y} (r : p = q)
@ -486,7 +486,7 @@ namespace eq
{x1 x2 : A} (p : x1 = x2) (y : B x1) (z : C x1) (w : D x1 y z) : D x2 (p ▸ y) (p ▸ z) :=
eq.rec_on p w
notation p `▸D2`:65 x:64 := transportD2 _ _ _ p _ _ x
notation p ` ▸D2 `:65 x:64 := transportD2 _ _ _ p _ _ x
definition ap_tr_con_tr2 (P : A → Type) {x y : A} {p q : x = y} {z w : P x} (r : p = q)
(s : z = w) :

View file

@ -20,7 +20,7 @@ namespace eq
inductive pathover.{l} (B : A → Type.{l}) (b : B a) : Π{a₂ : A}, a = a₂ → B a₂ → Type.{l} :=
idpatho : pathover B b (refl a) b
notation b `=[`:50 p:0 `]`:0 b₂:50 := pathover _ b p b₂
notation b ` =[`:50 p:0 `] `:0 b₂:50 := pathover _ b p b₂
definition idpo [reducible] [constructor] : b =[refl a] b :=
pathover.idpatho b

View file

@ -33,62 +33,62 @@ num.succ (num.succ (num.succ (num.succ (num.succ (num.succ (num.succ (num.succ (
/- Logical operations and relations -/
reserve prefix `¬`:40
reserve prefix `~`:40
reserve infixr ``:35
reserve infixr `/\`:35
reserve infixr `\/`:30
reserve infixr ``:30
reserve infix `<->`:20
reserve infix ``:20
reserve infix `=`:50
reserve infix ``:50
reserve infix ``:50
reserve infix `~`:50
reserve infix ``:50
reserve prefix ` ~ `:40
reserve infixr ``:35
reserve infixr ` /\ `:35
reserve infixr ` \/ `:30
reserve infixr ` `:30
reserve infix ` <-> `:20
reserve infix ``:20
reserve infix ` = `:50
reserve infix ``:50
reserve infix ``:50
reserve infix ` ~ `:50
reserve infix ``:50
reserve infixr ``:60 -- input with \comp
reserve infixr ``:60 -- input with \comp
reserve postfix `⁻¹`:std.prec.max_plus -- input with \sy or \-1 or \inv
reserve infixl ``:75
reserve infixr ``:75
reserve infixl ``:75
reserve infixr ``:75
/- types and type constructors -/
reserve infixr ``:25
reserve infixr `×`:30
reserve infixr ``:25
reserve infixr ` × `:30
/- arithmetic operations -/
reserve infixl `+`:65
reserve infixl `-`:65
reserve infixl `*`:70
reserve infixl `div`:70
reserve infixl `mod`:70
reserve infixl `/`:70
reserve prefix `-`:100
reserve infix `^`:80
reserve infixl ` + `:65
reserve infixl ` - `:65
reserve infixl ` * `:70
reserve infixl ` div `:70
reserve infixl ` mod `:70
reserve infixl ` / `:70
reserve prefix ` - `:100
reserve infix ` ^ `:80
reserve infix `<=`:50
reserve infix ``:50
reserve infix `<`:50
reserve infix `>=`:50
reserve infix ``:50
reserve infix `>`:50
reserve infix ` <= `:50
reserve infix ``:50
reserve infix ` < `:50
reserve infix ` >= `:50
reserve infix ``:50
reserve infix ` > `:50
/- boolean operations -/
reserve infixl `&&`:70
reserve infixl `||`:65
reserve infixl ` && `:70
reserve infixl ` || `:65
/- set operations -/
reserve infix ``:50
reserve infix ``:50
reserve infixl ``:70
reserve infixl ``:65
reserve infix ``:50
reserve infix ``:50
reserve infixl ``:70
reserve infixl ` `:65
/- other symbols -/
reserve infix ``:50
reserve infixl `++`:65
reserve infixr `::`:65
reserve infix ` `:50
reserve infixl ` ++ `:65
reserve infixr ` :: `:65

View file

@ -32,10 +32,10 @@ end unit
-- Sigma type
-- ----------
notation `Σ` binders `,` r:(scoped P, sigma P) := r
notation `Σ` binders `, ` r:(scoped P, sigma P) := r
namespace sigma
notation `⟨`:max t:(foldr `,` (e r, mk e r)) `⟩`:0 := t --input ⟨ ⟩ as \< \>
notation `⟨`:max t:(foldr `, ` (e r, mk e r)) `⟩`:0 := t --input ⟨ ⟩ as \< \>
namespace ops
postfix `.1`:(max+1) := pr1
@ -52,8 +52,8 @@ namespace sum
infixr ⊎ := sum
infixr + := sum
namespace low_precedence_plus
reserve infixr `+`:25 -- conflicts with notation for addition
infixr `+` := sum
reserve infixr ` + `:25 -- conflicts with notation for addition
infixr ` + ` := sum
end low_precedence_plus
variables {a b c d : Type}
@ -81,7 +81,7 @@ abbreviation pair [constructor] := @prod.mk
namespace prod
-- notation for n-ary tuples
notation `(` h `,` t:(foldl `,` (e r, prod.mk r e) h) `)` := t
notation `(` h `, ` t:(foldl `,` (e r, prod.mk r e) h) `)` := t
infixr × := prod
namespace ops
@ -94,8 +94,8 @@ namespace prod
namespace low_precedence_times
reserve infixr `*`:30 -- conflicts with notation for multiplication
infixr `*` := prod
reserve infixr ` * `:30 -- conflicts with notation for multiplication
infixr ` * ` := prod
end low_precedence_times

View file

@ -13,7 +13,7 @@ inductive Wtype.{l k} {A : Type.{l}} (B : A → Type.{k}) : Type.{max l k} :=
sup : Π (a : A), (B a → Wtype.{l k} B) → Wtype.{l k} B
namespace Wtype
notation `W` binders `,` r:(scoped B, Wtype B) := r
notation `W` binders `, ` r:(scoped B, Wtype B) := r
universe variables u v
variables {A A' : Type.{u}} {B B' : A → Type.{v}} {C : Π(a : A), B a → Type}
@ -28,7 +28,7 @@ namespace Wtype
namespace ops
postfix `.1`:(max+1) := Wtype.pr1
postfix `.2`:(max+1) := Wtype.pr2
notation `⟨` a `,` f `⟩`:0 := Wtype.sup a f --input ⟨ ⟩ as \< \>
notation `⟨` a `, ` f `⟩`:0 := Wtype.sup a f --input ⟨ ⟩ as \< \>
end ops
open ops

View file

@ -53,12 +53,12 @@ assume h, absurd rfl (and.elim_right h)
/- bounded quantification -/
abbreviation bounded_forall (a : set X) (P : X → Prop) := ∀⦃x⦄, x ∈ a → P x
notation `forallb` binders `∈` a `,` r:(scoped:1 P, P) := bounded_forall a r
notation `∀₀` binders `∈` a `,` r:(scoped:1 P, P) := bounded_forall a r
notation `forallb` binders `∈` a `, ` r:(scoped:1 P, P) := bounded_forall a r
notation `∀₀` binders `∈` a `, ` r:(scoped:1 P, P) := bounded_forall a r
abbreviation bounded_exists (a : set X) (P : X → Prop) := ∃⦃x⦄, x ∈ a ∧ P x
notation `existsb` binders `∈` a `,` r:(scoped:1 P, P) := bounded_exists a r
notation `∃₀` binders `∈` a `,` r:(scoped:1 P, P) := bounded_exists a r
notation `existsb` binders `∈` a `, ` r:(scoped:1 P, P) := bounded_exists a r
notation `∃₀` binders `∈` a `, ` r:(scoped:1 P, P) := bounded_exists a r
theorem bounded_exists.intro {P : X → Prop} {s : set X} {x : X} (xs : x ∈ s) (Px : P x) :
∃₀ x ∈ s, P x :=

View file

@ -56,15 +56,11 @@ rfl
theorem uncurry_curry (f : A × B → C) : uncurry (curry f) = f :=
funext (λ p, match p with (a, b) := rfl end)
precedence `∘'`:60
precedence `on`:1
precedence `$`:1
infixr ∘ := compose
infixr ∘' := dcompose
infixl on := on_fun
infixr $ := app
notation f `-[` op `]-` g := combine f op g
infixr ` ∘ ` := compose
infixr ` ∘' `:60 := dcompose
infixl ` on `:1 := on_fun
infixr ` $ `:1 := app
notation f ` -[` op `]- ` g := combine f op g
lemma left_id (f : A → B) : id ∘ f = f := rfl

View file

@ -11,7 +11,7 @@ structure setoid [class] (A : Type) :=
(r : A → A → Prop) (iseqv : equivalence r)
namespace setoid
infix `` := setoid.r
infix `` := setoid.r
variable {A : Type}
variable [s : setoid A]

View file

@ -75,7 +75,7 @@ end
definition exists_unique {A : Type} (p : A → Prop) :=
∃x, p x ∧ ∀y, p y → y = x
notation `∃!` binders `,` r:(scoped P, exists_unique P) := r
notation `∃!` binders `, ` r:(scoped P, exists_unique P) := r
theorem exists_unique.intro {A : Type} {p : A → Prop} (w : A) (H1 : p w) (H2 : ∀y, p y → y = w) :
∃!x, p x :=