Zulip Chat Archive

Stream: new members

Topic: simple


edklencl (Oct 21 2024 at 08:38):

import Mathlib.Tactic
import Mathlib.Data.Real.Sqrt
example (m n k : ) (h : m  n) : n^2 - m^2 = (n-m)*(n+m):=
by
  have hk :  k, n = m + k
  · use n-m
  obtain k,hk:=hk
  have : (m+k)^2 = m^2 + (2*m*k + k^2)
  · sorry
  sorry

edklencl (Oct 21 2024 at 08:38):

why does ring cant help

Riccardo Brasca (Oct 21 2024 at 09:03):

ring can prove you first sorry. It is not designed to work with natural subtraction, so it is no surprisingly it cannot finish the proof of hk. You can use omega or zify [h]; ring for that.

BANGJI HU (Oct 21 2024 at 09:43):

can you be more specific

BANGJI HU (Oct 21 2024 at 10:24):

import Mathlib.Tactic
import Mathlib.Data.Real.Sqrt

example (m n : ) (h : m  n) : n^2 - m^2 = (n-m)*(n+m):=
by
  have hk :  k, n = m + k
  use n-m
  have : (m+k)^2 = m^2 + (2*m*k + k^2)
  ring
  zify [h]
  ring
  rw [Nat.pow_two_sub_pow_two]
  rw [Nat.mul_comm]

BANGJI HU (Oct 21 2024 at 10:24):

thanks

Riccardo Brasca (Oct 21 2024 at 11:06):

You can also do

import Mathlib

example (m n : ) (h : m  n) : n^2 - m^2 = (n-m)*(n+m):= by
  have h' : m^2  n^2 := Nat.pow_le_pow_of_le_left h 2 --find by exact?
  zify [h, h']
  ring

BANGJI HU (Oct 21 2024 at 11:16):

what does zify stand for

Yaël Dillies (Oct 21 2024 at 11:17):

It means "-ify", as in "turn into "

BANGJI HU (Oct 21 2024 at 11:39):

(deleted)


Last updated: May 02 2025 at 03:31 UTC