Zulip Chat Archive

Stream: Is there code for X?

Topic: Is there a code for extracting square root?


Shi You (Nov 22 2021 at 17:47):

Something like

variable (x : )
example (h: x ^ 2 = 9): x = 3  x = -3 := by extract_sq_root

Mario Carneiro (Nov 22 2021 at 17:47):

that's just a lemma: look for x ^ 2 = y ^ 2 <-> x = y \/ x = -y

Shi You (Nov 22 2021 at 17:51):

It doesn't automatically change 9 to 3^2?

Mario Carneiro (Nov 22 2021 at 17:51):

norm_num will do that part

Mario Carneiro (Nov 22 2021 at 17:57):

import tactic
variable (x : )
example (h: x ^ 2 = 9) : x = 3  x = -3 :=
eq_or_eq_neg_of_sq_eq_sq _ _ $ by norm_num [h]

Last updated: Dec 20 2023 at 11:08 UTC