Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 6ed6abb

Browse files
feat(data/quot): make trunc a quotient (#18320)
This allows us to use `quotient` lemmas for `trunc`. mathlib4 PR: leanprover-community/mathlib4#1924 Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
1 parent afdb434 commit 6ed6abb

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/data/quot.lean

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -365,15 +365,21 @@ lemma nonempty_quotient_iff (s : setoid α) : nonempty (quotient s) ↔ nonempty
365365

366366
/-! ### Truncation -/
367367

368+
theorem true_equivalence : @equivalence α (λ _ _, true) :=
369+
⟨λ _, trivial, λ _ _ _, trivial, λ _ _ _ _ _, trivial⟩
370+
371+
/-- Always-true relation as a `setoid`.
372+
373+
Note that in later files the preferred spelling is `⊤ : setoid α`. -/
374+
def true_setoid : setoid α :=
375+
⟨_, true_equivalence⟩
376+
368377
/-- `trunc α` is the quotient of `α` by the always-true relation. This
369378
is related to the propositional truncation in HoTT, and is similar
370379
in effect to `nonempty α`, but unlike `nonempty α`, `trunc α` is data,
371380
so the VM representation is the same as `α`, and so this can be used to
372381
maintain computability. -/
373-
def {u} trunc (α : Sort u) : Sort u := @quot α (λ _ _, true)
374-
375-
theorem true_equivalence : @equivalence α (λ _ _, true) :=
376-
⟨λ _, trivial, λ _ _ _, trivial, λ _ _ _ _ _, trivial⟩
382+
def {u} trunc (α : Sort u) : Sort u := @quotient α true_setoid
377383

378384
namespace trunc
379385

0 commit comments

Comments
 (0)