Zulip Chat Archive

Stream: mathlib4

Topic: xor for Bool


Ruben Van de Velde (Nov 28 2022 at 16:21):

Is there actually an instance for xor on Bool in lean4?

Mario Carneiro (Nov 28 2022 at 16:23):

I don't think so (assuming you mean the ^^^ operator). You can use != though

Yury G. Kudryashov (Nov 28 2022 at 17:20):

But you don't have nice defeq for !=

Mario Carneiro (Nov 28 2022 at 17:44):

you should?

Mario Carneiro (Nov 28 2022 at 17:48):

-- it computes on literals
example : (true != true) = false := rfl
example : (true != false) = true := rfl
example : (false != true) = true := rfl
example : (false != false) = false := rfl

-- but there are no partial evaluation lucky defeqs
example : (true != a) = !a := rfl -- fail
example : (a != true) = !a := rfl -- fail
example : (a != false) = a := rfl -- fail
example : (false != a) = a := rfl -- fail

Kevin Buzzard (Nov 28 2022 at 21:01):

I ported xor -- it's in Mathlib.Init.Data.Bool.Basic.

Yury G. Kudryashov (Nov 29 2022 at 16:46):

Should we use != instead?

Yury G. Kudryashov (Nov 29 2022 at 16:47):

@Mario Carneiro Sorry, I didn't realize that you're talking about !=, not .

Yury G. Kudryashov (Nov 29 2022 at 16:49):

Or define Xor instances for Bool and Prop?


Last updated: Dec 20 2023 at 11:08 UTC