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

Commit 1530d76

Browse files
committed
feat(group_theory/congruence): add con.lift_on_units etc (#8488)
Add a helper function that makes it easier to define a function on `units (con.quotient c)`.
1 parent 9c4dd02 commit 1530d76

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

src/group_theory/congruence.lean

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,10 @@ protected lemma trans : ∀ {x y z}, c x y → c y z → c x z :=
132132
protected lemma mul : ∀ {w x y z}, c w x → c y z → c (w * y) (x * z) :=
133133
λ _ _ _ _ h1 h2, c.3 h1 h2
134134

135+
@[simp, to_additive] lemma rel_mk {r : M → M → Prop} {h₁ h₂ a b} :
136+
con.mk r h₁ h₂ a b ↔ r a b :=
137+
iff.rfl
138+
135139
/-- Given a type `M` with a multiplication, a congruence relation `c` on `M`, and elements of `M`
136140
`x, y`, `(x, y) ∈ M × M` iff `x` is related to `y` by `c`. -/
137141
@[to_additive "Given a type `M` with an addition, `x, y ∈ M`, and an additive congruence relation
@@ -215,6 +219,10 @@ instance : has_coe_t M c.quotient := ⟨@quotient.mk _ c.to_setoid⟩
215219
instance [d : ∀ a b, decidable (c a b)] : decidable_eq c.quotient :=
216220
@quotient.decidable_eq M c.to_setoid d
217221

222+
@[simp, to_additive] lemma quot_mk_eq_coe {M : Type*} [has_mul M] (c : con M) (x : M) :
223+
quot.mk c x = (x : c.quotient) :=
224+
rfl
225+
218226
/-- The function on the quotient by a congruence relation `c` induced by a function that is
219227
constant on `c`'s equivalence classes. -/
220228
@[elab_as_eliminator, to_additive "The function on the quotient by a congruence relation `c`
@@ -229,6 +237,20 @@ induced by a binary function that is constant on `c`'s equivalence classes."]
229237
protected def lift_on₂ {β} {c : con M} (q r : c.quotient) (f : M → M → β)
230238
(h : ∀ a₁ a₂ b₁ b₂, c a₁ b₁ → c a₂ b₂ → f a₁ a₂ = f b₁ b₂) : β := quotient.lift_on₂' q r f h
231239

240+
/-- A version of `quotient.hrec_on₂'` for quotients by `con`. -/
241+
@[to_additive "A version of `quotient.hrec_on₂'` for quotients by `add_con`."]
242+
protected def hrec_on₂ {cM : con M} {cN : con N} {φ : cM.quotient → cN.quotient → Sort*}
243+
(a : cM.quotient) (b : cN.quotient)
244+
(f : Π (x : M) (y : N), φ x y) (h : ∀ x y x' y', cM x x' → cN y y' → f x y == f x' y') :
245+
φ a b :=
246+
quotient.hrec_on₂' a b f h
247+
248+
@[simp, to_additive] lemma hrec_on₂_coe {cM : con M} {cN : con N}
249+
{φ : cM.quotient → cN.quotient → Sort*} (a : M) (b : N)
250+
(f : Π (x : M) (y : N), φ x y) (h : ∀ x y x' y', cM x x' → cN y y' → f x y == f x' y') :
251+
con.hrec_on₂ ↑a ↑b f h = f a b :=
252+
rfl
253+
232254
variables {c}
233255

234256
/-- The inductive principle used to prove propositions about the elements of a quotient by a
@@ -902,4 +924,52 @@ instance group : group c.quotient :=
902924

903925
end groups
904926

927+
section units
928+
929+
variables {α : Type*} [monoid M] {c : con M}
930+
931+
/-- In order to define a function `units (con.quotient c) → α` on the units of `con.quotient c`,
932+
where `c : con M` is a multiplicative congruence on a monoid, it suffices to define a function `f`
933+
that takes elements `x y : M` with proofs of `c (x * y) 1` and `c (y * x) 1`, and returns an element
934+
of `α` provided that `f x y _ _ = f x' y' _ _` whenever `c x x'` and `c y y'`. -/
935+
@[to_additive lift_on_add_units] def lift_on_units (u : units c.quotient)
936+
(f : Π (x y : M), c (x * y) 1 → c (y * x) 1 → α)
937+
(Hf : ∀ x y hxy hyx x' y' hxy' hyx', c x x' → c y y' → f x y hxy hyx = f x' y' hxy' hyx') :
938+
α :=
939+
begin
940+
refine @con.hrec_on₂ M M _ _ c c (λ x y, x * y = 1 → y * x = 1 → α)
941+
(u : c.quotient) (↑u⁻¹ : c.quotient)
942+
(λ (x y : M) (hxy : (x * y : c.quotient) = 1) (hyx : (y * x : c.quotient) = 1),
943+
f x y (c.eq.1 hxy) (c.eq.1 hyx)) (λ x y x' y' hx hy, _) u.3 u.4,
944+
ext1, { rw [c.eq.2 hx, c.eq.2 hy] },
945+
rintro Hxy Hxy' -,
946+
ext1, { rw [c.eq.2 hx, c.eq.2 hy] },
947+
rintro Hyx Hyx' -,
948+
exact heq_of_eq (Hf _ _ _ _ _ _ _ _ hx hy)
949+
end
950+
951+
/-- In order to define a function `units (con.quotient c) → α` on the units of `con.quotient c`,
952+
where `c : con M` is a multiplicative congruence on a monoid, it suffices to define a function `f`
953+
that takes elements `x y : M` with proofs of `c (x * y) 1` and `c (y * x) 1`, and returns an element
954+
of `α` provided that `f x y _ _ = f x' y' _ _` whenever `c x x'` and `c y y'`. -/
955+
add_decl_doc add_con.lift_on_add_units
956+
957+
@[simp, to_additive]
958+
lemma lift_on_units_mk (f : Π (x y : M), c (x * y) 1 → c (y * x) 1 → α)
959+
(Hf : ∀ x y hxy hyx x' y' hxy' hyx', c x x' → c y y' → f x y hxy hyx = f x' y' hxy' hyx')
960+
(x y : M) (hxy hyx) :
961+
lift_on_units ⟨(x : c.quotient), y, hxy, hyx⟩ f Hf = f x y (c.eq.1 hxy) (c.eq.1 hyx) :=
962+
rfl
963+
964+
@[elab_as_eliminator, to_additive induction_on_add_units]
965+
lemma induction_on_units {p : units c.quotient → Prop} (u : units c.quotient)
966+
(H : ∀ (x y : M) (hxy : c (x * y) 1) (hyx : c (y * x) 1), p ⟨x, y, c.eq.2 hxy, c.eq.2 hyx⟩) :
967+
p u :=
968+
begin
969+
rcases u with ⟨⟨x⟩, ⟨y⟩, h₁, h₂⟩,
970+
exact H x y (c.eq.1 h₁) (c.eq.1 h₂)
971+
end
972+
973+
end units
974+
905975
end con

0 commit comments

Comments
 (0)