Zulip Chat Archive
Stream: new members
Topic: Decasting variables
Shadman Sakib (Jul 25 2021 at 01:01):
How would I decast the x and pi in hn to match the goal, or opposingly, how can I cast the x and the pi to complex numbers in the goal to match hn?
Shadman Sakib (Jul 25 2021 at 01:01):
import analysis.complex.circle
import group_theory.specific_groups.dihedral
import analysis.special_functions.trigonometric
example {x : ℝ} (n : ℤ)
(hn : (x : ℂ) = ↑n * (2 * ↑π)) :
x = ↑n * (2 * π) :=
begin
admit,
end
Ruben Van de Velde (Jul 25 2021 at 07:04):
norm_cast at hn,
exact hn,
gets you home
Ruben Van de Velde (Jul 25 2021 at 07:06):
Or
rw [←complex.of_real_inj, hn],
simp,
Ruben Van de Velde (Jul 25 2021 at 07:07):
With the least magic:
rw [←complex.of_real_inj, hn],
rw [complex.of_real_mul, complex.of_real_mul, complex.of_real_int_cast, complex.of_real_bit0, complex.of_real_one],
Kevin Buzzard (Jul 25 2021 at 08:12):
Does exact_mod_cast
close the goal?
Shadman Sakib (Jul 25 2021 at 14:04):
Thank you so much, Ruben, for showing exactly how Lean carries out each step of your suggestion! And, yup, exact_mod_cast hn closes the goal!
Yakov Pechersky (Jul 25 2021 at 14:05):
You can even do assumption_mod_cast
Shadman Sakib (Jul 25 2021 at 15:54):
import analysis.complex.circle
import group_theory.specific_groups.dihedral
import analysis.special_functions.trigonometric
example (R : Type u_1) (n m : ℤ)
[linear_ordered_ring R]
(a : R)
(h : a < 1)
(h₀ : 0 < a)
(n1 : 1 ≤ n) :
a < ↑n :=
begin
admit,
end
Shadman Sakib (Jul 25 2021 at 15:55):
How about this one? How do I avoid the casting problem that exact lt_of_lt_of_le h n1,
gives?
Kevin Buzzard (Jul 25 2021 at 15:56):
import analysis.complex.circle
import group_theory.specific_groups.dihedral
import analysis.special_functions.trigonometric
example (R : Type*) (n m : ℤ)
[linear_ordered_ring R]
(a : R)
(h : a < 1)
(h₀ : 0 < a)
(n1 : 1 ≤ n) :
a < ↑n :=
begin
refine lt_of_lt_of_le h _,
assumption_mod_cast,
end
Kevin Buzzard (Jul 25 2021 at 15:57):
(PS you should check your mwes compile! That one didn't)
Shadman Sakib (Jul 25 2021 at 16:01):
Ah yes the Type*, I realized the error after I sent it. You are too quick! Thank you
Last updated: Dec 20 2023 at 11:08 UTC