feat(library): add some spacing hints
This commit is contained in:
parent
da08079af9
commit
d1b5031dbd
32 changed files with 115 additions and 115 deletions
|
@ -125,8 +125,8 @@ variable [C : complete_lattice A]
|
||||||
include C
|
include C
|
||||||
prefix `⨅`:70 := Inf
|
prefix `⨅`:70 := Inf
|
||||||
prefix `⨆`:65 := Sup
|
prefix `⨆`:65 := Sup
|
||||||
infix `⊓` := inf
|
infix ` ⊓ ` := inf
|
||||||
infix `⊔` := sup
|
infix ` ⊔ ` := sup
|
||||||
|
|
||||||
variable {f : A → A}
|
variable {f : A → A}
|
||||||
premise (mono : ∀ x y : A, x ≤ y → f x ≤ f y)
|
premise (mono : ∀ x y : A, x ≤ y → f x ≤ f y)
|
||||||
|
|
|
@ -25,7 +25,7 @@ section division_ring
|
||||||
include s
|
include s
|
||||||
|
|
||||||
definition divide (a b : A) : A := a * b⁻¹
|
definition divide (a b : A) : A := a * b⁻¹
|
||||||
infix [priority algebra.prio] `/` := divide
|
infix [priority algebra.prio] / := divide
|
||||||
|
|
||||||
-- only in this file
|
-- only in this file
|
||||||
local attribute divide [reducible]
|
local attribute divide [reducible]
|
||||||
|
|
|
@ -36,8 +36,8 @@ structure has_inv [class] (A : Type) :=
|
||||||
structure has_neg [class] (A : Type) :=
|
structure has_neg [class] (A : Type) :=
|
||||||
(neg : A → A)
|
(neg : A → A)
|
||||||
|
|
||||||
infixl [priority algebra.prio] `*` := has_mul.mul
|
infixl [priority algebra.prio] ` * ` := has_mul.mul
|
||||||
infixl [priority algebra.prio] `+` := has_add.add
|
infixl [priority algebra.prio] ` + ` := has_add.add
|
||||||
postfix [priority algebra.prio] `⁻¹` := has_inv.inv
|
postfix [priority algebra.prio] `⁻¹` := has_inv.inv
|
||||||
prefix [priority algebra.prio] `-` := has_neg.neg
|
prefix [priority algebra.prio] `-` := has_neg.neg
|
||||||
notation 1 := !has_one.one
|
notation 1 := !has_one.one
|
||||||
|
@ -287,8 +287,8 @@ section group
|
||||||
definition conj_by (g a : A) := g * a * g⁻¹
|
definition conj_by (g a : A) := g * a * g⁻¹
|
||||||
definition is_conjugate (a b : A) := ∃ x, conj_by x b = a
|
definition is_conjugate (a b : A) := ∃ x, conj_by x b = a
|
||||||
|
|
||||||
local infixl `~` := is_conjugate
|
local infixl ` ~ ` := is_conjugate
|
||||||
local infixr `∘c`:55 := conj_by
|
local infixr ` ∘c `:55 := conj_by
|
||||||
|
|
||||||
lemma conj_compose (f g a : A) : f ∘c g ∘c a = f*g ∘c a :=
|
lemma conj_compose (f g a : A) : f ∘c g ∘c a = f*g ∘c a :=
|
||||||
calc f ∘c g ∘c a = f * (g * a * g⁻¹) * f⁻¹ : rfl
|
calc f ∘c g ∘c a = f * (g * a * g⁻¹) * f⁻¹ : rfl
|
||||||
|
@ -478,7 +478,7 @@ section add_group
|
||||||
-- TODO: derive corresponding facts for div in a field
|
-- TODO: derive corresponding facts for div in a field
|
||||||
definition sub [reducible] (a b : A) : A := a + -b
|
definition sub [reducible] (a b : A) : A := a + -b
|
||||||
|
|
||||||
infix [priority algebra.prio] `-` := sub
|
infix [priority algebra.prio] - := sub
|
||||||
|
|
||||||
theorem sub_eq_add_neg (a b : A) : a - b = a + -b := rfl
|
theorem sub_eq_add_neg (a b : A) : a - b = a + -b := rfl
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ definition pow (a : A) : ℕ → A
|
||||||
| 0 := 1
|
| 0 := 1
|
||||||
| (n+1) := a * pow n
|
| (n+1) := a * pow n
|
||||||
|
|
||||||
infix [priority algebra.prio] `^` := pow
|
infix [priority algebra.prio] ` ^ ` := pow
|
||||||
|
|
||||||
theorem pow_zero (a : A) : a^0 = 1 := rfl
|
theorem pow_zero (a : A) : a^0 = 1 := rfl
|
||||||
theorem pow_succ (a : A) (n : ℕ) : a^(succ n) = a * a^n := rfl
|
theorem pow_succ (a : A) (n : ℕ) : a^(succ n) = a * a^n := rfl
|
||||||
|
|
|
@ -23,8 +23,8 @@ structure lattice [class] (A : Type) extends weak_order A :=
|
||||||
|
|
||||||
definition inf := @lattice.inf
|
definition inf := @lattice.inf
|
||||||
definition sup := @lattice.sup
|
definition sup := @lattice.sup
|
||||||
infix `⊓`:70 := inf
|
infix ` ⊓ `:70 := inf
|
||||||
infix `⊔`:65 := sup
|
infix ` ⊔ `:65 := sup
|
||||||
|
|
||||||
section
|
section
|
||||||
variable [s : lattice A]
|
variable [s : lattice A]
|
||||||
|
|
|
@ -20,9 +20,9 @@ structure has_le [class] (A : Type) :=
|
||||||
structure has_lt [class] (A : Type) :=
|
structure has_lt [class] (A : Type) :=
|
||||||
(lt : A → A → Prop)
|
(lt : A → A → Prop)
|
||||||
|
|
||||||
infixl [priority algebra.prio] `<=` := has_le.le
|
infixl [priority algebra.prio] <= := has_le.le
|
||||||
infixl [priority algebra.prio] `≤` := has_le.le
|
infixl [priority algebra.prio] ≤ := has_le.le
|
||||||
infixl [priority algebra.prio] `<` := has_lt.lt
|
infixl [priority algebra.prio] < := has_lt.lt
|
||||||
|
|
||||||
definition has_le.ge [reducible] {A : Type} [s : has_le A] (a b : A) := b ≤ a
|
definition has_le.ge [reducible] {A : Type} [s : has_le A] (a b : A) := b ≤ a
|
||||||
notation [priority algebra.prio] a ≥ b := has_le.ge a b
|
notation [priority algebra.prio] a ≥ b := has_le.ge a b
|
||||||
|
|
|
@ -20,12 +20,12 @@ structure equiv [class] (A B : Type) :=
|
||||||
namespace equiv
|
namespace equiv
|
||||||
definition perm [reducible] (A : Type) := equiv A A
|
definition perm [reducible] (A : Type) := equiv A A
|
||||||
|
|
||||||
infix `≃`:50 := equiv
|
infix ` ≃ `:50 := equiv
|
||||||
|
|
||||||
definition fn {A B : Type} (e : equiv A B) : A → B :=
|
definition fn {A B : Type} (e : equiv A B) : A → B :=
|
||||||
@equiv.to_fun A B e
|
@equiv.to_fun A B e
|
||||||
|
|
||||||
infixr `∙`:100 := fn
|
infixr ` ∙ `:100 := fn
|
||||||
|
|
||||||
definition inv {A B : Type} [e : equiv A B] : B → A :=
|
definition inv {A B : Type} [e : equiv A B] : B → A :=
|
||||||
@equiv.inv_fun A B e
|
@equiv.inv_fun A B e
|
||||||
|
@ -54,9 +54,9 @@ protected definition trans [trans] {A B C : Type} : A ≃ B → B ≃ C → A
|
||||||
abbreviation id {A : Type} := equiv.refl A
|
abbreviation id {A : Type} := equiv.refl A
|
||||||
|
|
||||||
namespace ops
|
namespace ops
|
||||||
postfix `⁻¹` := equiv.symm
|
postfix ⁻¹ := equiv.symm
|
||||||
postfix `⁻¹` := equiv.inv
|
postfix ⁻¹ := equiv.inv
|
||||||
notation e₁ `∘` e₂ := equiv.trans e₂ e₁
|
notation e₁ ∘ e₂ := equiv.trans e₂ e₁
|
||||||
end ops
|
end ops
|
||||||
open equiv.ops
|
open equiv.ops
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ inductive vector (A : Type) : nat → Type :=
|
||||||
|
|
||||||
namespace vector
|
namespace vector
|
||||||
notation a :: b := cons a b
|
notation a :: b := cons a b
|
||||||
notation `[` l:(foldr `,` (h t, cons h t) nil `]`) := l
|
notation `[` l:(foldr `, ` (h t, cons h t) nil `]`) := l
|
||||||
|
|
||||||
variables {A B C : Type}
|
variables {A B C : Type}
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ quot.lift_on s (λ l, a ∈ elt_of l)
|
||||||
(λ ainl₁, mem_perm e ainl₁)
|
(λ ainl₁, mem_perm e ainl₁)
|
||||||
(λ ainl₂, mem_perm (perm.symm e) ainl₂)))
|
(λ ainl₂, mem_perm (perm.symm e) ainl₂)))
|
||||||
|
|
||||||
infix [priority finset.prio] `∈` := mem
|
infix [priority finset.prio] ∈ := mem
|
||||||
notation [priority finset.prio] a ∉ b := ¬ mem a b
|
notation [priority finset.prio] a ∉ b := ¬ mem a b
|
||||||
|
|
||||||
theorem mem_of_mem_list {a : A} {l : nodup_list A} : a ∈ elt_of l → a ∈ ⟦l⟧ :=
|
theorem mem_of_mem_list {a : A} {l : nodup_list A} : a ∈ elt_of l → a ∈ ⟦l⟧ :=
|
||||||
|
@ -169,7 +169,7 @@ quot.lift_on s
|
||||||
(λ (l₁ l₂ : nodup_list A) (p : l₁ ~ l₂), quot.sound (perm_insert a p))
|
(λ (l₁ l₂ : nodup_list A) (p : l₁ ~ l₂), quot.sound (perm_insert a p))
|
||||||
|
|
||||||
-- set builder notation
|
-- set builder notation
|
||||||
notation [priority finset.prio] `'{`:max a:(foldr `,` (x b, insert x b) ∅) `}`:0 := a
|
notation [priority finset.prio] `'{`:max a:(foldr `, ` (x b, insert x b) ∅) `}`:0 := a
|
||||||
|
|
||||||
theorem mem_insert (a : A) (s : finset A) : a ∈ insert a s :=
|
theorem mem_insert (a : A) (s : finset A) : a ∈ insert a s :=
|
||||||
quot.induction_on s
|
quot.induction_on s
|
||||||
|
@ -546,7 +546,7 @@ quot.lift_on₂ s₁ s₂
|
||||||
(λ s₁ a i, mem_perm p₂ (s₁ a (mem_perm (perm.symm p₁) i)))
|
(λ s₁ a i, mem_perm p₂ (s₁ a (mem_perm (perm.symm p₁) i)))
|
||||||
(λ s₂ a i, mem_perm (perm.symm p₂) (s₂ a (mem_perm p₁ i)))))
|
(λ s₂ a i, mem_perm (perm.symm p₂) (s₂ a (mem_perm p₁ i)))))
|
||||||
|
|
||||||
infix [priority finset.prio] `⊆` := subset
|
infix [priority finset.prio] ⊆ := subset
|
||||||
|
|
||||||
theorem empty_subset (s : finset A) : ∅ ⊆ s :=
|
theorem empty_subset (s : finset A) : ∅ ⊆ s :=
|
||||||
quot.induction_on s (λ l, list.nil_sub (elt_of l))
|
quot.induction_on s (λ l, list.nil_sub (elt_of l))
|
||||||
|
|
|
@ -125,7 +125,7 @@ quot.lift_on s
|
||||||
(list.nodup_filter p (subtype.has_property l)))
|
(list.nodup_filter p (subtype.has_property l)))
|
||||||
(λ l₁ l₂ u, quot.sound (perm.perm_filter u))
|
(λ l₁ l₂ u, quot.sound (perm.perm_filter u))
|
||||||
|
|
||||||
notation [priority finset.prio] `{` binder ∈ s `|` r:(scoped:1 p, sep p s) `}` := r
|
notation [priority finset.prio] `{` binder ` ∈ ` s ` | ` r:(scoped:1 p, sep p s) `}` := r
|
||||||
|
|
||||||
theorem sep_empty : sep p ∅ = ∅ := rfl
|
theorem sep_empty : sep p ∅ = ∅ := rfl
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ variables {A : Type} [deceq : decidable_eq A]
|
||||||
include deceq
|
include deceq
|
||||||
|
|
||||||
definition diff (s t : finset A) : finset A := {x ∈ s | x ∉ t}
|
definition diff (s t : finset A) : finset A := {x ∈ s | x ∉ t}
|
||||||
infix [priority finset.prio] `\`:70 := diff
|
infix [priority finset.prio] ` \ `:70 := diff
|
||||||
|
|
||||||
theorem mem_of_mem_diff {s t : finset A} {x : A} (H : x ∈ s \ t) : x ∈ s :=
|
theorem mem_of_mem_diff {s t : finset A} {x : A} (H : x ∈ s \ t) : x ∈ s :=
|
||||||
mem_of_mem_sep H
|
mem_of_mem_sep H
|
||||||
|
|
|
@ -64,7 +64,7 @@ of_finset (finset.insert a (to_finset s))
|
||||||
definition mem (a : hf) (s : hf) : Prop :=
|
definition mem (a : hf) (s : hf) : Prop :=
|
||||||
finset.mem a (to_finset s)
|
finset.mem a (to_finset s)
|
||||||
|
|
||||||
infix `∈` := mem
|
infix ∈ := mem
|
||||||
notation [priority finset.prio] a ∉ b := ¬ mem a b
|
notation [priority finset.prio] a ∉ b := ¬ mem a b
|
||||||
|
|
||||||
lemma insert_lt_of_not_mem {a s : hf} : a ∉ s → s < insert a s :=
|
lemma insert_lt_of_not_mem {a s : hf} : a ∉ s → s < insert a s :=
|
||||||
|
@ -314,7 +314,7 @@ end
|
||||||
definition subset (s₁ s₂ : hf) : Prop :=
|
definition subset (s₁ s₂ : hf) : Prop :=
|
||||||
finset.subset (to_finset s₁) (to_finset s₂)
|
finset.subset (to_finset s₁) (to_finset s₂)
|
||||||
|
|
||||||
infix [priority hf.prio] `⊆` := subset
|
infix [priority hf.prio] ⊆ := subset
|
||||||
|
|
||||||
theorem empty_subset (s : hf) : ∅ ⊆ s :=
|
theorem empty_subset (s : hf) : ∅ ⊆ s :=
|
||||||
begin unfold [empty, subset], rewrite to_finset_of_finset, apply finset.empty_subset (to_finset s) end
|
begin unfold [empty, subset], rewrite to_finset_of_finset, apply finset.empty_subset (to_finset s) end
|
||||||
|
|
|
@ -45,7 +45,7 @@ namespace int
|
||||||
|
|
||||||
attribute int.of_nat [coercion]
|
attribute int.of_nat [coercion]
|
||||||
|
|
||||||
notation `-[1+` n `]` := int.neg_succ_of_nat n -- for pretty-printing output
|
notation `-[1+ ` n `]` := int.neg_succ_of_nat n -- for pretty-printing output
|
||||||
|
|
||||||
/- definitions of basic functions -/
|
/- definitions of basic functions -/
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ theorem eq_zero_of_nat_abs_eq_zero : Π {a : ℤ}, nat_abs a = 0 → a = 0
|
||||||
|
|
||||||
protected definition equiv (p q : ℕ × ℕ) : Prop := pr1 p + pr2 q = pr2 p + pr1 q
|
protected definition equiv (p q : ℕ × ℕ) : Prop := pr1 p + pr2 q = pr2 p + pr1 q
|
||||||
|
|
||||||
local infix `≡` := int.equiv
|
local infix ≡ := int.equiv
|
||||||
|
|
||||||
protected theorem equiv.refl [refl] {p : ℕ × ℕ} : p ≡ p := !add.comm
|
protected theorem equiv.refl [refl] {p : ℕ × ℕ} : p ≡ p := !add.comm
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ notation [priority int.prio] a div b := divide a b
|
||||||
|
|
||||||
definition modulo (a b : ℤ) : ℤ := a - a div b * b
|
definition modulo (a b : ℤ) : ℤ := a - a div b * b
|
||||||
notation [priority int.prio] a mod b := modulo a b
|
notation [priority int.prio] a mod b := modulo a b
|
||||||
notation [priority int.prio] a `≡` b `[mod`:100 c `]`:0 := a mod c = b mod c
|
notation [priority int.prio] a ≡ b `[mod `:100 c `]`:0 := a mod c = b mod c
|
||||||
|
|
||||||
/- div -/
|
/- div -/
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ section migrate_algebra
|
||||||
definition pow (a : ℤ) (n : ℕ) : ℤ := algebra.pow a n
|
definition pow (a : ℤ) (n : ℕ) : ℤ := algebra.pow a n
|
||||||
infix [priority int.prio] ^ := pow
|
infix [priority int.prio] ^ := pow
|
||||||
definition nmul (n : ℕ) (a : ℤ) : ℤ := algebra.nmul n a
|
definition nmul (n : ℕ) (a : ℤ) : ℤ := algebra.nmul n a
|
||||||
infix [priority int.prio] `⬝` := nmul
|
infix [priority int.prio] ⬝ := nmul
|
||||||
definition imul (i : ℤ) (a : ℤ) : ℤ := algebra.imul i a
|
definition imul (i : ℤ) (a : ℤ) : ℤ := algebra.imul i a
|
||||||
|
|
||||||
migrate from algebra with int
|
migrate from algebra with int
|
||||||
|
|
|
@ -17,7 +17,7 @@ inhabited.mk list.nil
|
||||||
|
|
||||||
namespace list
|
namespace list
|
||||||
notation h :: t := cons h t
|
notation h :: t := cons h t
|
||||||
notation `[` l:(foldr `,` (h t, cons h t) nil `]`) := l
|
notation `[` l:(foldr `, ` (h t, cons h t) nil `]`) := l
|
||||||
|
|
||||||
variable {T : Type}
|
variable {T : Type}
|
||||||
|
|
||||||
|
@ -352,7 +352,7 @@ assume P, and.intro (ne_of_not_mem_cons P) (not_mem_of_not_mem_cons P)
|
||||||
|
|
||||||
definition sublist (l₁ l₂ : list T) := ∀ ⦃a : T⦄, a ∈ l₁ → a ∈ l₂
|
definition sublist (l₁ l₂ : list T) := ∀ ⦃a : T⦄, a ∈ l₁ → a ∈ l₂
|
||||||
|
|
||||||
infix `⊆` := sublist
|
infix ⊆ := sublist
|
||||||
|
|
||||||
theorem nil_sub [simp] (l : list T) : [] ⊆ l :=
|
theorem nil_sub [simp] (l : list T) : [] ⊆ l :=
|
||||||
λ b i, false.elim (iff.mp (mem_nil_iff b) i)
|
λ b i, false.elim (iff.mp (mem_nil_iff b) i)
|
||||||
|
|
|
@ -17,7 +17,7 @@ definition val [reducible] (M : matrix A m n) (i : fin m) (j : fin n) : A :=
|
||||||
M i j
|
M i j
|
||||||
|
|
||||||
namespace ops
|
namespace ops
|
||||||
notation M `[` i `,` j `]` := val M i j
|
notation M `[` i `, ` j `]` := val M i j
|
||||||
end ops
|
end ops
|
||||||
|
|
||||||
open ops
|
open ops
|
||||||
|
|
|
@ -14,7 +14,7 @@ namespace nat
|
||||||
|
|
||||||
definition addl (x y : ℕ) : ℕ :=
|
definition addl (x y : ℕ) : ℕ :=
|
||||||
nat.rec y (λ n r, succ r) x
|
nat.rec y (λ n r, succ r) x
|
||||||
infix `⊕`:65 := addl
|
infix ` ⊕ `:65 := addl
|
||||||
|
|
||||||
theorem addl_succ_right (n m : ℕ) : n ⊕ succ m = succ (n ⊕ m) :=
|
theorem addl_succ_right (n m : ℕ) : n ⊕ succ m = succ (n ⊕ m) :=
|
||||||
nat.induction_on n
|
nat.induction_on n
|
||||||
|
|
|
@ -78,7 +78,7 @@ if H : 0 < y ∧ y ≤ x then f (x - y) (div_rec_lemma H) y else x
|
||||||
|
|
||||||
definition modulo := fix mod.F
|
definition modulo := fix mod.F
|
||||||
notation a mod b := modulo a b
|
notation a mod b := modulo a b
|
||||||
notation a `≡` b `[mod`:100 c `]`:0 := a mod c = b mod c
|
notation a ≡ b `[mod `:100 c `]`:0 := a mod c = b mod c
|
||||||
|
|
||||||
theorem modulo_def (x y : nat) : modulo x y = if 0 < y ∧ y ≤ x then modulo (x - y) y else x :=
|
theorem modulo_def (x y : nat) : modulo x y = if 0 < y ∧ y ≤ x then modulo (x - y) y else x :=
|
||||||
congr_fun (fix_eq mod.F x) y
|
congr_fun (fix_eq mod.F x) y
|
||||||
|
|
|
@ -31,7 +31,7 @@ private lemma lbp_succ {x : nat} : lbp x → ¬ p x → lbp (succ x) :=
|
||||||
private definition gtb (a b : nat) : Prop :=
|
private definition gtb (a b : nat) : Prop :=
|
||||||
a > b ∧ lbp a
|
a > b ∧ lbp a
|
||||||
|
|
||||||
local infix `≺`:50 := gtb
|
local infix ` ≺ `:50 := gtb
|
||||||
|
|
||||||
private lemma acc_of_px {x : nat} : p x → acc gtb x :=
|
private lemma acc_of_px {x : nat} : p x → acc gtb x :=
|
||||||
assume h,
|
assume h,
|
||||||
|
|
|
@ -17,7 +17,7 @@ private definition pair_nat.lt.wf : well_founded pair_nat.lt :=
|
||||||
intro_k (measure.wf pr₂) 20 -- we use intro_k to be able to execute gcd efficiently in the kernel
|
intro_k (measure.wf pr₂) 20 -- we use intro_k to be able to execute gcd efficiently in the kernel
|
||||||
|
|
||||||
local attribute pair_nat.lt.wf [instance] -- instance will not be saved in .olean
|
local attribute pair_nat.lt.wf [instance] -- instance will not be saved in .olean
|
||||||
local infixl `≺`:50 := pair_nat.lt
|
local infixl ` ≺ `:50 := pair_nat.lt
|
||||||
|
|
||||||
private definition gcd.lt.dec (x y₁ : nat) : (succ y₁, x mod succ y₁) ≺ (x, succ y₁) :=
|
private definition gcd.lt.dec (x y₁ : nat) : (succ y₁, x mod succ y₁) ≺ (x, succ y₁) :=
|
||||||
!mod_lt (succ_pos y₁)
|
!mod_lt (succ_pos y₁)
|
||||||
|
|
|
@ -77,7 +77,7 @@ namespace pos_num
|
||||||
end
|
end
|
||||||
|
|
||||||
local notation a < b := (lt a b = tt)
|
local notation a < b := (lt a b = tt)
|
||||||
local notation a `≮`:50 b:50 := (lt a b = ff)
|
local notation a ` ≮ `:50 b:50 := (lt a b = ff)
|
||||||
|
|
||||||
theorem lt_one_right_eq_ff : ∀ a : pos_num, a ≮ one
|
theorem lt_one_right_eq_ff : ∀ a : pos_num, a ≮ one
|
||||||
| one := rfl
|
| one := rfl
|
||||||
|
|
|
@ -27,18 +27,18 @@ theorem pnat_pos (p : ℕ+) : p~ > 0 := has_property p
|
||||||
|
|
||||||
definition add (p q : ℕ+) : ℕ+ :=
|
definition add (p q : ℕ+) : ℕ+ :=
|
||||||
tag (p~ + q~) (nat.add_pos (pnat_pos p) (pnat_pos q))
|
tag (p~ + q~) (nat.add_pos (pnat_pos p) (pnat_pos q))
|
||||||
infix `+` := add
|
infix + := add
|
||||||
|
|
||||||
definition mul (p q : ℕ+) : ℕ+ :=
|
definition mul (p q : ℕ+) : ℕ+ :=
|
||||||
tag (p~ * q~) (nat.mul_pos (pnat_pos p) (pnat_pos q))
|
tag (p~ * q~) (nat.mul_pos (pnat_pos p) (pnat_pos q))
|
||||||
infix `*` := mul
|
infix * := mul
|
||||||
|
|
||||||
definition le (p q : ℕ+) := p~ ≤ q~
|
definition le (p q : ℕ+) := p~ ≤ q~
|
||||||
infix `≤` := le
|
infix ≤ := le
|
||||||
notation p `≥` q := q ≤ p
|
notation p ≥ q := q ≤ p
|
||||||
|
|
||||||
definition lt (p q : ℕ+) := p~ < q~
|
definition lt (p q : ℕ+) := p~ < q~
|
||||||
infix `<` := lt
|
infix < := lt
|
||||||
|
|
||||||
protected theorem pnat.eq {p q : ℕ+} : p~ = q~ → p = q :=
|
protected theorem pnat.eq {p q : ℕ+} : p~ = q~ → p = q :=
|
||||||
subtype.eq
|
subtype.eq
|
||||||
|
|
|
@ -22,7 +22,7 @@ namespace prerat
|
||||||
|
|
||||||
definition equiv (a b : prerat) : Prop := num a * denom b = num b * denom a
|
definition equiv (a b : prerat) : Prop := num a * denom b = num b * denom a
|
||||||
|
|
||||||
infix `≡` := equiv
|
infix ≡ := equiv
|
||||||
|
|
||||||
theorem equiv.refl [refl] (a : prerat) : a ≡ a := rfl
|
theorem equiv.refl [refl] (a : prerat) : a ≡ a := rfl
|
||||||
|
|
||||||
|
@ -539,12 +539,12 @@ section migrate_algebra
|
||||||
local attribute rat.discrete_field [instance]
|
local attribute rat.discrete_field [instance]
|
||||||
|
|
||||||
definition divide (a b : rat) := algebra.divide a b
|
definition divide (a b : rat) := algebra.divide a b
|
||||||
infix [priority rat.prio] `/` := divide
|
infix [priority rat.prio] / := divide
|
||||||
|
|
||||||
definition pow (a : ℚ) (n : ℕ) : ℚ := algebra.pow a n
|
definition pow (a : ℚ) (n : ℕ) : ℚ := algebra.pow a n
|
||||||
infix [priority rat.prio] ^ := pow
|
infix [priority rat.prio] ^ := pow
|
||||||
definition nmul (n : ℕ) (a : ℚ) : ℚ := algebra.nmul n a
|
definition nmul (n : ℕ) (a : ℚ) : ℚ := algebra.nmul n a
|
||||||
infix [priority rat.prio] `⬝` := nmul
|
infix [priority rat.prio] ⬝ := nmul
|
||||||
definition imul (i : ℤ) (a : ℚ) : ℚ := algebra.imul i a
|
definition imul (i : ℤ) (a : ℚ) : ℚ := algebra.imul i a
|
||||||
|
|
||||||
migrate from algebra with rat
|
migrate from algebra with rat
|
||||||
|
|
|
@ -936,16 +936,16 @@ definition requiv.trans (s t u : reg_seq) (H : requiv s t) (H2 : requiv t u) : r
|
||||||
definition radd (s t : reg_seq) : reg_seq :=
|
definition radd (s t : reg_seq) : reg_seq :=
|
||||||
reg_seq.mk (sadd (reg_seq.sq s) (reg_seq.sq t))
|
reg_seq.mk (sadd (reg_seq.sq s) (reg_seq.sq t))
|
||||||
(reg_add_reg (reg_seq.is_reg s) (reg_seq.is_reg t))
|
(reg_add_reg (reg_seq.is_reg s) (reg_seq.is_reg t))
|
||||||
infix `+` := radd
|
infix + := radd
|
||||||
|
|
||||||
definition rmul (s t : reg_seq) : reg_seq :=
|
definition rmul (s t : reg_seq) : reg_seq :=
|
||||||
reg_seq.mk (smul (reg_seq.sq s) (reg_seq.sq t))
|
reg_seq.mk (smul (reg_seq.sq s) (reg_seq.sq t))
|
||||||
(reg_mul_reg (reg_seq.is_reg s) (reg_seq.is_reg t))
|
(reg_mul_reg (reg_seq.is_reg s) (reg_seq.is_reg t))
|
||||||
infix `*` := rmul
|
infix * := rmul
|
||||||
|
|
||||||
definition rneg (s : reg_seq) : reg_seq :=
|
definition rneg (s : reg_seq) : reg_seq :=
|
||||||
reg_seq.mk (sneg (reg_seq.sq s)) (reg_neg_reg (reg_seq.is_reg s))
|
reg_seq.mk (sneg (reg_seq.sq s)) (reg_neg_reg (reg_seq.is_reg s))
|
||||||
prefix `-` := rneg
|
prefix - := rneg
|
||||||
|
|
||||||
definition radd_well_defined {s t u v : reg_seq} (H : requiv s u) (H2 : requiv t v) :
|
definition radd_well_defined {s t u v : reg_seq} (H : requiv s u) (H2 : requiv t v) :
|
||||||
requiv (s + t) (u + v) :=
|
requiv (s + t) (u + v) :=
|
||||||
|
@ -1025,13 +1025,13 @@ definition add (x y : ℝ) : ℝ :=
|
||||||
(take a b c d : reg_seq, take Hab : requiv a c, take Hcd : requiv b d,
|
(take a b c d : reg_seq, take Hab : requiv a c, take Hcd : requiv b d,
|
||||||
quot.sound (radd_well_defined Hab Hcd)))
|
quot.sound (radd_well_defined Hab Hcd)))
|
||||||
protected definition prio := num.pred rat.prio
|
protected definition prio := num.pred rat.prio
|
||||||
infix [priority real.prio] `+` := add
|
infix [priority real.prio] + := add
|
||||||
|
|
||||||
definition mul (x y : ℝ) : ℝ :=
|
definition mul (x y : ℝ) : ℝ :=
|
||||||
(quot.lift_on₂ x y (λ a b, quot.mk (a * b))
|
(quot.lift_on₂ x y (λ a b, quot.mk (a * b))
|
||||||
(take a b c d : reg_seq, take Hab : requiv a c, take Hcd : requiv b d,
|
(take a b c d : reg_seq, take Hab : requiv a c, take Hcd : requiv b d,
|
||||||
quot.sound (rmul_well_defined Hab Hcd)))
|
quot.sound (rmul_well_defined Hab Hcd)))
|
||||||
infix [priority real.prio] `*` := mul
|
infix [priority real.prio] * := mul
|
||||||
|
|
||||||
definition neg (x : ℝ) : ℝ :=
|
definition neg (x : ℝ) : ℝ :=
|
||||||
(quot.lift_on x (λ a, quot.mk (-a)) (take a b : reg_seq, take Hab : requiv a b,
|
(quot.lift_on x (λ a, quot.mk (-a)) (take a b : reg_seq, take Hab : requiv a b,
|
||||||
|
|
|
@ -15,17 +15,17 @@ variable {X : Type}
|
||||||
/- membership and subset -/
|
/- membership and subset -/
|
||||||
|
|
||||||
definition mem [reducible] (x : X) (a : set X) := a x
|
definition mem [reducible] (x : X) (a : set X) := a x
|
||||||
infix `∈` := mem
|
infix ∈ := mem
|
||||||
notation a ∉ b := ¬ mem a b
|
notation a ∉ b := ¬ mem a b
|
||||||
|
|
||||||
theorem ext {a b : set X} (H : ∀x, x ∈ a ↔ x ∈ b) : a = b :=
|
theorem ext {a b : set X} (H : ∀x, x ∈ a ↔ x ∈ b) : a = b :=
|
||||||
funext (take x, propext (H x))
|
funext (take x, propext (H x))
|
||||||
|
|
||||||
definition subset (a b : set X) := ∀⦃x⦄, x ∈ a → x ∈ b
|
definition subset (a b : set X) := ∀⦃x⦄, x ∈ a → x ∈ b
|
||||||
infix `⊆` := subset
|
infix ⊆ := subset
|
||||||
|
|
||||||
definition superset [reducible] (s t : set X) : Prop := t ⊆ s
|
definition superset [reducible] (s t : set X) : Prop := t ⊆ s
|
||||||
infix `⊇` := superset
|
infix ⊇ := superset
|
||||||
|
|
||||||
theorem subset.refl (a : set X) : a ⊆ a := take x, assume H, H
|
theorem subset.refl (a : set X) : a ⊆ a := take x, assume H, H
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ assume h₁ h₂, h₁ _ h₂
|
||||||
/- strict subset -/
|
/- strict subset -/
|
||||||
|
|
||||||
definition strict_subset (a b : set X) := a ⊆ b ∧ a ≠ b
|
definition strict_subset (a b : set X) := a ⊆ b ∧ a ≠ b
|
||||||
infix `⊂`:50 := strict_subset
|
infix ` ⊂ `:50 := strict_subset
|
||||||
|
|
||||||
theorem strict_subset.irrefl (a : set X) : ¬ a ⊂ a :=
|
theorem strict_subset.irrefl (a : set X) : ¬ a ⊂ a :=
|
||||||
assume h, absurd rfl (and.elim_right h)
|
assume h, absurd rfl (and.elim_right h)
|
||||||
|
@ -235,18 +235,18 @@ ext (take x, !or.right_distrib)
|
||||||
|
|
||||||
-- {x : X | P}
|
-- {x : X | P}
|
||||||
definition set_of [reducible] (P : X → Prop) : set X := P
|
definition set_of [reducible] (P : X → Prop) : set X := P
|
||||||
notation `{` binder `|` r:(scoped:1 P, set_of P) `}` := r
|
notation `{` binder ` | ` r:(scoped:1 P, set_of P) `}` := r
|
||||||
|
|
||||||
-- {x ∈ s | P}
|
-- {x ∈ s | P}
|
||||||
definition sep (P : X → Prop) (s : set X) : set X := λx, x ∈ s ∧ P x
|
definition sep (P : X → Prop) (s : set X) : set X := λx, x ∈ s ∧ P x
|
||||||
notation `{` binder ∈ s `|` r:(scoped:1 p, sep p s) `}` := r
|
notation `{` binder ` ∈ ` s ` | ` r:(scoped:1 p, sep p s) `}` := r
|
||||||
|
|
||||||
/- insert -/
|
/- insert -/
|
||||||
|
|
||||||
definition insert (x : X) (a : set X) : set X := {y : X | y = x ∨ y ∈ a}
|
definition insert (x : X) (a : set X) : set X := {y : X | y = x ∨ y ∈ a}
|
||||||
|
|
||||||
-- '{x, y, z}
|
-- '{x, y, z}
|
||||||
notation `'{`:max a:(foldr `,` (x b, insert x b) ∅) `}`:0 := a
|
notation `'{`:max a:(foldr `, ` (x b, insert x b) ∅) `}`:0 := a
|
||||||
|
|
||||||
theorem subset_insert (x : X) (a : set X) : a ⊆ insert x a :=
|
theorem subset_insert (x : X) (a : set X) : a ⊆ insert x a :=
|
||||||
take y, assume ys, or.inr ys
|
take y, assume ys, or.inr ys
|
||||||
|
|
|
@ -13,8 +13,8 @@ notation A ⊎ B := sum A B
|
||||||
namespace sum
|
namespace sum
|
||||||
notation A + B := sum A B
|
notation A + B := sum A B
|
||||||
namespace low_precedence_plus
|
namespace low_precedence_plus
|
||||||
reserve infixr `+`:25 -- conflicts with notation for addition
|
reserve infixr ` + `:25 -- conflicts with notation for addition
|
||||||
infixr `+` := sum
|
infixr + := sum
|
||||||
end low_precedence_plus
|
end low_precedence_plus
|
||||||
|
|
||||||
variables {A B : Type}
|
variables {A B : Type}
|
||||||
|
|
|
@ -152,7 +152,7 @@ section
|
||||||
ne_false_of_self trivial
|
ne_false_of_self trivial
|
||||||
end
|
end
|
||||||
|
|
||||||
infixl `==`:50 := heq
|
infixl ` == `:50 := heq
|
||||||
|
|
||||||
namespace heq
|
namespace heq
|
||||||
universe variable u
|
universe variable u
|
||||||
|
@ -233,7 +233,7 @@ and.rec H₂ H₁
|
||||||
|
|
||||||
/- or -/
|
/- or -/
|
||||||
|
|
||||||
notation a `\/` b := or a b
|
notation a \/ b := or a b
|
||||||
notation a ∨ b := or a b
|
notation a ∨ b := or a b
|
||||||
|
|
||||||
namespace or
|
namespace or
|
||||||
|
@ -321,8 +321,8 @@ intro : ∀ (a : A), P a → Exists P
|
||||||
|
|
||||||
definition exists.intro := @Exists.intro
|
definition exists.intro := @Exists.intro
|
||||||
|
|
||||||
notation `exists` binders `,` r:(scoped P, Exists P) := r
|
notation `exists` binders `, ` r:(scoped P, Exists P) := r
|
||||||
notation `∃` binders `,` r:(scoped P, Exists P) := r
|
notation `∃` binders `, ` r:(scoped P, Exists P) := r
|
||||||
|
|
||||||
theorem exists.elim {A : Type} {p : A → Prop} {B : Prop}
|
theorem exists.elim {A : Type} {p : A → Prop} {B : Prop}
|
||||||
(H1 : ∃x, p x) (H2 : ∀ (a : A), p a → B) : B :=
|
(H1 : ∃x, p x) (H2 : ∀ (a : A), p a → B) : B :=
|
||||||
|
|
|
@ -16,15 +16,15 @@ namespace nat
|
||||||
| refl : le a a
|
| refl : le a a
|
||||||
| step : Π {b}, le a b → le a (succ b)
|
| step : Π {b}, le a b → le a (succ b)
|
||||||
|
|
||||||
infix `≤` := le
|
infix ≤ := le
|
||||||
attribute le.refl [refl]
|
attribute le.refl [refl]
|
||||||
|
|
||||||
definition lt [reducible] (n m : ℕ) := succ n ≤ m
|
definition lt [reducible] (n m : ℕ) := succ n ≤ m
|
||||||
definition ge [reducible] (n m : ℕ) := m ≤ n
|
definition ge [reducible] (n m : ℕ) := m ≤ n
|
||||||
definition gt [reducible] (n m : ℕ) := succ m ≤ n
|
definition gt [reducible] (n m : ℕ) := succ m ≤ n
|
||||||
infix `<` := lt
|
infix < := lt
|
||||||
infix `≥` := ge
|
infix ≥ := ge
|
||||||
infix `>` := gt
|
infix > := gt
|
||||||
|
|
||||||
definition pred [unfold 1] (a : nat) : nat :=
|
definition pred [unfold 1] (a : nat) : nat :=
|
||||||
nat.cases_on a zero (λ a₁, a₁)
|
nat.cases_on a zero (λ a₁, a₁)
|
||||||
|
|
|
@ -9,7 +9,7 @@ import init.num init.wf
|
||||||
definition pair [constructor] := @prod.mk
|
definition pair [constructor] := @prod.mk
|
||||||
notation A × B := prod A B
|
notation A × B := prod A B
|
||||||
-- notation for n-ary tuples
|
-- 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
|
||||||
|
|
||||||
namespace prod
|
namespace prod
|
||||||
notation [parsing-only] A * B := prod A B
|
notation [parsing-only] A * B := prod A B
|
||||||
|
|
|
@ -33,65 +33,65 @@ num.succ (num.succ (num.succ (num.succ (num.succ (num.succ (num.succ (num.succ (
|
||||||
/- Logical operations and relations -/
|
/- Logical operations and relations -/
|
||||||
|
|
||||||
reserve prefix `¬`:40
|
reserve prefix `¬`:40
|
||||||
reserve prefix `~`:40
|
reserve prefix ` ~ `:40
|
||||||
reserve infixr `∧`:35
|
reserve infixr ` ∧ `:35
|
||||||
reserve infixr `/\`:35
|
reserve infixr ` /\ `:35
|
||||||
reserve infixr `\/`:30
|
reserve infixr ` \/ `:30
|
||||||
reserve infixr `∨`:30
|
reserve infixr ` ∨ `:30
|
||||||
reserve infix `<->`:20
|
reserve infix ` <-> `:20
|
||||||
reserve infix `↔`:20
|
reserve infix ` ↔ `:20
|
||||||
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 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 postfix `⁻¹`:std.prec.max_plus -- input with \sy or \-1 or \inv
|
||||||
|
|
||||||
reserve infixl `⬝`:75
|
reserve infixl ` ⬝ `:75
|
||||||
reserve infixr `▸`:75
|
reserve infixr ` ▸ `:75
|
||||||
reserve infixr `▹`:75
|
reserve infixr ` ▹ `:75
|
||||||
|
|
||||||
/- types and type constructors -/
|
/- types and type constructors -/
|
||||||
|
|
||||||
reserve infixl `⊎`:25
|
reserve infixl ` ⊎ `:25
|
||||||
reserve infixl `×`:30
|
reserve infixl ` × `:30
|
||||||
|
|
||||||
/- arithmetic operations -/
|
/- arithmetic operations -/
|
||||||
|
|
||||||
reserve infixl `+`:65
|
reserve infixl ` + `:65
|
||||||
reserve infixl `-`:65
|
reserve infixl ` - `:65
|
||||||
reserve infixl `*`:70
|
reserve infixl ` * `:70
|
||||||
reserve infixl `div`:70
|
reserve infixl ` div `:70
|
||||||
reserve infixl `mod`:70
|
reserve infixl ` mod `:70
|
||||||
reserve infixl `/`:70
|
reserve infixl ` / `:70
|
||||||
reserve prefix `-`:100
|
reserve prefix `-`:100
|
||||||
reserve infix `^`:80
|
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 -/
|
/- boolean operations -/
|
||||||
|
|
||||||
reserve infixl `&&`:70
|
reserve infixl ` && `:70
|
||||||
reserve infixl `||`:65
|
reserve infixl ` || `:65
|
||||||
|
|
||||||
/- set operations -/
|
/- set operations -/
|
||||||
|
|
||||||
reserve infix `∈`:50
|
reserve infix ` ∈ `:50
|
||||||
reserve infix `∉`:50
|
reserve infix ` ∉ `:50
|
||||||
reserve infixl `∩`:70
|
reserve infixl ` ∩ `:70
|
||||||
reserve infixl `∪`:65
|
reserve infixl ` ∪ `:65
|
||||||
reserve infix `⊆`:50
|
reserve infix ` ⊆ `:50
|
||||||
reserve infix `⊇`:50
|
reserve infix ` ⊇ `:50
|
||||||
|
|
||||||
/- other symbols -/
|
/- other symbols -/
|
||||||
|
|
||||||
reserve infix `∣`:50
|
reserve infix ` ∣ `:50
|
||||||
reserve infixl `++`:65
|
reserve infixl ` ++ `:65
|
||||||
reserve infixr `::`:65
|
reserve infixr ` :: `:65
|
||||||
|
|
|
@ -7,9 +7,9 @@ prelude
|
||||||
import init.datatypes init.num init.wf init.logic init.tactic
|
import init.datatypes init.num init.wf init.logic init.tactic
|
||||||
|
|
||||||
definition dpair := @sigma.mk
|
definition dpair := @sigma.mk
|
||||||
notation `Σ` binders `,` r:(scoped P, sigma P) := r
|
notation `Σ` binders `, ` r:(scoped P, sigma P) := r
|
||||||
-- notation for n-ary tuples; input ⟨ ⟩ as \< \>
|
-- notation for n-ary tuples; input ⟨ ⟩ as \< \>
|
||||||
notation `⟨`:max t:(foldr `,` (e r, sigma.mk e r)) `⟩`:0 := t
|
notation `⟨`:max t:(foldr `, ` (e r, sigma.mk e r)) `⟩`:0 := t
|
||||||
|
|
||||||
lemma ex_of_sig {A : Type} {P : A → Prop} : (Σ x, P x) → ∃ x, P x :=
|
lemma ex_of_sig {A : Type} {P : A → Prop} : (Σ x, P x) → ∃ x, P x :=
|
||||||
assume h, obtain x hx, from h, exists.intro x hx
|
assume h, obtain x hx, from h, exists.intro x hx
|
||||||
|
|
|
@ -12,7 +12,7 @@ set_option structure.proj_mk_thm true
|
||||||
structure subtype {A : Type} (P : A → Prop) :=
|
structure subtype {A : Type} (P : A → Prop) :=
|
||||||
tag :: (elt_of : A) (has_property : P elt_of)
|
tag :: (elt_of : A) (has_property : P elt_of)
|
||||||
|
|
||||||
notation `{` binder `|` r:(scoped:1 P, subtype P) `}` := r
|
notation `{` binder ` | ` r:(scoped:1 P, subtype P) `}` := r
|
||||||
|
|
||||||
definition ex_of_sub {A : Type} {P : A → Prop} : { x | P x } → ∃ x, P x
|
definition ex_of_sub {A : Type} {P : A → Prop} : { x | P x } → ∃ x, P x
|
||||||
| (subtype.tag a h) := exists.intro a h
|
| (subtype.tag a h) := exists.intro a h
|
||||||
|
|
Loading…
Reference in a new issue