Zulip Chat Archive

Stream: new members

Topic: Elementary math


Iocta (Mar 22 2024 at 23:45):

Are there tactics that can solve these holes? What is recommended here?

import Mathlib
import Mathlib.Tactic
import Mathlib.Data.Finset.Basic
import Mathlib.Algebra.BigOperators.Basic
import Mathlib.Algebra.Order.Sub.Canonical

open BigOperators Nat Finset

open Real

example (a :   ) (ha :  s r, a = (fun i => s * r ^ i)) (h1 : a 1 = 2) (h2 : a 2 = 3) : a 3 = 9/2 := by
  cases ha with
  | intro s hs =>
    cases hs with
    | intro r hr =>
      rw [hr]
      rw [hr] at h1 h2
      dsimp only
      dsimp at h1 h2
      have r_eq_three_div_two : r = 3/2 := sorry
      have s_eq_four_div_three : s = 4/3 := by
        rw [r_eq_three_div_two, rpow_one] at h1
        linarith
      rw [r_eq_three_div_two, s_eq_four_div_three]
      sorry
      /-
      case intro.intro
      a : ℝ → ℝ
      s r : ℝ
      h2 : s * r ^ 2 = 3
      h1 : s * r ^ 1 = 2
      hr : a = fun i ↦ s * r ^ i
      r_eq_three_div_two : r = 3 / 2
      s_eq_four_div_three : s = 4 / 3
      ⊢ 4 / 3 * (3 / 2) ^ 3 = 9 / 2
      -/

Eric Wieser (Mar 22 2024 at 23:52):

norm_num is the tactic you want

Iocta (Mar 22 2024 at 23:54):

What about the other sorry?

Iocta (Mar 22 2024 at 23:55):

basically

      s r : 
      h2 : s * r ^ 2 = 3
      h1 : s * r ^ 1 = 2
       r = 3 / 2

Eric Wieser (Mar 23 2024 at 00:00):

Another tip would be to start your proof with

  obtain s, r, rfl := ha
  dsimp only at *

Eric Wieser (Mar 23 2024 at 00:02):

For your goal state above, have := congr($h2 / $h1) is helpful

Julian Berman (Mar 23 2024 at 00:03):

A lazy way (found partially via hint) seems to be have r_eq_three_div_two : r = 3/2 := by simp_all [rpow_two, rpow_one]; nlinarith

Iocta (Mar 23 2024 at 00:13):

I see, that's

have r_eq_three_div_two : r = 3/2 := by
    rw [rpow_one] at h1
    rw [rpow_two] at h2
    nlinarith

Iocta (Mar 23 2024 at 00:22):

rpow_two is a little strange.

Matt Diamond (Mar 23 2024 at 00:24):

do you mean the fact that it looks like x ^ 2 = x ^ 2?

Matt Diamond (Mar 23 2024 at 00:25):

if you look at the source, it's actually x ^ (2 : ℝ) = x ^ (2 : ℕ)

Eric Wieser (Mar 23 2024 at 00:52):

The general case is docs#Real.rpow_ofNat, which looks even stranger!

Matt Diamond (Mar 23 2024 at 00:55):

hmm... @Eric Wieser is it missing?


Last updated: May 02 2025 at 03:31 UTC