lean4-htt/library/init/setoid.lean
2016-09-16 08:31:21 -07:00

37 lines
902 B
Text

/-
Copyright (c) 2015 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Leonardo de Moura
-/
prelude
import init.relation
set_option new_elaborator true
structure [class] setoid (A : Type) :=
(r : A → A → Prop) (iseqv : equivalence r)
namespace setoid
infix ` ≈ ` := setoid.r
variable {A : Type}
variable [s : setoid A]
include s
attribute [refl]
theorem refl (a : A) : a ≈ a :=
match setoid.iseqv A with
| ⟨H_refl, H_symm, H_trans⟩ := H_refl a
end
attribute [symm]
theorem symm {a b : A} (Hab : a ≈ b) : b ≈ a :=
match setoid.iseqv A with
| ⟨H_refl, H_symm, H_trans⟩ := H_symm Hab
end
attribute [trans]
theorem trans {a b c : A} (Hab : a ≈ b) (Hbc : b ≈ c) : a ≈ c :=
match setoid.iseqv A with
| ⟨H_refl, H_symm, H_trans⟩ := H_trans Hab Hbc
end
end setoid