Zulip Chat Archive
Stream: new members
Topic: field_simp for Fin structures
Alex Gu (Oct 24 2024 at 00:00):
I'm stuck figuring out how to generalize this simple example from 2 variables to n variables, getting field_simp to work. Any wisdom?
theorem inequality_2 (n : ℕ) (a : Fin 2 → ℝ) (ha : ∀ i, a i > 0) : ∑ i, √(a i) ^ 2 = ∑ i, a i := by
simp [Fin.sum_univ_two]
have h0 : a 0 > 0 := by exact ha 0
have h1 : a 1 > 0 := by exact ha 1
field_simp
theorem inequality_n (n : ℕ) (a : Fin n → ℝ) (ha : ∀ i, a i > 0) : ∑ i, √(a i) ^ 2 = ∑ i, a i := by
???
Eric Wieser (Oct 24 2024 at 00:10):
Does congr!
help?
Alex Gu (Oct 24 2024 at 00:15):
Yeah, I can do it with congr!
, but was wondering if there's a way to add some hypothesis to get field_simp to work here as well
Alex Gu (Oct 24 2024 at 00:19):
Completely separate, but is there a way to do congr!
and have the ghost variable x✝ : Fin n
be replaced with a concrete value?
Eric Wieser (Oct 24 2024 at 00:23):
congr! with i
have := ha i
field_simp
Alex Gu (Oct 24 2024 at 00:25):
Is it possible without congr!
? Similar to the version with 2 variables?
Heather Macbeth (Oct 24 2024 at 01:21):
Just a note that field_simp
is a bit misleading here -- its job is to clear denominators to fractions and that's not actually what you're doing. A lighter-weight version of the field_simp
line is simp (discharger := positivity)
.
Last updated: May 02 2025 at 03:31 UTC