lean2/library/init/setoid.lean
2015-12-05 11:54:27 -08:00

28 lines
762 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
structure setoid [class] (A : Type) :=
(r : A → A → Prop) (iseqv : equivalence r)
namespace setoid
infix ` ≈ ` := setoid.r
variable {A : Type}
variable [s : setoid A]
include s
theorem refl [refl] (a : A) : a ≈ a :=
and.elim_left (@setoid.iseqv A s) a
theorem symm [symm] {a b : A} : a ≈ b → b ≈ a :=
λ H, and.elim_left (and.elim_right (@setoid.iseqv A s)) a b H
theorem trans [trans] {a b c : A} : a ≈ b → b ≈ c → a ≈ c :=
λ H₁ H₂, and.elim_right (and.elim_right (@setoid.iseqv A s)) a b c H₁ H₂
end setoid