2015-04-01 02:56:05 +00:00
|
|
|
/-
|
|
|
|
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
|
2015-09-30 23:52:34 +00:00
|
|
|
infix ` ≈ ` := setoid.r
|
2015-04-01 02:56:05 +00:00
|
|
|
|
|
|
|
variable {A : Type}
|
|
|
|
variable [s : setoid A]
|
|
|
|
include s
|
|
|
|
|
2015-12-05 18:10:59 +00:00
|
|
|
theorem refl [refl] (a : A) : a ≈ a :=
|
2015-04-01 02:56:05 +00:00
|
|
|
and.elim_left (@setoid.iseqv A s) a
|
|
|
|
|
2015-12-05 18:10:59 +00:00
|
|
|
theorem symm [symm] {a b : A} : a ≈ b → b ≈ a :=
|
2015-04-01 02:56:05 +00:00
|
|
|
λ H, and.elim_left (and.elim_right (@setoid.iseqv A s)) a b H
|
|
|
|
|
2015-12-05 18:10:59 +00:00
|
|
|
theorem trans [trans] {a b c : A} : a ≈ b → b ≈ c → a ≈ c :=
|
2015-04-01 02:56:05 +00:00
|
|
|
λ H₁ H₂, and.elim_right (and.elim_right (@setoid.iseqv A s)) a b c H₁ H₂
|
|
|
|
end setoid
|