Zulip Chat Archive

Stream: new members

Topic: rfl with underscore in equation compiler


Kenny Lau (Oct 25 2020 at 19:34):

def is_pos :   bool
| 0 := ff
| _ := tt

#print prefix is_pos

example (n : ) : is_pos n.succ = tt := rfl

Kenny Lau (Oct 25 2020 at 19:35):

How does this rfl work?

Kenny Lau (Oct 25 2020 at 19:35):

The equational lemmas are:

is_pos.equations._eqn_1 : is_pos 0 = ff
is_pos.equations._eqn_2 :  (_x : ), ¬_x = 0  is_pos _x = tt

Mario Carneiro (Oct 25 2020 at 19:35):

that may be the equation lemmas, but the kernel reduction doesn't use equation lemmas

Kenny Lau (Oct 25 2020 at 19:37):

what's the right tactic to use if this occurs inside some larger term? simp and unfold cannot reduce the goal at all, and rw changes the goal into ¬n.succ = 0

Mario Carneiro (Oct 25 2020 at 19:37):

that looks like progress

Kenny Lau (Oct 25 2020 at 19:37):

or maybe one shouldn't use underscore to begin with

Mario Carneiro (Oct 25 2020 at 19:38):

what's actually happening is that the compilation strategy created a term like if n = 0 then ff else tt and decidable (n.succ = 0) reduces to false

Kevin Buzzard (Oct 25 2020 at 20:11):

Kenny Lau said:

or maybe one shouldn't use underscore to begin with

Unsurprisingly, this does produce better equation lemmas.


Last updated: Dec 20 2023 at 11:08 UTC