Zulip Chat Archive

Stream: new members

Topic: subtlety of field_simp, adding parenthesis can break it


RedPig (Oct 24 2024 at 21:43):

I am a bit confused by how far field_simp can go and what is it exactly doing

For instance field_simp can clear this first example

import Mathlib
example (x: ) (h1: x > 0)  : (1 - x) / x = 1/√x - x  := by
  field_simp

but fails on the second one

import Mathlib

example (x: ) (h1: x > 0) : (1 - x) / x = 1/√x + ( - x)  := by
  field_simp

we need an additional ring to close it.
Similar behavior happens in more complex situations. It works when adding a parenthesis

import Mathlib
example (x y z: ) (h1: x > 0) (h2: y > 0) (h3: z > 0) : (1 - x) / x + (1 - y) / y = 1/√x - x + (1/√y - y) := by
  field_simp

but it fails

import Mathlib
example (x y z: ) (h1: x > 0) (h2: y > 0) (h3: z > 0) : (1 - x) / x + (1 - y) / y = 1/√x - x + 1/√y - y := by
  field_simp

Why is it failing in the second example? Where is the subtlety coming from?
In the last example, even applying ring followed by field_simp failed

Kevin Buzzard (Oct 24 2024 at 22:40):

Probably the underlying cause is that simp solves some but not all of the things that ring solves and sometimes you just get lucky.


Last updated: May 02 2025 at 03:31 UTC