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

Commit 8da5f23

Browse files
committed
feat(data/set/function): Extend update_comp lemmas to work on dependent functions (#5178)
Also extends them to `Sort`
1 parent 2189c7a commit 8da5f23

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

src/data/set/function.lean

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -721,9 +721,9 @@ end
721721

722722
end semiconj
723723

724-
lemma update_comp_eq_of_not_mem_range [decidable_eq β]
725-
(g : β → γ) {f : α → β} {i : β} (a : γ) (h : i ∉ set.range f) :
726-
(function.update g i a) ∘ f = g ∘ f :=
724+
lemma update_comp_eq_of_not_mem_range' {α β : Sort*} {γ : β → Sort*} [decidable_eq β]
725+
(g : Π b, γ b) {f : α → β} {i : β} (a : γ i) (h : i ∉ set.range f) :
726+
(λ j, (function.update g i a) (f j)) = (λ j, g (f j)) :=
727727
begin
728728
ext p,
729729
have : f p ≠ i,
@@ -734,9 +734,15 @@ begin
734734
simp [this],
735735
end
736736

737-
lemma update_comp_eq_of_injective [decidable_eq α] [decidable_eq β]
738-
(g : β → γ) {f : α → β} (hf : function.injective f) (i : α) (a : γ) :
739-
(function.update g (f i) a) ∘ f = function.update (g ∘ f) i a :=
737+
/-- Non-dependent version of `function.update_comp_eq_of_not_mem_range'` -/
738+
lemma update_comp_eq_of_not_mem_range {α β γ : Sort*} [decidable_eq β]
739+
(g : β → γ) {f : α → β} {i : β} (a : γ) (h : i ∉ set.range f) :
740+
(function.update g i a) ∘ f = g ∘ f :=
741+
update_comp_eq_of_not_mem_range' g a h
742+
743+
lemma update_comp_eq_of_injective' {α β : Sort*} {γ : β → Sort*} [decidable_eq α] [decidable_eq β]
744+
(g : Π b, γ b) {f : α → β} (hf : function.injective f) (i : α) (a : γ (f i)) :
745+
(λ j, function.update g (f i) a (f j)) = function.update (λ i, g (f i)) i a :=
740746
begin
741747
ext j,
742748
by_cases h : j = i,
@@ -745,4 +751,10 @@ begin
745751
simp [h, this] }
746752
end
747753

754+
/-- Non-dependent version of `function.update_comp_eq_of_injective'` -/
755+
lemma update_comp_eq_of_injective {α β γ : Sort*} [decidable_eq α] [decidable_eq β]
756+
(g : β → γ) {f : α → β} (hf : function.injective f) (i : α) (a : γ) :
757+
(function.update g (f i) a) ∘ f = function.update (g ∘ f) i a :=
758+
update_comp_eq_of_injective' g hf i a
759+
748760
end function

0 commit comments

Comments
 (0)