Skip to content

Commit

Permalink
chore(*): Prevent lemmas about the injectivity of coe_fn introducin…
Browse files Browse the repository at this point in the history
…g un-reduced lambda terms (#8386)

This follows on from #6344, and fixes every result for `function.injective (λ` that is about coe_fn.
  • Loading branch information
eric-wieser committed Jul 22, 2021
1 parent 54adb19 commit e2cda0b
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/algebra/lie/basic.lean
Expand Up @@ -246,7 +246,7 @@ lemma one_apply (x : L₁) : (1 : (L₁ →ₗ⁅R⁆ L₁)) x = x := rfl

instance : inhabited (L₁ →ₗ⁅R⁆ L₂) := ⟨0

lemma coe_injective : function.injective (λ f : L₁ →ₗ⁅R⁆ L₂, show L₁ → L₂, from f) :=
lemma coe_injective : @function.injective (L₁ →ₗ⁅R⁆ L₂) (L₁ → L₂) coe_fn :=
by rintro ⟨f, _⟩ ⟨g, _⟩ ⟨h⟩; congr

@[ext] lemma ext {f g : L₁ →ₗ⁅R⁆ L₂} (h : ∀ x, f x = g x) : f = g :=
Expand Down Expand Up @@ -452,7 +452,7 @@ instance : has_one (M →ₗ⁅R,L⁆ M) := ⟨{ map_lie' := by simp, ..(1 : M

instance : inhabited (M →ₗ⁅R,L⁆ N) := ⟨0

lemma coe_injective : function.injective (λ f : M →ₗ⁅R,L⁆ N, show M → N, from f) :=
lemma coe_injective : @function.injective (M →ₗ⁅R,L⁆ N) (M → N) coe_fn :=
by { rintros ⟨f, _⟩ ⟨g, _⟩ ⟨h⟩, congr, }

@[ext] lemma ext {f g : M →ₗ⁅R,L⁆ N} (h : ∀ m, f m = g m) : f = g :=
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/normed_space/enorm.lean
Expand Up @@ -48,7 +48,7 @@ variables {𝕜 : Type*} {V : Type*} [normed_field 𝕜] [add_comm_group V] [mod

instance : has_coe_to_fun (enorm 𝕜 V) := ⟨_, enorm.to_fun⟩

lemma coe_fn_injective : function.injective (λ (e : enorm 𝕜 V) (x : V), e x) :=
lemma coe_fn_injective : @function.injective (enorm 𝕜 V) (V → ℝ≥0∞) coe_fn :=
λ e₁ e₂ h, by cases e₁; cases e₂; congr; exact h

@[ext] lemma ext {e₁ e₂ : enorm 𝕜 V} (h : ∀ x, e₁ x = e₂ x) : e₁ = e₂ :=
Expand Down
2 changes: 1 addition & 1 deletion src/data/equiv/basic.lean
Expand Up @@ -85,7 +85,7 @@ instance : has_coe_to_fun (α ≃ β) :=
rfl

/-- The map `coe_fn : (r ≃ s) → (r → s)` is injective. -/
theorem coe_fn_injective : function.injective (λ (e : α ≃ β) (x : α), e x)
theorem coe_fn_injective : @function.injective (α ≃ β) (α → β) coe_fn
| ⟨f₁, g₁, l₁, r₁⟩ ⟨f₂, g₂, l₂, r₂⟩ h :=
have f₁ = f₂, from h,
have g₁ = g₂, from l₁.eq_right_inverse (this.symm ▸ r₂),
Expand Down
2 changes: 1 addition & 1 deletion src/linear_algebra/affine_space/affine_map.lean
Expand Up @@ -125,7 +125,7 @@ end

lemma ext_iff {f g : P1 →ᵃ[k] P2} : f = g ↔ ∀ p, f p = g p := ⟨λ h p, h ▸ rfl, ext⟩

lemma coe_fn_injective : function.injective (λ (f : P1 →ᵃ[k] P2) (x : P1), f x) :=
lemma coe_fn_injective : @function.injective (P1 →ᵃ[k] P2) (P1 → P2) coe_fn :=
λ f g H, ext $ congr_fun H

protected lemma congr_arg (f : P1 →ᵃ[k] P2) {x y : P1} (h : x = y) : f x = f y :=
Expand Down
2 changes: 1 addition & 1 deletion src/order/rel_iso.lean
Expand Up @@ -438,7 +438,7 @@ theorem to_equiv_injective : injective (to_equiv : (r ≃r s) → α ≃ β)

/-- The map `coe_fn : (r ≃r s) → (α → β)` is injective. Lean fails to parse
`function.injective (λ e : r ≃r s, (e : α → β))`, so we use a trick to say the same. -/
theorem coe_fn_injective : function.injective (λ (e : r ≃r s) (x : α), e x) :=
theorem coe_fn_injective : @function.injective (r ≃r s) (α → β) coe_fn :=
equiv.coe_fn_injective.comp to_equiv_injective

@[ext] theorem ext ⦃f g : r ≃r s⦄ (h : ∀ x, f x = g x) : f = g :=
Expand Down
2 changes: 1 addition & 1 deletion src/topology/algebra/module.lean
Expand Up @@ -195,7 +195,7 @@ by { intros f g H, cases f, cases g, congr' }
(f : M →ₗ[R] M₂) = g ↔ f = g :=
coe_injective.eq_iff

theorem coe_fn_injective : function.injective (λ f : M →L[R] M₂, show M → M₂, from f) :=
theorem coe_fn_injective : @function.injective (M →L[R] M₂) (M → M₂) coe_fn :=
linear_map.coe_injective.comp coe_injective

@[ext] theorem ext {f g : M →L[R] M₂} (h : ∀ x, f x = g x) : f = g :=
Expand Down
2 changes: 1 addition & 1 deletion src/topology/locally_constant/basic.lean
Expand Up @@ -210,7 +210,7 @@ congr_arg (λ h : locally_constant X Y, h x) h
theorem congr_arg (f : locally_constant X Y) {x y : X} (h : x = y) : f x = f y :=
congr_arg (λ x : X, f x) h

theorem coe_injective : function.injective (λ (f : locally_constant X Y) (x : X), f x)
theorem coe_injective : @function.injective (locally_constant X Y) (X → Y) coe_fn
| ⟨f, hf⟩ ⟨g, hg⟩ h := have f = g, from h, by subst f

@[simp, norm_cast] theorem coe_inj {f g : locally_constant X Y} : (f : X → Y) = g ↔ f = g :=
Expand Down

0 comments on commit e2cda0b

Please sign in to comment.