@@ -113,7 +113,7 @@ instance instFunLike : FunLike (α →₀ M) α M :=
113113 ext a
114114 exact (hf _).trans (hg _).symm⟩
115115
116- @[ext]
116+ @[ext, grind ext ]
117117theorem ext {f g : α →₀ M} (h : ∀ a, f a = g a) : f = g :=
118118 DFunLike.ext _ _ h
119119
@@ -299,7 +299,7 @@ def mapRange (f : M → N) (hf : f 0 = 0) (g : α →₀ M) : α →₀ N :=
299299 onFinset g.support (f ∘ g) fun a => by
300300 rw [mem_support_iff, not_imp_not]; exact fun H => (congr_arg f H).trans hf
301301
302- @[simp]
302+ @[simp, grind = ]
303303theorem mapRange_apply {f : M → N} {hf : f 0 = 0 } {g : α →₀ M} {a : α} :
304304 mapRange f hf g a = f (g a) :=
305305 rfl
@@ -419,8 +419,16 @@ theorem support_embDomain (f : α ↪ β) (v : α →₀ M) : (embDomain f v).su
419419theorem embDomain_zero (f : α ↪ β) : (embDomain f 0 : β →₀ M) = 0 :=
420420 rfl
421421
422- @[simp]
423- theorem embDomain_apply (f : α ↪ β) (v : α →₀ M) (a : α) : embDomain f v (f a) = v a := by
422+ open Classical in
423+ @[grind =]
424+ theorem embDomain_apply (f : α ↪ β) (v : α →₀ M) (b : β) :
425+ embDomain f v b = if h : ∃ a, f a = b then v h.choose else 0 := by
426+ simp only [embDomain, mem_map, mem_support_iff, coe_mk]
427+ -- TODO: investigate why `grind` needs `split_ifs` first; this should never happen.
428+ split_ifs <;> grind
429+
430+ @[simp, grind =]
431+ theorem embDomain_apply_self (f : α ↪ β) (v : α →₀ M) (a : α) : embDomain f v (f a) = v a := by
424432 classical
425433 simp_rw [embDomain, coe_mk, mem_map']
426434 split_ifs with h
@@ -436,7 +444,7 @@ theorem embDomain_notin_range (f : α ↪ β) (v : α →₀ M) (a : β) (h : a
436444 exact Set.mem_range_self a
437445
438446theorem embDomain_injective (f : α ↪ β) : Function.Injective (embDomain f : (α →₀ M) → β →₀ M) :=
439- fun l₁ l₂ h => ext fun a => by simpa only [embDomain_apply ] using DFunLike.ext_iff.1 h (f a)
447+ fun l₁ l₂ h => ext fun a => by simpa only [embDomain_apply_self ] using DFunLike.ext_iff.1 h (f a)
440448
441449@[simp]
442450theorem embDomain_inj {f : α ↪ β} {l₁ l₂ : α →₀ M} : embDomain f l₁ = embDomain f l₂ ↔ l₁ = l₂ :=
@@ -447,12 +455,7 @@ theorem embDomain_eq_zero {f : α ↪ β} {l : α →₀ M} : embDomain f l = 0
447455 (embDomain_injective f).eq_iff' <| embDomain_zero f
448456
449457theorem embDomain_mapRange (f : α ↪ β) (g : M → N) (p : α →₀ M) (hg : g 0 = 0 ) :
450- embDomain f (mapRange g hg p) = mapRange g hg (embDomain f p) := by
451- ext a
452- by_cases h : a ∈ Set.range f
453- · rcases h with ⟨a', rfl⟩
454- rw [mapRange_apply, embDomain_apply, embDomain_apply, mapRange_apply]
455- · rw [mapRange_apply, embDomain_notin_range, embDomain_notin_range, ← hg] <;> assumption
458+ embDomain f (mapRange g hg p) = mapRange g hg (embDomain f p) := by grind
456459
457460end EmbDomain
458461
0 commit comments