Zulip Chat Archive

Stream: general

Topic: is_left_id rw mystery


Patrick Massot (Apr 23 2018 at 14:18):

example (R : Type) (op nil a) [is_left_id R op nil] : op nil a = a := by rw is_left_id.left_id

errors with:

rewrite tactic failed, did not find instance of the pattern in the target expression
  ?m_1 ?m_2 ?m_3
state:
R : Type,
op : R  R  R,
nil : out_param.{1} R,
a : R,
_inst_2 : is_left_id.{0} R op nil
 @eq.{1} R (op nil a) a

Patrick Massot (Apr 23 2018 at 14:19):

I know I could use is_left_id.left_id _ _ in place of the rw

Patrick Massot (Apr 23 2018 at 14:19):

But in my real use case I want to rewrite

Patrick Massot (Apr 23 2018 at 14:19):

(or simp would be even better)

Kenny Lau (Apr 23 2018 at 14:21):

example (R : Type) (op nil a) [is_left_id R op nil] : op nil a = a := by rw is_left_id.left_id op a

Patrick Massot (Apr 23 2018 at 14:23):

interesting

Patrick Massot (Apr 23 2018 at 14:23):

doesn't explain why unification fails though

Kenny Lau (Apr 23 2018 at 14:23):

probably because that is a higher-order unification

Kenny Lau (Apr 23 2018 at 14:23):

https://en.wikipedia.org/wiki/Unification_(computer_science)#Higher-order_unification

Kenny Lau (Apr 23 2018 at 14:23):

it is undecidable

Patrick Massot (Apr 23 2018 at 14:23):

Oh I think you're right

Patrick Massot (Apr 23 2018 at 14:25):

@Mario Carneiro is this part of why you don't believe in the new algebraic hierarchy? Or is it possible to recover a working simp lemma here?

Mario Carneiro (Apr 23 2018 at 16:05):

Yes, this is the main problem with the new alg hierarchy. To be fair to Leo, he's been aware of this problem since the start, and the algebra attribute is part of a plan to fix it, but it requires more lean support than it currently gets. It should be a part of lean 4

Patrick Massot (Apr 23 2018 at 16:16):

Ok, it makes sense. Do you agree that the new hierarchy seems more suitable if we want a big_op library that is really operator centric as in mathcomp?


Last updated: Dec 20 2023 at 11:08 UTC