data.bool.basicMathlib.Data.Bool.Basic

This file has been ported!

Changes since the initial port

The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.

Changes in mathlib3

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(last sync)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -431,16 +431,12 @@ theorem not_xor_not : ∀ a b, xor (!a) (!b) = xor a b := by decide
 #align bool.bxor_bnot_bnot Bool.not_xor_not
 -/
 
-/- warning: bool.bxor_ff_left clashes with ff_bxor -> Bool.false_xor
-Case conversion may be inaccurate. Consider using '#align bool.bxor_ff_left Bool.false_xorₓ'. -/
 #print Bool.false_xor /-
 @[simp]
 theorem false_xor : ∀ a, xor false a = a := by decide
 #align bool.bxor_ff_left Bool.false_xor
 -/
 
-/- warning: bool.bxor_ff_right clashes with bxor_ff -> Bool.xor_false
-Case conversion may be inaccurate. Consider using '#align bool.bxor_ff_right Bool.xor_falseₓ'. -/
 #print Bool.xor_false /-
 @[simp]
 theorem xor_false : ∀ a, xor a false = a := by decide
Diff
@@ -431,12 +431,16 @@ theorem not_xor_not : ∀ a b, xor (!a) (!b) = xor a b := by decide
 #align bool.bxor_bnot_bnot Bool.not_xor_not
 -/
 
+/- warning: bool.bxor_ff_left clashes with ff_bxor -> Bool.false_xor
+Case conversion may be inaccurate. Consider using '#align bool.bxor_ff_left Bool.false_xorₓ'. -/
 #print Bool.false_xor /-
 @[simp]
 theorem false_xor : ∀ a, xor false a = a := by decide
 #align bool.bxor_ff_left Bool.false_xor
 -/
 
+/- warning: bool.bxor_ff_right clashes with bxor_ff -> Bool.xor_false
+Case conversion may be inaccurate. Consider using '#align bool.bxor_ff_right Bool.xor_falseₓ'. -/
 #print Bool.xor_false /-
 @[simp]
 theorem xor_false : ∀ a, xor a false = a := by decide
Diff
@@ -431,16 +431,12 @@ theorem not_xor_not : ∀ a b, xor (!a) (!b) = xor a b := by decide
 #align bool.bxor_bnot_bnot Bool.not_xor_not
 -/
 
-/- warning: bool.bxor_ff_left clashes with ff_bxor -> Bool.false_xor
-Case conversion may be inaccurate. Consider using '#align bool.bxor_ff_left Bool.false_xorₓ'. -/
 #print Bool.false_xor /-
 @[simp]
 theorem false_xor : ∀ a, xor false a = a := by decide
 #align bool.bxor_ff_left Bool.false_xor
 -/
 
-/- warning: bool.bxor_ff_right clashes with bxor_ff -> Bool.xor_false
-Case conversion may be inaccurate. Consider using '#align bool.bxor_ff_right Bool.xor_falseₓ'. -/
 #print Bool.xor_false /-
 @[simp]
 theorem xor_false : ∀ a, xor a false = a := by decide
Diff
@@ -72,18 +72,18 @@ theorem of_decide_iff {p : Prop} [Decidable p] : decide p ↔ p :=
 #align bool.of_to_bool_iff Bool.of_decide_iff
 -/
 
-#print Bool.true_eq_decide_iff /-
+#print true_eq_decide_iff /-
 @[simp]
 theorem true_eq_decide_iff {p : Prop} [Decidable p] : true = decide p ↔ p :=
   eq_comm.trans of_decide_iff
-#align bool.tt_eq_to_bool_iff Bool.true_eq_decide_iff
+#align bool.tt_eq_to_bool_iff true_eq_decide_iff
 -/
 
-#print Bool.false_eq_decide_iff /-
+#print false_eq_decide_iff /-
 @[simp]
 theorem false_eq_decide_iff {p : Prop} [Decidable p] : false = decide p ↔ ¬p :=
   eq_comm.trans (Bool.decide_false_iff _)
-#align bool.ff_eq_to_bool_iff Bool.false_eq_decide_iff
+#align bool.ff_eq_to_bool_iff false_eq_decide_iff
 -/
 
 #print Bool.decide_not /-
Diff
@@ -413,34 +413,38 @@ theorem xor_left_comm : ∀ a b c, xor a (xor b c) = xor b (xor a c) := by decid
 #align bool.bxor_left_comm Bool.xor_left_comm
 -/
 
-#print Bool.xor_not_left /-
+#print Bool.not_xor /-
 @[simp]
-theorem xor_not_left : ∀ a, xor (!a) a = true := by decide
-#align bool.bxor_bnot_left Bool.xor_not_left
+theorem not_xor : ∀ a, xor (!a) a = true := by decide
+#align bool.bxor_bnot_left Bool.not_xor
 -/
 
-#print Bool.xor_not_right /-
+#print Bool.xor_not /-
 @[simp]
-theorem xor_not_right : ∀ a, xor a (!a) = true := by decide
-#align bool.bxor_bnot_right Bool.xor_not_right
+theorem xor_not : ∀ a, xor a (!a) = true := by decide
+#align bool.bxor_bnot_right Bool.xor_not
 -/
 
-#print Bool.xor_not_not /-
+#print Bool.not_xor_not /-
 @[simp]
-theorem xor_not_not : ∀ a b, xor (!a) (!b) = xor a b := by decide
-#align bool.bxor_bnot_bnot Bool.xor_not_not
+theorem not_xor_not : ∀ a b, xor (!a) (!b) = xor a b := by decide
+#align bool.bxor_bnot_bnot Bool.not_xor_not
 -/
 
-#print Bool.xor_false_left /-
+/- warning: bool.bxor_ff_left clashes with ff_bxor -> Bool.false_xor
+Case conversion may be inaccurate. Consider using '#align bool.bxor_ff_left Bool.false_xorₓ'. -/
+#print Bool.false_xor /-
 @[simp]
-theorem xor_false_left : ∀ a, xor false a = a := by decide
-#align bool.bxor_ff_left Bool.xor_false_left
+theorem false_xor : ∀ a, xor false a = a := by decide
+#align bool.bxor_ff_left Bool.false_xor
 -/
 
-#print Bool.xor_false_right /-
+/- warning: bool.bxor_ff_right clashes with bxor_ff -> Bool.xor_false
+Case conversion may be inaccurate. Consider using '#align bool.bxor_ff_right Bool.xor_falseₓ'. -/
+#print Bool.xor_false /-
 @[simp]
-theorem xor_false_right : ∀ a, xor a false = a := by decide
-#align bool.bxor_ff_right Bool.xor_false_right
+theorem xor_false : ∀ a, xor a false = a := by decide
+#align bool.bxor_ff_right Bool.xor_false
 -/
 
 #print Bool.and_xor_distrib_left /-
Diff
@@ -198,9 +198,9 @@ theorem not_ne_id : not ≠ id := fun h => false_ne_true <| congr_fun h true
 #align bool.bnot_ne_id Bool.not_ne_id
 -/
 
-#print Bool.coe_bool_iff /-
-theorem coe_bool_iff : ∀ {a b : Bool}, (a ↔ b) ↔ a = b := by decide
-#align bool.coe_bool_iff Bool.coe_bool_iff
+#print Bool.coe_iff_coe /-
+theorem coe_iff_coe : ∀ {a b : Bool}, (a ↔ b) ↔ a = b := by decide
+#align bool.coe_bool_iff Bool.coe_iff_coe
 -/
 
 #print Bool.eq_true_of_ne_false /-
Diff
@@ -2,13 +2,10 @@
 Copyright (c) 2014 Microsoft Corporation. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Leonardo de Moura, Jeremy Avigad
-
-! This file was ported from Lean 3 source module data.bool.basic
-! leanprover-community/mathlib commit 448144f7ae193a8990cb7473c9e9a01990f64ac7
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 
+#align_import data.bool.basic from "leanprover-community/mathlib"@"448144f7ae193a8990cb7473c9e9a01990f64ac7"
+
 /-!
 # booleans
 
Diff
@@ -27,7 +27,6 @@ bool, boolean, De Morgan
 -/
 
 
--- mathport name: «expr! »
 prefix:90 "!" => not
 
 namespace Bool
@@ -317,8 +316,10 @@ theorem eq_not_iff : ∀ {a b : Bool}, a = !b ↔ a ≠ b := by decide
 #align bool.eq_bnot_iff Bool.eq_not_iff
 -/
 
+#print Bool.not_eq_iff /-
 theorem not_eq_iff : ∀ {a b : Bool}, !a = b ↔ a ≠ b := by decide
 #align bool.bnot_eq_iff Bool.not_eq_iff
+-/
 
 #print Bool.not_eq_not /-
 @[simp]
@@ -365,11 +366,15 @@ theorem not_iff_not : ∀ {b : Bool}, !b ↔ ¬b := by decide
 #align bool.bnot_iff_not Bool.not_iff_not
 -/
 
+#print Bool.eq_true_of_not_eq_false' /-
 theorem eq_true_of_not_eq_false' : ∀ {a : Bool}, !a = false → a = true := by decide
 #align bool.eq_tt_of_bnot_eq_ff Bool.eq_true_of_not_eq_false'
+-/
 
+#print Bool.eq_false_of_not_eq_true' /-
 theorem eq_false_of_not_eq_true' : ∀ {a : Bool}, !a = true → a = false := by decide
 #align bool.eq_ff_of_bnot_eq_tt Bool.eq_false_of_not_eq_true'
+-/
 
 #print Bool.and_not_self /-
 @[simp]
@@ -473,8 +478,10 @@ theorem not_or : ∀ a b : Bool, !(a || b) = (!a && !b) := by decide
 #align bool.bnot_bor Bool.not_or
 -/
 
+#print Bool.not_inj /-
 theorem not_inj : ∀ {a b : Bool}, !a = !b → a = b := by decide
 #align bool.bnot_inj Bool.not_inj
+-/
 
 instance : LinearOrder Bool where
   le a b := a = false ∨ b = true
Diff
@@ -461,13 +461,17 @@ theorem xor_iff_ne : ∀ {x y : Bool}, xor x y = true ↔ x ≠ y := by decide
 /-! ### De Morgan's laws for booleans-/
 
 
+#print Bool.not_and /-
 @[simp]
 theorem not_and : ∀ a b : Bool, !(a && b) = (!a || !b) := by decide
 #align bool.bnot_band Bool.not_and
+-/
 
+#print Bool.not_or /-
 @[simp]
 theorem not_or : ∀ a b : Bool, !(a || b) = (!a && !b) := by decide
 #align bool.bnot_bor Bool.not_or
+-/
 
 theorem not_inj : ∀ {a b : Bool}, !a = !b → a = b := by decide
 #align bool.bnot_inj Bool.not_inj
Diff
@@ -145,7 +145,7 @@ theorem forall_bool {p : Bool → Prop} : (∀ b, p b) ↔ p false ∧ p true :=
 #print Bool.exists_bool /-
 @[simp]
 theorem exists_bool {p : Bool → Prop} : (∃ b, p b) ↔ p false ∨ p true :=
-  ⟨fun ⟨b, h⟩ => by cases b <;> [exact Or.inl h;exact Or.inr h], fun h => by
+  ⟨fun ⟨b, h⟩ => by cases b <;> [exact Or.inl h; exact Or.inr h], fun h => by
     cases h <;> exact ⟨_, h⟩⟩
 #align bool.exists_bool Bool.exists_bool
 -/
@@ -572,7 +572,7 @@ theorem ofNat_le_ofNat {n m : ℕ} (h : n ≤ m) : ofNat n ≤ ofNat m :=
 
 #print Bool.toNat_le_toNat /-
 theorem toNat_le_toNat {b₀ b₁ : Bool} (h : b₀ ≤ b₁) : toNat b₀ ≤ toNat b₁ := by
-  cases h <;> subst h <;> [cases b₁;cases b₀] <;> simp [toNat, Nat.zero_le]
+  cases h <;> subst h <;> [cases b₁; cases b₀] <;> simp [toNat, Nat.zero_le]
 #align bool.to_nat_le_to_nat Bool.toNat_le_toNat
 -/
 
@@ -586,7 +586,7 @@ theorem ofNat_toNat (b : Bool) : ofNat (toNat b) = b := by
 @[simp]
 theorem injective_iff {α : Sort _} {f : Bool → α} : Function.Injective f ↔ f false ≠ f true :=
   ⟨fun Hinj Heq => false_ne_true (Hinj Heq), fun H x y hxy => by cases x <;> cases y;
-    exacts[rfl, (H hxy).elim, (H hxy.symm).elim, rfl]⟩
+    exacts [rfl, (H hxy).elim, (H hxy.symm).elim, rfl]⟩
 #align bool.injective_iff Bool.injective_iff
 -/
 
Diff
@@ -485,44 +485,66 @@ instance : LinearOrder Bool where
   min := and
   min_def := by funext x y; revert x y; exact by decide
 
+#print Bool.false_le /-
 @[simp]
 theorem false_le {x : Bool} : false ≤ x :=
   Or.intro_left _ rfl
 #align bool.ff_le Bool.false_le
+-/
 
+#print Bool.le_true /-
 @[simp]
 theorem le_true {x : Bool} : x ≤ true :=
   Or.intro_right _ rfl
 #align bool.le_tt Bool.le_true
+-/
 
+#print Bool.lt_iff /-
 theorem lt_iff : ∀ {x y : Bool}, x < y ↔ x = false ∧ y = true := by decide
 #align bool.lt_iff Bool.lt_iff
+-/
 
+#print Bool.false_lt_true /-
 @[simp]
 theorem false_lt_true : false < true :=
   lt_iff.2 ⟨rfl, rfl⟩
 #align bool.ff_lt_tt Bool.false_lt_true
+-/
 
+#print Bool.le_iff_imp /-
 theorem le_iff_imp : ∀ {x y : Bool}, x ≤ y ↔ x → y := by decide
 #align bool.le_iff_imp Bool.le_iff_imp
+-/
 
+#print Bool.and_le_left /-
 theorem and_le_left : ∀ x y : Bool, (x && y) ≤ x := by decide
 #align bool.band_le_left Bool.and_le_left
+-/
 
+#print Bool.and_le_right /-
 theorem and_le_right : ∀ x y : Bool, (x && y) ≤ y := by decide
 #align bool.band_le_right Bool.and_le_right
+-/
 
+#print Bool.le_and /-
 theorem le_and : ∀ {x y z : Bool}, x ≤ y → x ≤ z → x ≤ (y && z) := by decide
 #align bool.le_band Bool.le_and
+-/
 
+#print Bool.left_le_or /-
 theorem left_le_or : ∀ x y : Bool, x ≤ (x || y) := by decide
 #align bool.left_le_bor Bool.left_le_or
+-/
 
+#print Bool.right_le_or /-
 theorem right_le_or : ∀ x y : Bool, y ≤ (x || y) := by decide
 #align bool.right_le_bor Bool.right_le_or
+-/
 
+#print Bool.or_le /-
 theorem or_le : ∀ {x y z}, x ≤ z → y ≤ z → (x || y) ≤ z := by decide
 #align bool.bor_le Bool.or_le
+-/
 
 #print Bool.toNat /-
 /-- convert a `bool` to a `ℕ`, `false -> 0`, `true -> 1` -/
@@ -538,6 +560,7 @@ def ofNat (n : ℕ) : Bool :=
 #align bool.of_nat Bool.ofNat
 -/
 
+#print Bool.ofNat_le_ofNat /-
 theorem ofNat_le_ofNat {n m : ℕ} (h : n ≤ m) : ofNat n ≤ ofNat m :=
   by
   simp [of_nat] <;> cases Nat.decidableEq n 0 <;> cases Nat.decidableEq m 0 <;> simp only [to_bool]
@@ -545,10 +568,13 @@ theorem ofNat_le_ofNat {n m : ℕ} (h : n ≤ m) : ofNat n ≤ ofNat m :=
     contradiction
   · left; rfl
 #align bool.of_nat_le_of_nat Bool.ofNat_le_ofNat
+-/
 
+#print Bool.toNat_le_toNat /-
 theorem toNat_le_toNat {b₀ b₁ : Bool} (h : b₀ ≤ b₁) : toNat b₀ ≤ toNat b₁ := by
   cases h <;> subst h <;> [cases b₁;cases b₀] <;> simp [toNat, Nat.zero_le]
 #align bool.to_nat_le_to_nat Bool.toNat_le_toNat
+-/
 
 #print Bool.ofNat_toNat /-
 theorem ofNat_toNat (b : Bool) : ofNat (toNat b) = b := by
Diff
@@ -317,12 +317,6 @@ theorem eq_not_iff : ∀ {a b : Bool}, a = !b ↔ a ≠ b := by decide
 #align bool.eq_bnot_iff Bool.eq_not_iff
 -/
 
-/- warning: bool.bnot_eq_iff -> Bool.not_eq_iff is a dubious translation:
-lean 3 declaration is
-  forall {a : Bool} {b : Bool}, Iff (Eq.{1} Bool (not a) b) (Ne.{1} Bool a b)
-but is expected to have type
-  forall {a : Bool} {b : Bool}, Iff (Eq.{1} Bool (not (Decidable.decide (Eq.{1} Bool a b) (instDecidableEqBool a b))) Bool.true) (Ne.{1} Bool a b)
-Case conversion may be inaccurate. Consider using '#align bool.bnot_eq_iff Bool.not_eq_iffₓ'. -/
 theorem not_eq_iff : ∀ {a b : Bool}, !a = b ↔ a ≠ b := by decide
 #align bool.bnot_eq_iff Bool.not_eq_iff
 
@@ -371,21 +365,9 @@ theorem not_iff_not : ∀ {b : Bool}, !b ↔ ¬b := by decide
 #align bool.bnot_iff_not Bool.not_iff_not
 -/
 
-/- warning: bool.eq_tt_of_bnot_eq_ff -> Bool.eq_true_of_not_eq_false' is a dubious translation:
-lean 3 declaration is
-  forall {a : Bool}, (Eq.{1} Bool (not a) Bool.false) -> (Eq.{1} Bool a Bool.true)
-but is expected to have type
-  forall {a : Bool}, (Eq.{1} Bool (not (Decidable.decide (Eq.{1} Bool a Bool.false) (instDecidableEqBool a Bool.false))) Bool.true) -> (Eq.{1} Bool a Bool.true)
-Case conversion may be inaccurate. Consider using '#align bool.eq_tt_of_bnot_eq_ff Bool.eq_true_of_not_eq_false'ₓ'. -/
 theorem eq_true_of_not_eq_false' : ∀ {a : Bool}, !a = false → a = true := by decide
 #align bool.eq_tt_of_bnot_eq_ff Bool.eq_true_of_not_eq_false'
 
-/- warning: bool.eq_ff_of_bnot_eq_tt -> Bool.eq_false_of_not_eq_true' is a dubious translation:
-lean 3 declaration is
-  forall {a : Bool}, (Eq.{1} Bool (not a) Bool.true) -> (Eq.{1} Bool a Bool.false)
-but is expected to have type
-  forall {a : Bool}, (Eq.{1} Bool (not (Decidable.decide (Eq.{1} Bool a Bool.true) (instDecidableEqBool a Bool.true))) Bool.true) -> (Eq.{1} Bool a Bool.false)
-Case conversion may be inaccurate. Consider using '#align bool.eq_ff_of_bnot_eq_tt Bool.eq_false_of_not_eq_true'ₓ'. -/
 theorem eq_false_of_not_eq_true' : ∀ {a : Bool}, !a = true → a = false := by decide
 #align bool.eq_ff_of_bnot_eq_tt Bool.eq_false_of_not_eq_true'
 
@@ -479,32 +461,14 @@ theorem xor_iff_ne : ∀ {x y : Bool}, xor x y = true ↔ x ≠ y := by decide
 /-! ### De Morgan's laws for booleans-/
 
 
-/- warning: bool.bnot_band -> Bool.not_and is a dubious translation:
-lean 3 declaration is
-  forall (a : Bool) (b : Bool), Eq.{1} Bool (not (and a b)) (or (not a) (not b))
-but is expected to have type
-  forall (a : Bool) (b : Bool), Eq.{1} Bool (not (Decidable.decide (Eq.{1} Bool (and a b) (or (not a) (not b))) (instDecidableEqBool (and a b) (or (not a) (not b))))) Bool.true
-Case conversion may be inaccurate. Consider using '#align bool.bnot_band Bool.not_andₓ'. -/
 @[simp]
 theorem not_and : ∀ a b : Bool, !(a && b) = (!a || !b) := by decide
 #align bool.bnot_band Bool.not_and
 
-/- warning: bool.bnot_bor -> Bool.not_or is a dubious translation:
-lean 3 declaration is
-  forall (a : Bool) (b : Bool), Eq.{1} Bool (not (or a b)) (and (not a) (not b))
-but is expected to have type
-  forall (a : Bool) (b : Bool), Eq.{1} Bool (not (Decidable.decide (Eq.{1} Bool (or a b) (and (not a) (not b))) (instDecidableEqBool (or a b) (and (not a) (not b))))) Bool.true
-Case conversion may be inaccurate. Consider using '#align bool.bnot_bor Bool.not_orₓ'. -/
 @[simp]
 theorem not_or : ∀ a b : Bool, !(a || b) = (!a && !b) := by decide
 #align bool.bnot_bor Bool.not_or
 
-/- warning: bool.bnot_inj -> Bool.not_inj is a dubious translation:
-lean 3 declaration is
-  forall {a : Bool} {b : Bool}, (Eq.{1} Bool (not a) (not b)) -> (Eq.{1} Bool a b)
-but is expected to have type
-  forall {a : Bool} {b : Bool}, (Eq.{1} Bool (not (Decidable.decide (Eq.{1} Bool a (not b)) (instDecidableEqBool a (not b)))) Bool.true) -> (Eq.{1} Bool a b)
-Case conversion may be inaccurate. Consider using '#align bool.bnot_inj Bool.not_injₓ'. -/
 theorem not_inj : ∀ {a b : Bool}, !a = !b → a = b := by decide
 #align bool.bnot_inj Bool.not_inj
 
@@ -521,108 +485,42 @@ instance : LinearOrder Bool where
   min := and
   min_def := by funext x y; revert x y; exact by decide
 
-/- warning: bool.ff_le -> Bool.false_le is a dubious translation:
-lean 3 declaration is
-  forall {x : Bool}, LE.le.{0} Bool (Preorder.toHasLe.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) Bool.false x
-but is expected to have type
-  forall {x : Bool}, LE.le.{0} Bool (Preorder.toLE.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) Bool.false x
-Case conversion may be inaccurate. Consider using '#align bool.ff_le Bool.false_leₓ'. -/
 @[simp]
 theorem false_le {x : Bool} : false ≤ x :=
   Or.intro_left _ rfl
 #align bool.ff_le Bool.false_le
 
-/- warning: bool.le_tt -> Bool.le_true is a dubious translation:
-lean 3 declaration is
-  forall {x : Bool}, LE.le.{0} Bool (Preorder.toHasLe.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) x Bool.true
-but is expected to have type
-  forall {x : Bool}, LE.le.{0} Bool (Preorder.toLE.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) x Bool.true
-Case conversion may be inaccurate. Consider using '#align bool.le_tt Bool.le_trueₓ'. -/
 @[simp]
 theorem le_true {x : Bool} : x ≤ true :=
   Or.intro_right _ rfl
 #align bool.le_tt Bool.le_true
 
-/- warning: bool.lt_iff -> Bool.lt_iff is a dubious translation:
-lean 3 declaration is
-  forall {x : Bool} {y : Bool}, Iff (LT.lt.{0} Bool (Preorder.toHasLt.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) x y) (And (Eq.{1} Bool x Bool.false) (Eq.{1} Bool y Bool.true))
-but is expected to have type
-  forall {x : Bool} {y : Bool}, Iff (LT.lt.{0} Bool (Preorder.toLT.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) x y) (And (Eq.{1} Bool x Bool.false) (Eq.{1} Bool y Bool.true))
-Case conversion may be inaccurate. Consider using '#align bool.lt_iff Bool.lt_iffₓ'. -/
 theorem lt_iff : ∀ {x y : Bool}, x < y ↔ x = false ∧ y = true := by decide
 #align bool.lt_iff Bool.lt_iff
 
-/- warning: bool.ff_lt_tt -> Bool.false_lt_true is a dubious translation:
-lean 3 declaration is
-  LT.lt.{0} Bool (Preorder.toHasLt.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) Bool.false Bool.true
-but is expected to have type
-  LT.lt.{0} Bool (Preorder.toLT.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) Bool.false Bool.true
-Case conversion may be inaccurate. Consider using '#align bool.ff_lt_tt Bool.false_lt_trueₓ'. -/
 @[simp]
 theorem false_lt_true : false < true :=
   lt_iff.2 ⟨rfl, rfl⟩
 #align bool.ff_lt_tt Bool.false_lt_true
 
-/- warning: bool.le_iff_imp -> Bool.le_iff_imp is a dubious translation:
-lean 3 declaration is
-  forall {x : Bool} {y : Bool}, Iff (LE.le.{0} Bool (Preorder.toHasLe.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) x y) ((coeSort.{1, 1} Bool Prop coeSortBool x) -> (coeSort.{1, 1} Bool Prop coeSortBool y))
-but is expected to have type
-  forall {x : Bool} {y : Bool}, Iff (LE.le.{0} Bool (Preorder.toLE.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) x y) ((Eq.{1} Bool x Bool.true) -> (Eq.{1} Bool y Bool.true))
-Case conversion may be inaccurate. Consider using '#align bool.le_iff_imp Bool.le_iff_impₓ'. -/
 theorem le_iff_imp : ∀ {x y : Bool}, x ≤ y ↔ x → y := by decide
 #align bool.le_iff_imp Bool.le_iff_imp
 
-/- warning: bool.band_le_left -> Bool.and_le_left is a dubious translation:
-lean 3 declaration is
-  forall (x : Bool) (y : Bool), LE.le.{0} Bool (Preorder.toHasLe.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) (and x y) x
-but is expected to have type
-  forall (x : Bool) (y : Bool), LE.le.{0} Bool (Preorder.toLE.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) (and x y) x
-Case conversion may be inaccurate. Consider using '#align bool.band_le_left Bool.and_le_leftₓ'. -/
 theorem and_le_left : ∀ x y : Bool, (x && y) ≤ x := by decide
 #align bool.band_le_left Bool.and_le_left
 
-/- warning: bool.band_le_right -> Bool.and_le_right is a dubious translation:
-lean 3 declaration is
-  forall (x : Bool) (y : Bool), LE.le.{0} Bool (Preorder.toHasLe.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) (and x y) y
-but is expected to have type
-  forall (x : Bool) (y : Bool), LE.le.{0} Bool (Preorder.toLE.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) (and x y) y
-Case conversion may be inaccurate. Consider using '#align bool.band_le_right Bool.and_le_rightₓ'. -/
 theorem and_le_right : ∀ x y : Bool, (x && y) ≤ y := by decide
 #align bool.band_le_right Bool.and_le_right
 
-/- warning: bool.le_band -> Bool.le_and is a dubious translation:
-lean 3 declaration is
-  forall {x : Bool} {y : Bool} {z : Bool}, (LE.le.{0} Bool (Preorder.toHasLe.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) x y) -> (LE.le.{0} Bool (Preorder.toHasLe.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) x z) -> (LE.le.{0} Bool (Preorder.toHasLe.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) x (and y z))
-but is expected to have type
-  forall {x : Bool} {y : Bool} {z : Bool}, (LE.le.{0} Bool (Preorder.toLE.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) x y) -> (LE.le.{0} Bool (Preorder.toLE.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) x z) -> (LE.le.{0} Bool (Preorder.toLE.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) x (and y z))
-Case conversion may be inaccurate. Consider using '#align bool.le_band Bool.le_andₓ'. -/
 theorem le_and : ∀ {x y z : Bool}, x ≤ y → x ≤ z → x ≤ (y && z) := by decide
 #align bool.le_band Bool.le_and
 
-/- warning: bool.left_le_bor -> Bool.left_le_or is a dubious translation:
-lean 3 declaration is
-  forall (x : Bool) (y : Bool), LE.le.{0} Bool (Preorder.toHasLe.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) x (or x y)
-but is expected to have type
-  forall (x : Bool) (y : Bool), LE.le.{0} Bool (Preorder.toLE.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) x (or x y)
-Case conversion may be inaccurate. Consider using '#align bool.left_le_bor Bool.left_le_orₓ'. -/
 theorem left_le_or : ∀ x y : Bool, x ≤ (x || y) := by decide
 #align bool.left_le_bor Bool.left_le_or
 
-/- warning: bool.right_le_bor -> Bool.right_le_or is a dubious translation:
-lean 3 declaration is
-  forall (x : Bool) (y : Bool), LE.le.{0} Bool (Preorder.toHasLe.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) y (or x y)
-but is expected to have type
-  forall (x : Bool) (y : Bool), LE.le.{0} Bool (Preorder.toLE.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) y (or x y)
-Case conversion may be inaccurate. Consider using '#align bool.right_le_bor Bool.right_le_orₓ'. -/
 theorem right_le_or : ∀ x y : Bool, y ≤ (x || y) := by decide
 #align bool.right_le_bor Bool.right_le_or
 
-/- warning: bool.bor_le -> Bool.or_le is a dubious translation:
-lean 3 declaration is
-  forall {x : Bool} {y : Bool} {z : Bool}, (LE.le.{0} Bool (Preorder.toHasLe.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) x z) -> (LE.le.{0} Bool (Preorder.toHasLe.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) y z) -> (LE.le.{0} Bool (Preorder.toHasLe.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) (or x y) z)
-but is expected to have type
-  forall {x : Bool} {y : Bool} {z : Bool}, (LE.le.{0} Bool (Preorder.toLE.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) x z) -> (LE.le.{0} Bool (Preorder.toLE.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) y z) -> (LE.le.{0} Bool (Preorder.toLE.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) (or x y) z)
-Case conversion may be inaccurate. Consider using '#align bool.bor_le Bool.or_leₓ'. -/
 theorem or_le : ∀ {x y z}, x ≤ z → y ≤ z → (x || y) ≤ z := by decide
 #align bool.bor_le Bool.or_le
 
@@ -640,12 +538,6 @@ def ofNat (n : ℕ) : Bool :=
 #align bool.of_nat Bool.ofNat
 -/
 
-/- warning: bool.of_nat_le_of_nat -> Bool.ofNat_le_ofNat is a dubious translation:
-lean 3 declaration is
-  forall {n : Nat} {m : Nat}, (LE.le.{0} Nat Nat.hasLe n m) -> (LE.le.{0} Bool (Preorder.toHasLe.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) (Bool.ofNat n) (Bool.ofNat m))
-but is expected to have type
-  forall {n : Nat} {m : Nat}, (LE.le.{0} Nat instLENat n m) -> (LE.le.{0} Bool (Preorder.toLE.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) (Bool.ofNat n) (Bool.ofNat m))
-Case conversion may be inaccurate. Consider using '#align bool.of_nat_le_of_nat Bool.ofNat_le_ofNatₓ'. -/
 theorem ofNat_le_ofNat {n m : ℕ} (h : n ≤ m) : ofNat n ≤ ofNat m :=
   by
   simp [of_nat] <;> cases Nat.decidableEq n 0 <;> cases Nat.decidableEq m 0 <;> simp only [to_bool]
@@ -654,12 +546,6 @@ theorem ofNat_le_ofNat {n m : ℕ} (h : n ≤ m) : ofNat n ≤ ofNat m :=
   · left; rfl
 #align bool.of_nat_le_of_nat Bool.ofNat_le_ofNat
 
-/- warning: bool.to_nat_le_to_nat -> Bool.toNat_le_toNat is a dubious translation:
-lean 3 declaration is
-  forall {b₀ : Bool} {b₁ : Bool}, (LE.le.{0} Bool (Preorder.toHasLe.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) b₀ b₁) -> (LE.le.{0} Nat Nat.hasLe (Bool.toNat b₀) (Bool.toNat b₁))
-but is expected to have type
-  forall {b₀ : Bool} {b₁ : Bool}, (LE.le.{0} Bool (Preorder.toLE.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) b₀ b₁) -> (LE.le.{0} Nat instLENat (Bool.toNat b₀) (Bool.toNat b₁))
-Case conversion may be inaccurate. Consider using '#align bool.to_nat_le_to_nat Bool.toNat_le_toNatₓ'. -/
 theorem toNat_le_toNat {b₀ b₁ : Bool} (h : b₀ ≤ b₁) : toNat b₀ ≤ toNat b₁ := by
   cases h <;> subst h <;> [cases b₁;cases b₀] <;> simp [toNat, Nat.zero_le]
 #align bool.to_nat_le_to_nat Bool.toNat_le_toNat
Diff
@@ -517,15 +517,9 @@ instance : LinearOrder Bool where
   decidableLe := inferInstance
   DecidableEq := inferInstance
   max := or
-  max_def := by
-    funext x y
-    revert x y
-    exact by decide
+  max_def := by funext x y; revert x y; exact by decide
   min := and
-  min_def := by
-    funext x y
-    revert x y
-    exact by decide
+  min_def := by funext x y; revert x y; exact by decide
 
 /- warning: bool.ff_le -> Bool.false_le is a dubious translation:
 lean 3 declaration is
@@ -655,11 +649,9 @@ Case conversion may be inaccurate. Consider using '#align bool.of_nat_le_of_nat
 theorem ofNat_le_ofNat {n m : ℕ} (h : n ≤ m) : ofNat n ≤ ofNat m :=
   by
   simp [of_nat] <;> cases Nat.decidableEq n 0 <;> cases Nat.decidableEq m 0 <;> simp only [to_bool]
-  · subst m
-    have h := le_antisymm h (Nat.zero_le _)
+  · subst m; have h := le_antisymm h (Nat.zero_le _)
     contradiction
-  · left
-    rfl
+  · left; rfl
 #align bool.of_nat_le_of_nat Bool.ofNat_le_ofNat
 
 /- warning: bool.to_nat_le_to_nat -> Bool.toNat_le_toNat is a dubious translation:
@@ -681,9 +673,7 @@ theorem ofNat_toNat (b : Bool) : ofNat (toNat b) = b := by
 #print Bool.injective_iff /-
 @[simp]
 theorem injective_iff {α : Sort _} {f : Bool → α} : Function.Injective f ↔ f false ≠ f true :=
-  ⟨fun Hinj Heq => false_ne_true (Hinj Heq), fun H x y hxy =>
-    by
-    cases x <;> cases y
+  ⟨fun Hinj Heq => false_ne_true (Hinj Heq), fun H x y hxy => by cases x <;> cases y;
     exacts[rfl, (H hxy).elim, (H hxy.symm).elim, rfl]⟩
 #align bool.injective_iff Bool.injective_iff
 -/
Diff
@@ -145,7 +145,7 @@ theorem forall_bool {p : Bool → Prop} : (∀ b, p b) ↔ p false ∧ p true :=
 #print Bool.exists_bool /-
 @[simp]
 theorem exists_bool {p : Bool → Prop} : (∃ b, p b) ↔ p false ∨ p true :=
-  ⟨fun ⟨b, h⟩ => by cases b <;> [exact Or.inl h, exact Or.inr h], fun h => by
+  ⟨fun ⟨b, h⟩ => by cases b <;> [exact Or.inl h;exact Or.inr h], fun h => by
     cases h <;> exact ⟨_, h⟩⟩
 #align bool.exists_bool Bool.exists_bool
 -/
@@ -669,7 +669,7 @@ but is expected to have type
   forall {b₀ : Bool} {b₁ : Bool}, (LE.le.{0} Bool (Preorder.toLE.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) b₀ b₁) -> (LE.le.{0} Nat instLENat (Bool.toNat b₀) (Bool.toNat b₁))
 Case conversion may be inaccurate. Consider using '#align bool.to_nat_le_to_nat Bool.toNat_le_toNatₓ'. -/
 theorem toNat_le_toNat {b₀ b₁ : Bool} (h : b₀ ≤ b₁) : toNat b₀ ≤ toNat b₁ := by
-  cases h <;> subst h <;> [cases b₁, cases b₀] <;> simp [toNat, Nat.zero_le]
+  cases h <;> subst h <;> [cases b₁;cases b₀] <;> simp [toNat, Nat.zero_le]
 #align bool.to_nat_le_to_nat Bool.toNat_le_toNat
 
 #print Bool.ofNat_toNat /-
Diff
@@ -527,66 +527,110 @@ instance : LinearOrder Bool where
     revert x y
     exact by decide
 
-#print Bool.false_le /-
+/- warning: bool.ff_le -> Bool.false_le is a dubious translation:
+lean 3 declaration is
+  forall {x : Bool}, LE.le.{0} Bool (Preorder.toHasLe.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) Bool.false x
+but is expected to have type
+  forall {x : Bool}, LE.le.{0} Bool (Preorder.toLE.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) Bool.false x
+Case conversion may be inaccurate. Consider using '#align bool.ff_le Bool.false_leₓ'. -/
 @[simp]
 theorem false_le {x : Bool} : false ≤ x :=
   Or.intro_left _ rfl
 #align bool.ff_le Bool.false_le
--/
 
-#print Bool.le_true /-
+/- warning: bool.le_tt -> Bool.le_true is a dubious translation:
+lean 3 declaration is
+  forall {x : Bool}, LE.le.{0} Bool (Preorder.toHasLe.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) x Bool.true
+but is expected to have type
+  forall {x : Bool}, LE.le.{0} Bool (Preorder.toLE.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) x Bool.true
+Case conversion may be inaccurate. Consider using '#align bool.le_tt Bool.le_trueₓ'. -/
 @[simp]
 theorem le_true {x : Bool} : x ≤ true :=
   Or.intro_right _ rfl
 #align bool.le_tt Bool.le_true
--/
 
-#print Bool.lt_iff /-
+/- warning: bool.lt_iff -> Bool.lt_iff is a dubious translation:
+lean 3 declaration is
+  forall {x : Bool} {y : Bool}, Iff (LT.lt.{0} Bool (Preorder.toHasLt.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) x y) (And (Eq.{1} Bool x Bool.false) (Eq.{1} Bool y Bool.true))
+but is expected to have type
+  forall {x : Bool} {y : Bool}, Iff (LT.lt.{0} Bool (Preorder.toLT.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) x y) (And (Eq.{1} Bool x Bool.false) (Eq.{1} Bool y Bool.true))
+Case conversion may be inaccurate. Consider using '#align bool.lt_iff Bool.lt_iffₓ'. -/
 theorem lt_iff : ∀ {x y : Bool}, x < y ↔ x = false ∧ y = true := by decide
 #align bool.lt_iff Bool.lt_iff
--/
 
-#print Bool.false_lt_true /-
+/- warning: bool.ff_lt_tt -> Bool.false_lt_true is a dubious translation:
+lean 3 declaration is
+  LT.lt.{0} Bool (Preorder.toHasLt.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) Bool.false Bool.true
+but is expected to have type
+  LT.lt.{0} Bool (Preorder.toLT.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) Bool.false Bool.true
+Case conversion may be inaccurate. Consider using '#align bool.ff_lt_tt Bool.false_lt_trueₓ'. -/
 @[simp]
 theorem false_lt_true : false < true :=
   lt_iff.2 ⟨rfl, rfl⟩
 #align bool.ff_lt_tt Bool.false_lt_true
--/
 
-#print Bool.le_iff_imp /-
+/- warning: bool.le_iff_imp -> Bool.le_iff_imp is a dubious translation:
+lean 3 declaration is
+  forall {x : Bool} {y : Bool}, Iff (LE.le.{0} Bool (Preorder.toHasLe.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) x y) ((coeSort.{1, 1} Bool Prop coeSortBool x) -> (coeSort.{1, 1} Bool Prop coeSortBool y))
+but is expected to have type
+  forall {x : Bool} {y : Bool}, Iff (LE.le.{0} Bool (Preorder.toLE.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) x y) ((Eq.{1} Bool x Bool.true) -> (Eq.{1} Bool y Bool.true))
+Case conversion may be inaccurate. Consider using '#align bool.le_iff_imp Bool.le_iff_impₓ'. -/
 theorem le_iff_imp : ∀ {x y : Bool}, x ≤ y ↔ x → y := by decide
 #align bool.le_iff_imp Bool.le_iff_imp
--/
 
-#print Bool.and_le_left /-
+/- warning: bool.band_le_left -> Bool.and_le_left is a dubious translation:
+lean 3 declaration is
+  forall (x : Bool) (y : Bool), LE.le.{0} Bool (Preorder.toHasLe.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) (and x y) x
+but is expected to have type
+  forall (x : Bool) (y : Bool), LE.le.{0} Bool (Preorder.toLE.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) (and x y) x
+Case conversion may be inaccurate. Consider using '#align bool.band_le_left Bool.and_le_leftₓ'. -/
 theorem and_le_left : ∀ x y : Bool, (x && y) ≤ x := by decide
 #align bool.band_le_left Bool.and_le_left
--/
 
-#print Bool.and_le_right /-
+/- warning: bool.band_le_right -> Bool.and_le_right is a dubious translation:
+lean 3 declaration is
+  forall (x : Bool) (y : Bool), LE.le.{0} Bool (Preorder.toHasLe.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) (and x y) y
+but is expected to have type
+  forall (x : Bool) (y : Bool), LE.le.{0} Bool (Preorder.toLE.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) (and x y) y
+Case conversion may be inaccurate. Consider using '#align bool.band_le_right Bool.and_le_rightₓ'. -/
 theorem and_le_right : ∀ x y : Bool, (x && y) ≤ y := by decide
 #align bool.band_le_right Bool.and_le_right
--/
 
-#print Bool.le_and /-
+/- warning: bool.le_band -> Bool.le_and is a dubious translation:
+lean 3 declaration is
+  forall {x : Bool} {y : Bool} {z : Bool}, (LE.le.{0} Bool (Preorder.toHasLe.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) x y) -> (LE.le.{0} Bool (Preorder.toHasLe.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) x z) -> (LE.le.{0} Bool (Preorder.toHasLe.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) x (and y z))
+but is expected to have type
+  forall {x : Bool} {y : Bool} {z : Bool}, (LE.le.{0} Bool (Preorder.toLE.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) x y) -> (LE.le.{0} Bool (Preorder.toLE.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) x z) -> (LE.le.{0} Bool (Preorder.toLE.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) x (and y z))
+Case conversion may be inaccurate. Consider using '#align bool.le_band Bool.le_andₓ'. -/
 theorem le_and : ∀ {x y z : Bool}, x ≤ y → x ≤ z → x ≤ (y && z) := by decide
 #align bool.le_band Bool.le_and
--/
 
-#print Bool.left_le_or /-
+/- warning: bool.left_le_bor -> Bool.left_le_or is a dubious translation:
+lean 3 declaration is
+  forall (x : Bool) (y : Bool), LE.le.{0} Bool (Preorder.toHasLe.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) x (or x y)
+but is expected to have type
+  forall (x : Bool) (y : Bool), LE.le.{0} Bool (Preorder.toLE.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) x (or x y)
+Case conversion may be inaccurate. Consider using '#align bool.left_le_bor Bool.left_le_orₓ'. -/
 theorem left_le_or : ∀ x y : Bool, x ≤ (x || y) := by decide
 #align bool.left_le_bor Bool.left_le_or
--/
 
-#print Bool.right_le_or /-
+/- warning: bool.right_le_bor -> Bool.right_le_or is a dubious translation:
+lean 3 declaration is
+  forall (x : Bool) (y : Bool), LE.le.{0} Bool (Preorder.toHasLe.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) y (or x y)
+but is expected to have type
+  forall (x : Bool) (y : Bool), LE.le.{0} Bool (Preorder.toLE.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) y (or x y)
+Case conversion may be inaccurate. Consider using '#align bool.right_le_bor Bool.right_le_orₓ'. -/
 theorem right_le_or : ∀ x y : Bool, y ≤ (x || y) := by decide
 #align bool.right_le_bor Bool.right_le_or
--/
 
-#print Bool.or_le /-
+/- warning: bool.bor_le -> Bool.or_le is a dubious translation:
+lean 3 declaration is
+  forall {x : Bool} {y : Bool} {z : Bool}, (LE.le.{0} Bool (Preorder.toHasLe.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) x z) -> (LE.le.{0} Bool (Preorder.toHasLe.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) y z) -> (LE.le.{0} Bool (Preorder.toHasLe.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) (or x y) z)
+but is expected to have type
+  forall {x : Bool} {y : Bool} {z : Bool}, (LE.le.{0} Bool (Preorder.toLE.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) x z) -> (LE.le.{0} Bool (Preorder.toLE.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) y z) -> (LE.le.{0} Bool (Preorder.toLE.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) (or x y) z)
+Case conversion may be inaccurate. Consider using '#align bool.bor_le Bool.or_leₓ'. -/
 theorem or_le : ∀ {x y z}, x ≤ z → y ≤ z → (x || y) ≤ z := by decide
 #align bool.bor_le Bool.or_le
--/
 
 #print Bool.toNat /-
 /-- convert a `bool` to a `ℕ`, `false -> 0`, `true -> 1` -/
@@ -602,7 +646,12 @@ def ofNat (n : ℕ) : Bool :=
 #align bool.of_nat Bool.ofNat
 -/
 
-#print Bool.ofNat_le_ofNat /-
+/- warning: bool.of_nat_le_of_nat -> Bool.ofNat_le_ofNat is a dubious translation:
+lean 3 declaration is
+  forall {n : Nat} {m : Nat}, (LE.le.{0} Nat Nat.hasLe n m) -> (LE.le.{0} Bool (Preorder.toHasLe.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) (Bool.ofNat n) (Bool.ofNat m))
+but is expected to have type
+  forall {n : Nat} {m : Nat}, (LE.le.{0} Nat instLENat n m) -> (LE.le.{0} Bool (Preorder.toLE.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) (Bool.ofNat n) (Bool.ofNat m))
+Case conversion may be inaccurate. Consider using '#align bool.of_nat_le_of_nat Bool.ofNat_le_ofNatₓ'. -/
 theorem ofNat_le_ofNat {n m : ℕ} (h : n ≤ m) : ofNat n ≤ ofNat m :=
   by
   simp [of_nat] <;> cases Nat.decidableEq n 0 <;> cases Nat.decidableEq m 0 <;> simp only [to_bool]
@@ -612,13 +661,16 @@ theorem ofNat_le_ofNat {n m : ℕ} (h : n ≤ m) : ofNat n ≤ ofNat m :=
   · left
     rfl
 #align bool.of_nat_le_of_nat Bool.ofNat_le_ofNat
--/
 
-#print Bool.toNat_le_toNat /-
+/- warning: bool.to_nat_le_to_nat -> Bool.toNat_le_toNat is a dubious translation:
+lean 3 declaration is
+  forall {b₀ : Bool} {b₁ : Bool}, (LE.le.{0} Bool (Preorder.toHasLe.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) b₀ b₁) -> (LE.le.{0} Nat Nat.hasLe (Bool.toNat b₀) (Bool.toNat b₁))
+but is expected to have type
+  forall {b₀ : Bool} {b₁ : Bool}, (LE.le.{0} Bool (Preorder.toLE.{0} Bool (PartialOrder.toPreorder.{0} Bool (LinearOrder.toPartialOrder.{0} Bool Bool.linearOrder))) b₀ b₁) -> (LE.le.{0} Nat instLENat (Bool.toNat b₀) (Bool.toNat b₁))
+Case conversion may be inaccurate. Consider using '#align bool.to_nat_le_to_nat Bool.toNat_le_toNatₓ'. -/
 theorem toNat_le_toNat {b₀ b₁ : Bool} (h : b₀ ≤ b₁) : toNat b₀ ≤ toNat b₁ := by
   cases h <;> subst h <;> [cases b₁, cases b₀] <;> simp [toNat, Nat.zero_le]
 #align bool.to_nat_le_to_nat Bool.toNat_le_toNat
--/
 
 #print Bool.ofNat_toNat /-
 theorem ofNat_toNat (b : Bool) : ofNat (toNat b) = b := by
Diff
@@ -616,13 +616,13 @@ theorem ofNat_le_ofNat {n m : ℕ} (h : n ≤ m) : ofNat n ≤ ofNat m :=
 
 #print Bool.toNat_le_toNat /-
 theorem toNat_le_toNat {b₀ b₁ : Bool} (h : b₀ ≤ b₁) : toNat b₀ ≤ toNat b₁ := by
-  cases h <;> subst h <;> [cases b₁, cases b₀] <;> simp [to_nat, Nat.zero_le]
+  cases h <;> subst h <;> [cases b₁, cases b₀] <;> simp [toNat, Nat.zero_le]
 #align bool.to_nat_le_to_nat Bool.toNat_le_toNat
 -/
 
 #print Bool.ofNat_toNat /-
 theorem ofNat_toNat (b : Bool) : ofNat (toNat b) = b := by
-  cases b <;> simp only [of_nat, to_nat] <;> exact by decide
+  cases b <;> simp only [of_nat, toNat] <;> exact by decide
 #align bool.of_nat_to_nat Bool.ofNat_toNat
 -/
 

Changes in mathlib4

mathlib3
mathlib4
chore: classify new theorem / theorem porting notes (#11432)

Classifies by adding issue number #10756 to porting notes claiming anything equivalent to:

  • "added theorem"
  • "added theorems"
  • "new theorem"
  • "new theorems"
  • "added lemma"
  • "new lemma"
  • "new lemmas"
Diff
@@ -68,11 +68,11 @@ theorem decide_or (p q : Prop) [Decidable p] [Decidable q] : decide (p ∨ q) =
 theorem not_false' : ¬false := nofun
 #align bool.not_ff Bool.not_false'
 
--- Porting note: new theorem
+-- Porting note (#10756): new theorem
 theorem eq_iff_eq_true_iff {a b : Bool} : a = b ↔ ((a = true) ↔ (b = true)) := by
   cases a <;> cases b <;> simp
 
--- Porting note: new theorem
+-- Porting note (#10756): new theorem
 /- Even though `DecidableEq α` implies an instance of (`Lawful`)`BEq α`, we keep the seemingly
 redundant typeclass assumptions so that the theorem is also applicable for types that have
 overridden this default instance of `LawfulBEq α` -/
@@ -82,7 +82,7 @@ theorem beq_eq_decide_eq {α} [BEq α] [LawfulBEq α] [DecidableEq α]
   · simp [ne_of_beq_false h]
   · simp [eq_of_beq h]
 
--- Porting note: new theorem
+-- Porting note (#10756): new theorem
 theorem beq_comm {α} [BEq α] [LawfulBEq α] {a b : α} : (a == b) = (b == a) :=
   eq_iff_eq_true_iff.2 (by simp [@eq_comm α])
 
chore: replace λ by fun (#11301)

Per the style guidelines, λ is disallowed in mathlib. This is close to exhaustive; I left some tactic code alone when it seemed to me that tactic could be upstreamed soon.

Notes

  • In lines I was modifying anyway, I also converted => to .
  • Also contains some mild in-passing indentation fixes in Mathlib/Order/SupClosed.
  • Some doc comments still contained Lean 3 syntax λ x, , which I also replaced.
Diff
@@ -32,14 +32,14 @@ theorem decide_False {h} : @decide False h = false :=
 @[simp]
 theorem decide_coe (b : Bool) {h} : @decide b h = b := by
   cases b
-  · exact _root_.decide_eq_false <| λ j => by cases j
+  · exact _root_.decide_eq_false <| fun j ↦ by cases j
   · exact _root_.decide_eq_true <| rfl
 #align bool.to_bool_coe Bool.decide_coe
 
 theorem coe_decide (p : Prop) [d : Decidable p] : decide p ↔ p :=
   match d with
-  | isTrue hp => ⟨λ _ => hp, λ _ => rfl⟩
-  | isFalse hnp => ⟨λ h => Bool.noConfusion h, λ hp => (hnp hp).elim⟩
+  | isTrue hp => ⟨fun _ ↦ hp, fun _ ↦ rfl⟩
+  | isFalse hnp => ⟨fun h ↦ Bool.noConfusion h, fun hp ↦ (hnp hp).elim⟩
 #align bool.coe_to_bool Bool.coe_decide
 
 theorem of_decide_iff {p : Prop} [Decidable p] : decide p ↔ p :=
chore: move Mathlib to v4.7.0-rc1 (#11162)

This is a very large PR, but it has been reviewed piecemeal already in PRs to the bump/v4.7.0 branch as we update to intermediate nightlies.

Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Kyle Miller <kmill31415@gmail.com> Co-authored-by: damiano <adomani@gmail.com>

Diff
@@ -22,18 +22,18 @@ bool, boolean, Bool, De Morgan
 namespace Bool
 
 theorem decide_True {h} : @decide True h = true :=
-  decide_eq_true True.intro
+  _root_.decide_eq_true True.intro
 #align bool.to_bool_true Bool.decide_True
 
 theorem decide_False {h} : @decide False h = false :=
-  decide_eq_false id
+  _root_.decide_eq_false id
 #align bool.to_bool_false Bool.decide_False
 
 @[simp]
 theorem decide_coe (b : Bool) {h} : @decide b h = b := by
   cases b
-  · exact decide_eq_false <| λ j => by cases j
-  · exact decide_eq_true <| rfl
+  · exact _root_.decide_eq_false <| λ j => by cases j
+  · exact _root_.decide_eq_true <| rfl
 #align bool.to_bool_coe Bool.decide_coe
 
 theorem coe_decide (p : Prop) [d : Decidable p] : decide p ↔ p :=
@@ -65,7 +65,7 @@ theorem decide_or (p q : Prop) [Decidable p] [Decidable q] : decide (p ∨ q) =
 
 #align bool.to_bool_eq decide_eq_decide
 
-theorem not_false' : ¬false := fun.
+theorem not_false' : ¬false := nofun
 #align bool.not_ff Bool.not_false'
 
 -- Porting note: new theorem
@@ -321,10 +321,10 @@ def ofNat (n : Nat) : Bool :=
 theorem ofNat_le_ofNat {n m : Nat} (h : n ≤ m) : ofNat n ≤ ofNat m := by
   simp only [ofNat, ne_eq, _root_.decide_not]
   cases Nat.decEq n 0 with
-  | isTrue hn => rw [decide_eq_true hn]; exact Bool.false_le _
+  | isTrue hn => rw [_root_.decide_eq_true hn]; exact Bool.false_le _
   | isFalse hn =>
     cases Nat.decEq m 0 with
-    | isFalse hm => rw [decide_eq_false hm]; exact Bool.le_true _
+    | isFalse hm => rw [_root_.decide_eq_false hm]; exact Bool.le_true _
     | isTrue hm => subst hm; have h := le_antisymm h (Nat.zero_le n); contradiction
 #align bool.of_nat_le_of_nat Bool.ofNat_le_ofNat
 
feat(Topology/Constructions): add continuous_bool_rng (#10513)

Provide continuity criteria for functions X → Bool and, more generally, X → Y, where Y has discrete topology.

Diff
@@ -94,17 +94,21 @@ theorem default_bool : default = false :=
 theorem dichotomy (b : Bool) : b = false ∨ b = true := by cases b <;> simp
 #align bool.dichotomy Bool.dichotomy
 
+theorem forall_bool' {p : Bool → Prop} (b : Bool) : (∀ x, p x) ↔ p b ∧ p !b :=
+  ⟨fun h ↦ ⟨h _, h _⟩, fun ⟨h₁, h₂⟩ x ↦ by cases b <;> cases x <;> assumption⟩
+
 @[simp]
 theorem forall_bool {p : Bool → Prop} : (∀ b, p b) ↔ p false ∧ p true :=
-  ⟨fun h ↦ by simp [h], fun ⟨h₁, h₂⟩ b ↦ by cases b <;> assumption⟩
+  forall_bool' false
 #align bool.forall_bool Bool.forall_bool
 
+theorem exists_bool' {p : Bool → Prop} (b : Bool) : (∃ x, p x) ↔ p b ∨ p !b :=
+  ⟨fun ⟨x, hx⟩ ↦ by cases x <;> cases b <;> first | exact .inl ‹_› | exact .inr ‹_›,
+    fun h ↦ by cases h <;> exact ⟨_, ‹_›⟩⟩
+
 @[simp]
 theorem exists_bool {p : Bool → Prop} : (∃ b, p b) ↔ p false ∨ p true :=
-  ⟨fun ⟨b, h⟩ ↦ by cases b; exact Or.inl h; exact Or.inr h,
-  fun h ↦ match h with
-  | .inl h => ⟨_, h⟩
-  | .inr h => ⟨_, h⟩⟩
+  exists_bool' false
 #align bool.exists_bool Bool.exists_bool
 
 /-- If `p b` is decidable for all `b : Bool`, then `∀ b, p b` is decidable -/
feat: fix decidableEq and decidableLT fields in the LinearOrder instance on Bool (#10333)

Currently, the fields are filled in by an automatic parameter, which does not match the canonical decidability instances on Bool, creating some diamonds down the road.

Diff
@@ -261,6 +261,8 @@ instance linearOrder : LinearOrder Bool where
   le_antisymm := by decide
   le_total := by decide
   decidableLE := inferInstance
+  decidableEq := inferInstance
+  decidableLT := inferInstance
   lt_iff_le_not_le := by decide
   max_def := by decide
   min_def := by decide
chore: uneven spacing for ⟨ ⟩ (#10014)

This cleans up instances of

⟨ foo, bar⟩

and

⟨foo, bar ⟩

where spaces a on the inside one side, but not on the other side. Fixing this by removing the extra space.

Co-authored-by: Moritz Firsching <firsching@google.com>

Diff
@@ -104,7 +104,7 @@ theorem exists_bool {p : Bool → Prop} : (∃ b, p b) ↔ p false ∨ p true :=
   ⟨fun ⟨b, h⟩ ↦ by cases b; exact Or.inl h; exact Or.inr h,
   fun h ↦ match h with
   | .inl h => ⟨_, h⟩
-  | .inr h => ⟨_, h⟩ ⟩
+  | .inr h => ⟨_, h⟩⟩
 #align bool.exists_bool Bool.exists_bool
 
 /-- If `p b` is decidable for all `b : Bool`, then `∀ b, p b` is decidable -/
chore: reduce imports (#9830)

This uses the improved shake script from #9772 to reduce imports across mathlib. The corresponding noshake.json file has been added to #9772.

Co-authored-by: Mario Carneiro <di.gama@gmail.com>

Diff
@@ -3,7 +3,6 @@ Copyright (c) 2014 Microsoft Corporation. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Leonardo de Moura, Jeremy Avigad
 -/
-import Mathlib.Init.Data.Bool.Lemmas
 import Mathlib.Init.Data.Nat.Lemmas
 import Mathlib.Init.Function
 
chore(*): replace $ with <| (#9319)

See Zulip thread for the discussion.

Diff
@@ -33,8 +33,8 @@ theorem decide_False {h} : @decide False h = false :=
 @[simp]
 theorem decide_coe (b : Bool) {h} : @decide b h = b := by
   cases b
-  · exact decide_eq_false $ λ j => by cases j
-  · exact decide_eq_true $ rfl
+  · exact decide_eq_false <| λ j => by cases j
+  · exact decide_eq_true <| rfl
 #align bool.to_bool_coe Bool.decide_coe
 
 theorem coe_decide (p : Prop) [d : Decidable p] : decide p ↔ p :=
chore: bump Std to match leanprover/std4#438 (#9157)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Mario Carneiro <di.gama@gmail.com>

Diff
@@ -47,8 +47,8 @@ theorem of_decide_iff {p : Prop} [Decidable p] : decide p ↔ p :=
   coe_decide p
 #align bool.of_to_bool_iff Bool.of_decide_iff
 
-#align bool.tt_eq_to_bool_iff Bool.true_eq_decide_iff
-#align bool.ff_eq_to_bool_iff Bool.false_eq_decide_iff
+#align bool.tt_eq_to_bool_iff true_eq_decide_iff
+#align bool.ff_eq_to_bool_iff false_eq_decide_iff
 
 theorem decide_not (p : Prop) [Decidable p] : (decide ¬p) = !(decide p) := by
   by_cases p <;> simp [*]
chore: bump Std, changes for leanprover/std4#366 (#8700)

Notably leanprover/std4#366 changed the definition of testBit (to something equivalent) when upstreaming it, which broke a handful of proofs.

Other conflicting changes in Std, resolved for now by priming the mathlib name:

  • Std.BitVec.adc: the type was changed from BitVec (n + 1) to Bool × BitVec w
  • Nat.mul_add_mod: the type was changed from (a * b + c) % b = c % b to (b * a + c) % b = c % b

Zulip thread

Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Alex Keizer <alex@keizer.dev> Co-authored-by: Eric Wieser <wieser.eric@gmail.com>

Diff
@@ -47,14 +47,7 @@ theorem of_decide_iff {p : Prop} [Decidable p] : decide p ↔ p :=
   coe_decide p
 #align bool.of_to_bool_iff Bool.of_decide_iff
 
-@[simp]
-theorem true_eq_decide_iff {p : Prop} [Decidable p] : true = decide p ↔ p :=
-  eq_comm.trans of_decide_iff
 #align bool.tt_eq_to_bool_iff Bool.true_eq_decide_iff
-
-@[simp]
-theorem false_eq_decide_iff {p : Prop} [Decidable p] : false = decide p ↔ ¬p :=
-  eq_comm.trans (decide_false_iff _)
 #align bool.ff_eq_to_bool_iff Bool.false_eq_decide_iff
 
 theorem decide_not (p : Prop) [Decidable p] : (decide ¬p) = !(decide p) := by
@@ -308,22 +301,13 @@ theorem right_le_or : ∀ x y : Bool, y ≤ (x || y) := by decide
 theorem or_le : ∀ {x y z}, x ≤ z → y ≤ z → (x || y) ≤ z := by decide
 #align bool.bor_le Bool.or_le
 
-/-- convert a `Bool` to a `ℕ`, `false -> 0`, `true -> 1` -/
-def toNat (b : Bool) : Nat :=
-  cond b 1 0
 #align bool.to_nat Bool.toNat
 
-lemma toNat_le_one (b : Bool) : b.toNat ≤ 1 := by
-  cases b <;> decide
-
 /-- convert a `ℕ` to a `Bool`, `0 -> false`, everything else -> `true` -/
 def ofNat (n : Nat) : Bool :=
   decide (n ≠ 0)
 #align bool.of_nat Bool.ofNat
 
-@[simp] lemma toNat_true  : toNat true = 1  := rfl
-@[simp] lemma toNat_false : toNat false = 0 := rfl
-
 @[simp] lemma toNat_beq_zero (b : Bool) : (b.toNat == 0) = !b := by cases b <;> rfl
 @[simp] lemma toNat_bne_zero (b : Bool) : (b.toNat != 0) =  b := by simp [bne]
 @[simp] lemma toNat_beq_one  (b : Bool) : (b.toNat == 1) =  b := by cases b <;> rfl
refactor: generalize Bool.beq_eq_decide_eq (#8532)

This PR generalizes Bool.beq_eq_decide_eq to also be applicable for types whose BEq α is different from the default instance implied by DecidableEq α. An example of such a type is Nat.

Diff
@@ -81,8 +81,14 @@ theorem eq_iff_eq_true_iff {a b : Bool} : a = b ↔ ((a = true) ↔ (b = true))
   cases a <;> cases b <;> simp
 
 -- Porting note: new theorem
-theorem beq_eq_decide_eq {α} [DecidableEq α]
-    (a b : α) : (a == b) = decide (a = b) := rfl
+/- Even though `DecidableEq α` implies an instance of (`Lawful`)`BEq α`, we keep the seemingly
+redundant typeclass assumptions so that the theorem is also applicable for types that have
+overridden this default instance of `LawfulBEq α` -/
+theorem beq_eq_decide_eq {α} [BEq α] [LawfulBEq α] [DecidableEq α]
+    (a b : α) : (a == b) = decide (a = b) := by
+  cases h : a == b
+  · simp [ne_of_beq_false h]
+  · simp [eq_of_beq h]
 
 -- Porting note: new theorem
 theorem beq_comm {α} [BEq α] [LawfulBEq α] {a b : α} : (a == b) = (b == a) :=
chore: bump to v4.3.0-rc2 (#8366)

PR contents

This is the supremum of

along with some minor fixes from failures on nightly-testing as Mathlib master is merged into it.

Note that some PRs for changes that are already compatible with the current toolchain and will be necessary have already been split out: #8380.

I am hopeful that in future we will be able to progressively merge adaptation PRs into a bump/v4.X.0 branch, so we never end up with a "big merge" like this. However one of these adaptation PRs (#8056) predates my new scheme for combined CI, and it wasn't possible to keep that PR viable in the meantime.

Lean PRs involved in this bump

In particular this includes adjustments for the Lean PRs

leanprover/lean4#2778

We can get rid of all the

local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue [lean4#2220](https://github.com/leanprover/lean4/pull/2220)

macros across Mathlib (and in any projects that want to write natural number powers of reals).

leanprover/lean4#2722

Changes the default behaviour of simp to (config := {decide := false}). This makes simp (and consequentially norm_num) less powerful, but also more consistent, and less likely to blow up in long failures. This requires a variety of changes: changing some previously by simp or norm_num to decide or rfl, or adding (config := {decide := true}).

leanprover/lean4#2783

This changed the behaviour of simp so that simp [f] will only unfold "fully applied" occurrences of f. The old behaviour can be recovered with simp (config := { unfoldPartialApp := true }). We may in future add a syntax for this, e.g. simp [!f]; please provide feedback! In the meantime, we have made the following changes:

  • switching to using explicit lemmas that have the intended level of application
  • (config := { unfoldPartialApp := true }) in some places, to recover the old behaviour
  • Using @[eqns] to manually adjust the equation lemmas for a particular definition, recovering the old behaviour just for that definition. See #8371, where we do this for Function.comp and Function.flip.

This change in Lean may require further changes down the line (e.g. adding the !f syntax, and/or upstreaming the special treatment for Function.comp and Function.flip, and/or removing this special treatment). Please keep an open and skeptical mind about these changes!

Co-authored-by: leanprover-community-mathlib4-bot <leanprover-community-mathlib4-bot@users.noreply.github.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Mauricio Collares <mauricio@collares.org>

Diff
@@ -308,7 +308,7 @@ def toNat (b : Bool) : Nat :=
 #align bool.to_nat Bool.toNat
 
 lemma toNat_le_one (b : Bool) : b.toNat ≤ 1 := by
-  cases b <;> simp only
+  cases b <;> decide
 
 /-- convert a `ℕ` to a `Bool`, `0 -> false`, everything else -> `true` -/
 def ofNat (n : Nat) : Bool :=
@@ -334,7 +334,7 @@ theorem ofNat_le_ofNat {n m : Nat} (h : n ≤ m) : ofNat n ≤ ofNat m := by
 #align bool.of_nat_le_of_nat Bool.ofNat_le_ofNat
 
 theorem toNat_le_toNat {b₀ b₁ : Bool} (h : b₀ ≤ b₁) : toNat b₀ ≤ toNat b₁ := by
-  cases b₀ <;> cases b₁ <;> simp_all
+  cases b₀ <;> cases b₁ <;> simp_all (config := { decide := true })
 #align bool.to_nat_le_to_nat Bool.toNat_le_toNat
 
 theorem ofNat_toNat (b : Bool) : ofNat (toNat b) = b := by
feat: lemmas about Bool.toNat (#8328)
Diff
@@ -307,11 +307,22 @@ def toNat (b : Bool) : Nat :=
   cond b 1 0
 #align bool.to_nat Bool.toNat
 
+lemma toNat_le_one (b : Bool) : b.toNat ≤ 1 := by
+  cases b <;> simp only
+
 /-- convert a `ℕ` to a `Bool`, `0 -> false`, everything else -> `true` -/
 def ofNat (n : Nat) : Bool :=
   decide (n ≠ 0)
 #align bool.of_nat Bool.ofNat
 
+@[simp] lemma toNat_true  : toNat true = 1  := rfl
+@[simp] lemma toNat_false : toNat false = 0 := rfl
+
+@[simp] lemma toNat_beq_zero (b : Bool) : (b.toNat == 0) = !b := by cases b <;> rfl
+@[simp] lemma toNat_bne_zero (b : Bool) : (b.toNat != 0) =  b := by simp [bne]
+@[simp] lemma toNat_beq_one  (b : Bool) : (b.toNat == 1) =  b := by cases b <;> rfl
+@[simp] lemma toNat_bne_one  (b : Bool) : (b.toNat != 1) = !b := by simp [bne]
+
 theorem ofNat_le_ofNat {n m : Nat} (h : n ≤ m) : ofNat n ≤ ofNat m := by
   simp only [ofNat, ne_eq, _root_.decide_not]
   cases Nat.decEq n 0 with
chore: bump Std to #329 (#8105)

This bumps Std up to leanprover/std4#329.

This is a replacement for #8005, which I'll now close.

Co-authored-by: François G. Dorais <fgdorais@gmail.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -221,20 +221,9 @@ theorem eq_false_of_not_eq_true' {a : Bool} : !a = true → a = false := by
   cases a <;> decide
 #align bool.eq_ff_of_bnot_eq_tt Bool.eq_false_of_not_eq_true'
 
--- TODO: undo the rename in leanprover/std4#183?
-alias and_not_self := and_not_self_right
 #align bool.band_bnot_self Bool.and_not_self
-
--- TODO: undo the rename in leanprover/std4#183?
-alias not_and_self := and_not_self_left
 #align bool.bnot_band_self Bool.not_and_self
-
--- TODO: undo the rename in leanprover/std4#183?
-alias or_not_self := or_not_self_right
 #align bool.bor_bnot_self Bool.or_not_self
-
--- TODO: undo the rename in leanprover/std4#183?
-alias not_or_self := or_not_self_left
 #align bool.bnot_bor_self Bool.not_or_self
 
 theorem bne_eq_xor : bne = xor := by funext a b; revert a b; decide
@@ -245,14 +234,13 @@ attribute [simp] xor_assoc
 #align bool.bxor_assoc Bool.xor_assoc
 
 #align bool.bxor_left_comm Bool.xor_left_comm
-#align bool.bxor_bnot_left Bool.xor_not_left
-#align bool.bxor_bnot_right Bool.xor_not_right
+#align bool.bxor_bnot_left Bool.not_xor
+#align bool.bxor_bnot_right Bool.xor_not
 
-attribute [simp] xor_not_not
-#align bool.bxor_bnot_bnot Bool.xor_not_not
+#align bool.bxor_bnot_bnot Bool.not_xor_not
 
-#align bool.bxor_ff_left Bool.xor_false_left
-#align bool.bxor_ff_right Bool.xor_false_right
+#align bool.bxor_ff_left Bool.false_xor
+#align bool.bxor_ff_right Bool.xor_false
 #align bool.band_bxor_distrib_left Bool.and_xor_distrib_left
 #align bool.band_bxor_distrib_right Bool.and_xor_distrib_right
 
@@ -270,12 +258,14 @@ attribute [simp] not_or
 #align bool.bnot_inj Bool.not_inj
 
 instance linearOrder : LinearOrder Bool where
-  le_refl := Bool.le_refl
-  le_trans _ _ _ := Bool.le_trans
-  le_antisymm _ _ := Bool.le_antisymm
-  le_total := Bool.le_total
+  le_refl := by decide
+  le_trans := by decide
+  le_antisymm := by decide
+  le_total := by decide
   decidableLE := inferInstance
-  lt_iff_le_not_le _ _ := Bool.lt_iff_le_not_le
+  lt_iff_le_not_le := by decide
+  max_def := by decide
+  min_def := by decide
 #align bool.linear_order Bool.linearOrder
 
 attribute [simp] Bool.max_eq_or Bool.min_eq_and
chore: update Mathlib for leanprover/std4#183 (#7982)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com>

Diff
@@ -145,12 +145,8 @@ theorem eq_true_of_ne_false : ∀ {a : Bool}, a ≠ false → a = true := by dec
 theorem eq_false_of_ne_true : ∀ {a : Bool}, a ≠ true → a = false := by decide
 #align bool.eq_ff_of_ne_tt Bool.eq_false_of_ne_true
 
-theorem or_comm : ∀ a b, (a || b) = (b || a) := by decide
 #align bool.bor_comm Bool.or_comm
-
 #align bool.bor_assoc Bool.or_assoc
-
-theorem or_left_comm : ∀ a b c, (a || (b || c)) = (b || (a || c)) := by decide
 #align bool.bor_left_comm Bool.or_left_comm
 
 theorem or_inl {a b : Bool} (H : a) : a || b := by simp [H]
@@ -159,12 +155,8 @@ theorem or_inl {a b : Bool} (H : a) : a || b := by simp [H]
 theorem or_inr {a b : Bool} (H : b) : a || b := by cases a <;> simp [H]
 #align bool.bor_inr Bool.or_inr
 
-theorem and_comm : ∀ a b, (a && b) = (b && a) := by decide
 #align bool.band_comm Bool.and_comm
-
 #align bool.band_assoc Bool.and_assoc
-
-theorem and_left_comm : ∀ a b c, (a && (b && c)) = (b && (a && c)) := by decide
 #align bool.band_left_comm Bool.and_left_comm
 
 theorem and_elim_left : ∀ {a b : Bool}, a && b → a := by decide
@@ -176,22 +168,10 @@ theorem and_intro : ∀ {a b : Bool}, a → b → a && b := by decide
 theorem and_elim_right : ∀ {a b : Bool}, a && b → b := by decide
 #align bool.band_elim_right Bool.and_elim_right
 
-theorem and_or_distrib_left (a b c : Bool) : (a && (b || c)) = (a && b || a && c) := by
-  cases a <;> simp
 #align bool.band_bor_distrib_left Bool.and_or_distrib_left
-
-theorem and_or_distrib_right (a b c : Bool) : ((a || b) && c) = (a && c || b && c) := by
-  cases a <;> cases b <;> cases c <;> simp
 #align bool.band_bor_distrib_right Bool.and_or_distrib_right
-
-theorem or_and_distrib_left (a b c : Bool) : (a || b && c) = ((a || b) && (a || c)) := by
-  cases a <;> simp
 #align bool.bor_band_distrib_left Bool.or_and_distrib_left
-
-theorem or_and_distrib_right (a b c : Bool) : (a && b || c) = ((a || c) && (b || c)) := by
-  cases a <;> cases b <;> cases c <;> simp
 #align bool.bor_band_distrib_right Bool.or_and_distrib_right
-
 #align bool.bnot_ff Bool.not_false
 #align bool.bnot_tt Bool.not_true
 
@@ -241,60 +221,39 @@ theorem eq_false_of_not_eq_true' {a : Bool} : !a = true → a = false := by
   cases a <;> decide
 #align bool.eq_ff_of_bnot_eq_tt Bool.eq_false_of_not_eq_true'
 
-@[simp]
-theorem and_not_self : ∀ x, (x && !x) = false := by decide
+-- TODO: undo the rename in leanprover/std4#183?
+alias and_not_self := and_not_self_right
 #align bool.band_bnot_self Bool.and_not_self
 
-@[simp]
-theorem not_and_self : ∀ x, (!x && x) = false := by decide
+-- TODO: undo the rename in leanprover/std4#183?
+alias not_and_self := and_not_self_left
 #align bool.bnot_band_self Bool.not_and_self
 
-@[simp]
-theorem or_not_self : ∀ x, (x || !x) = true := by decide
+-- TODO: undo the rename in leanprover/std4#183?
+alias or_not_self := or_not_self_right
 #align bool.bor_bnot_self Bool.or_not_self
 
-@[simp]
-theorem not_or_self : ∀ x, (!x || x) = true := by decide
+-- TODO: undo the rename in leanprover/std4#183?
+alias not_or_self := or_not_self_left
 #align bool.bnot_bor_self Bool.not_or_self
 
 theorem bne_eq_xor : bne = xor := by funext a b; revert a b; decide
 
-theorem xor_comm : ∀ a b, xor a b = xor b a := by decide
 #align bool.bxor_comm Bool.xor_comm
 
-@[simp]
-theorem xor_assoc : ∀ a b c, xor (xor a b) c = xor a (xor b c) := by decide
+attribute [simp] xor_assoc
 #align bool.bxor_assoc Bool.xor_assoc
 
-theorem xor_left_comm : ∀ a b c, xor a (xor b c) = xor b (xor a c) := by decide
 #align bool.bxor_left_comm Bool.xor_left_comm
-
-@[simp]
-theorem xor_not_left : ∀ a, xor (!a) a = true := by decide
 #align bool.bxor_bnot_left Bool.xor_not_left
-
-@[simp]
-theorem xor_not_right : ∀ a, xor a (!a) = true := by decide
 #align bool.bxor_bnot_right Bool.xor_not_right
 
-@[simp]
-theorem xor_not_not : ∀ a b, xor (!a) (!b) = xor a b := by decide
+attribute [simp] xor_not_not
 #align bool.bxor_bnot_bnot Bool.xor_not_not
 
-@[simp]
-theorem xor_false_left : ∀ a, xor false a = a := by decide
 #align bool.bxor_ff_left Bool.xor_false_left
-
-@[simp]
-theorem xor_false_right : ∀ a, xor a false = a := by decide
 #align bool.bxor_ff_right Bool.xor_false_right
-
-theorem and_xor_distrib_left (a b c : Bool) : (a && xor b c) = xor (a && b) (a && c) := by
-  cases a <;> simp
 #align bool.band_bxor_distrib_left Bool.and_xor_distrib_left
-
-theorem and_xor_distrib_right (a b c : Bool) : (xor a b && c) = xor (a && c) (b && c) := by
-  cases a <;> cases b <;> cases c <;> simp
 #align bool.band_bxor_distrib_right Bool.and_xor_distrib_right
 
 theorem xor_iff_ne : ∀ {x y : Bool}, xor x y = true ↔ x ≠ y := by decide
@@ -302,46 +261,26 @@ theorem xor_iff_ne : ∀ {x y : Bool}, xor x y = true ↔ x ≠ y := by decide
 
 /-! ### De Morgan's laws for booleans-/
 
-@[simp]
-theorem not_and : ∀ a b : Bool, (!(a && b)) = (!a || !b) := by decide
+attribute [simp] not_and
 #align bool.bnot_band Bool.not_and
 
-@[simp]
-theorem not_or : ∀ a b : Bool, (!(a || b)) = (!a && !b) := by decide
+attribute [simp] not_or
 #align bool.bnot_bor Bool.not_or
 
-theorem not_inj : ∀ {a b : Bool}, (!a) = !b → a = b := by decide
 #align bool.bnot_inj Bool.not_inj
 
--- Porting note: having to unfold here is not pretty.
--- There is a discussion on zulip about this at
--- https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/LinearOrder.20in.20mathlib3.2F4/near/308228493
 instance linearOrder : LinearOrder Bool where
-  le := fun a b ↦ a = false ∨ b = true
-  le_refl := by unfold LE.le; decide
-  le_trans := by unfold LE.le; decide
-  le_antisymm := by unfold LE.le Preorder.toLE; decide
-  le_total := by unfold LE.le Preorder.toLE PartialOrder.toPreorder; decide
-  decidableLE := by unfold LE.le Preorder.toLE PartialOrder.toPreorder; exact inferInstance
-  decidableEq := inferInstance
-  max := or
-  max_def := λ a b => by cases a <;> cases b <;> decide
-  min := and
-  min_def := λ a b => by cases a <;> cases b <;> decide
+  le_refl := Bool.le_refl
+  le_trans _ _ _ := Bool.le_trans
+  le_antisymm _ _ := Bool.le_antisymm
+  le_total := Bool.le_total
+  decidableLE := inferInstance
+  lt_iff_le_not_le _ _ := Bool.lt_iff_le_not_le
 #align bool.linear_order Bool.linearOrder
 
-@[simp] theorem max_eq_or : max = or := rfl
-
-@[simp] theorem min_eq_and : min = and := rfl
+attribute [simp] Bool.max_eq_or Bool.min_eq_and
 
-@[simp]
-theorem false_le {x : Bool} : false ≤ x :=
-  Or.intro_left _ rfl
 #align bool.ff_le Bool.false_le
-
-@[simp]
-theorem le_true {x : Bool} : x ≤ true :=
-  Or.intro_right _ rfl
 #align bool.le_tt Bool.le_true
 
 theorem lt_iff : ∀ {x y : Bool}, x < y ↔ x = false ∧ y = true := by decide
@@ -386,17 +325,15 @@ def ofNat (n : Nat) : Bool :=
 theorem ofNat_le_ofNat {n m : Nat} (h : n ≤ m) : ofNat n ≤ ofNat m := by
   simp only [ofNat, ne_eq, _root_.decide_not]
   cases Nat.decEq n 0 with
-  | isTrue hn => rw [decide_eq_true hn]; exact false_le
+  | isTrue hn => rw [decide_eq_true hn]; exact Bool.false_le _
   | isFalse hn =>
     cases Nat.decEq m 0 with
-    | isFalse hm => rw [decide_eq_false hm]; exact le_true
+    | isFalse hm => rw [decide_eq_false hm]; exact Bool.le_true _
     | isTrue hm => subst hm; have h := le_antisymm h (Nat.zero_le n); contradiction
 #align bool.of_nat_le_of_nat Bool.ofNat_le_ofNat
 
 theorem toNat_le_toNat {b₀ b₁ : Bool} (h : b₀ ≤ b₁) : toNat b₀ ≤ toNat b₁ := by
-  cases h with
-  | inl h => subst h; exact Nat.zero_le _
-  | inr h => subst h; cases b₀ <;> simp
+  cases b₀ <;> cases b₁ <;> simp_all
 #align bool.to_nat_le_to_nat Bool.toNat_le_toNat
 
 theorem ofNat_toNat (b : Bool) : ofNat (toNat b) = b := by
chore(Data/Bool/Basic): lemmas about min and max (#7984)
Diff
@@ -20,8 +20,6 @@ bool, boolean, Bool, De Morgan
 
 -/
 
-set_option autoImplicit true
-
 namespace Bool
 
 theorem decide_True {h} : @decide True h = true :=
@@ -83,11 +81,11 @@ theorem eq_iff_eq_true_iff {a b : Bool} : a = b ↔ ((a = true) ↔ (b = true))
   cases a <;> cases b <;> simp
 
 -- Porting note: new theorem
-theorem beq_eq_decide_eq [DecidableEq α]
+theorem beq_eq_decide_eq {α} [DecidableEq α]
     (a b : α) : (a == b) = decide (a = b) := rfl
 
 -- Porting note: new theorem
-theorem beq_comm [BEq α] [LawfulBEq α] {a b : α} : (a == b) = (b == a) :=
+theorem beq_comm {α} [BEq α] [LawfulBEq α] {a b : α} : (a == b) = (b == a) :=
   eq_iff_eq_true_iff.2 (by simp [@eq_comm α])
 
 @[simp]
@@ -332,6 +330,10 @@ instance linearOrder : LinearOrder Bool where
   min_def := λ a b => by cases a <;> cases b <;> decide
 #align bool.linear_order Bool.linearOrder
 
+@[simp] theorem max_eq_or : max = or := rfl
+
+@[simp] theorem min_eq_and : min = and := rfl
+
 @[simp]
 theorem false_le {x : Bool} : false ≤ x :=
   Or.intro_left _ rfl
chore: fix the names of some Bool lemmas (#7841)
Diff
@@ -138,8 +138,8 @@ theorem cond_not {α} (b : Bool) (t e : α) : cond (!b) t e = cond b e t := by c
 theorem not_ne_id : not ≠ id := fun h ↦ false_ne_true <| congrFun h true
 #align bool.bnot_ne_id Bool.not_ne_id
 
-theorem coe_bool_iff : ∀ {a b : Bool}, (a ↔ b) ↔ a = b := by decide
-#align bool.coe_bool_iff Bool.coe_bool_iff
+theorem coe_iff_coe : ∀ {a b : Bool}, (a ↔ b) ↔ a = b := by decide
+#align bool.coe_bool_iff Bool.coe_iff_coe
 
 theorem eq_true_of_ne_false : ∀ {a : Bool}, a ≠ false → a = true := by decide
 #align bool.eq_tt_of_ne_ff Bool.eq_true_of_ne_false
chore: remove Nat.bitwise' (#7451)

Building upon the proof that Nat.bitwise and Nat.bitwise' are equal (from #7410), this PR completely removes bitwise' and changes all uses to bitwise instead.

In particular, land'/lor'/lxor' are replaced with the bitwise-based equivalent operations in core, which have overriden optimized implementations in the compiler.

Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Alex Keizer <alex@keizer.dev> Co-authored-by: Chris Hughes <chrishughes24@gmail.com>

Diff
@@ -259,6 +259,8 @@ theorem or_not_self : ∀ x, (x || !x) = true := by decide
 theorem not_or_self : ∀ x, (!x || x) = true := by decide
 #align bool.bnot_bor_self Bool.not_or_self
 
+theorem bne_eq_xor : bne = xor := by funext a b; revert a b; decide
+
 theorem xor_comm : ∀ a b, xor a b = xor b a := by decide
 #align bool.bxor_comm Bool.xor_comm
 
chore: bump std (#7602)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -135,7 +135,7 @@ theorem cond_decide {α} (p : Prop) [Decidable p] (t e : α) :
 theorem cond_not {α} (b : Bool) (t e : α) : cond (!b) t e = cond b e t := by cases b <;> rfl
 #align bool.cond_bnot Bool.cond_not
 
-theorem not_ne_id : not ≠ id := fun h ↦ ff_ne_tt <| congrFun h true
+theorem not_ne_id : not ≠ id := fun h ↦ false_ne_true <| congrFun h true
 #align bool.bnot_ne_id Bool.not_ne_id
 
 theorem coe_bool_iff : ∀ {a b : Bool}, (a ↔ b) ↔ a = b := by decide
@@ -401,7 +401,7 @@ theorem ofNat_toNat (b : Bool) : ofNat (toNat b) = b := by
 
 @[simp]
 theorem injective_iff {α : Sort*} {f : Bool → α} : Function.Injective f ↔ f false ≠ f true :=
-  ⟨fun Hinj Heq ↦ ff_ne_tt (Hinj Heq), fun H x y hxy ↦ by
+  ⟨fun Hinj Heq ↦ false_ne_true (Hinj Heq), fun H x y hxy ↦ by
     cases x <;> cases y
     exacts [rfl, (H hxy).elim, (H hxy.symm).elim, rfl]⟩
 #align bool.injective_iff Bool.injective_iff
fix: disable autoImplicit globally (#6528)

Autoimplicits are highly controversial and also defeat the performance-improving work in #6474.

The intent of this PR is to make autoImplicit opt-in on a per-file basis, by disabling it in the lakefile and enabling it again with set_option autoImplicit true in the few files that rely on it.

That also keeps this PR small, as opposed to attempting to "fix" files to not need it any more.

I claim that many of the uses of autoImplicit in these files are accidental; situations such as:

  • Assuming variables are in scope, but pasting the lemma in the wrong section
  • Pasting in a lemma from a scratch file without checking to see if the variable names are consistent with the rest of the file
  • Making a copy-paste error between lemmas and forgetting to add an explicit arguments.

Having set_option autoImplicit false as the default prevents these types of mistake being made in the 90% of files where autoImplicits are not used at all, and causes them to be caught by CI during review.

I think there were various points during the port where we encouraged porters to delete the universes u v lines; I think having autoparams for universe variables only would cover a lot of the cases we actually use them, while avoiding any real shortcomings.

A Zulip poll (after combining overlapping votes accordingly) was in favor of this change with 5:5:18 as the no:dontcare:yes vote ratio.

While this PR was being reviewed, a handful of files gained some more likely-accidental autoImplicits. In these places, set_option autoImplicit true has been placed locally within a section, rather than at the top of the file.

Diff
@@ -20,6 +20,8 @@ bool, boolean, Bool, De Morgan
 
 -/
 
+set_option autoImplicit true
+
 namespace Bool
 
 theorem decide_True {h} : @decide True h = true :=
chore: banish Type _ and Sort _ (#6499)

We remove all possible occurences of Type _ and Sort _ in favor of Type* and Sort*.

This has nice performance benefits.

Diff
@@ -398,7 +398,7 @@ theorem ofNat_toNat (b : Bool) : ofNat (toNat b) = b := by
 #align bool.of_nat_to_nat Bool.ofNat_toNat
 
 @[simp]
-theorem injective_iff {α : Sort _} {f : Bool → α} : Function.Injective f ↔ f false ≠ f true :=
+theorem injective_iff {α : Sort*} {f : Bool → α} : Function.Injective f ↔ f false ≠ f true :=
   ⟨fun Hinj Heq ↦ ff_ne_tt (Hinj Heq), fun H x y hxy ↦ by
     cases x <;> cases y
     exacts [rfl, (H hxy).elim, (H hxy.symm).elim, rfl]⟩
chore: script to replace headers with #align_import statements (#5979)

Open in Gitpod

Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -2,16 +2,13 @@
 Copyright (c) 2014 Microsoft Corporation. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Leonardo de Moura, Jeremy Avigad
-
-! This file was ported from Lean 3 source module data.bool.basic
-! leanprover-community/mathlib commit c4658a649d216f57e99621708b09dcb3dcccbd23
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.Init.Data.Bool.Lemmas
 import Mathlib.Init.Data.Nat.Lemmas
 import Mathlib.Init.Function
 
+#align_import data.bool.basic from "leanprover-community/mathlib"@"c4658a649d216f57e99621708b09dcb3dcccbd23"
+
 /-!
 # Booleans
 
chore: remove a few superfluous semicolons (#5880)

Alongside any necessary spacing/flow changes to accommodate their removal.

Diff
@@ -381,7 +381,7 @@ def ofNat (n : Nat) : Bool :=
 #align bool.of_nat Bool.ofNat
 
 theorem ofNat_le_ofNat {n m : Nat} (h : n ≤ m) : ofNat n ≤ ofNat m := by
-  simp only [ofNat, ne_eq, _root_.decide_not];
+  simp only [ofNat, ne_eq, _root_.decide_not]
   cases Nat.decEq n 0 with
   | isTrue hn => rw [decide_eq_true hn]; exact false_le
   | isFalse hn =>
@@ -393,7 +393,7 @@ theorem ofNat_le_ofNat {n m : Nat} (h : n ≤ m) : ofNat n ≤ ofNat m := by
 theorem toNat_le_toNat {b₀ b₁ : Bool} (h : b₀ ≤ b₁) : toNat b₀ ≤ toNat b₁ := by
   cases h with
   | inl h => subst h; exact Nat.zero_le _
-  | inr h => subst h; cases b₀ <;> simp;
+  | inr h => subst h; cases b₀ <;> simp
 #align bool.to_nat_le_to_nat Bool.toNat_le_toNat
 
 theorem ofNat_toNat (b : Bool) : ofNat (toNat b) = b := by
fix: Data.Bool.Basic fix statement of not_inj (#5688)

Due to the precedence of not, the statement was !decide (a = !b) -> a = b. Now it is the correct statement

Diff
@@ -311,7 +311,7 @@ theorem not_and : ∀ a b : Bool, (!(a && b)) = (!a || !b) := by decide
 theorem not_or : ∀ a b : Bool, (!(a || b)) = (!a && !b) := by decide
 #align bool.bnot_bor Bool.not_or
 
-theorem not_inj : ∀ {a b : Bool}, !a = !b → a = b := by decide
+theorem not_inj : ∀ {a b : Bool}, (!a) = !b → a = b := by decide
 #align bool.bnot_inj Bool.not_inj
 
 -- Porting note: having to unfold here is not pretty.
fix: move two trivial theorems over booleans to Bool/Basic (#5630)

This eliminates an unnecessary dependency from Num.Bitwise to Bitvec.Defs.

Diff
@@ -412,4 +412,14 @@ theorem apply_apply_apply (f : Bool → Bool) (x : Bool) : f (f (f x)) = f x :=
   cases x <;> cases h₁ : f true <;> cases h₂ : f false <;> simp only [h₁, h₂]
 #align bool.apply_apply_apply Bool.apply_apply_apply
 
+/-- `xor3 x y c` is `((x XOR y) XOR c)`. -/
+protected def xor3 (x y c : Bool) :=
+  xor (xor x y) c
+#align bitvec.xor3 Bool.xor3
+
+/-- `carry x y c` is `x && y || x && c || y && c`. -/
+protected def carry (x y c : Bool) :=
+  x && y || x && c || y && c
+#align bitvec.carry Bool.carry
+
 end Bool
fix: correct for surprising precedence in Bool DeMorgan laws (#4987)

The DeMorgan laws as stated were being parsed as an inequality

! ((a && b) = (!a || !b))

So, I added parenthesis to force the intended meaning of

(!(a && b)) = (!a || !b)
Diff
@@ -304,11 +304,11 @@ theorem xor_iff_ne : ∀ {x y : Bool}, xor x y = true ↔ x ≠ y := by decide
 /-! ### De Morgan's laws for booleans-/
 
 @[simp]
-theorem not_and : ∀ a b : Bool, !(a && b) = (!a || !b) := by decide
+theorem not_and : ∀ a b : Bool, (!(a && b)) = (!a || !b) := by decide
 #align bool.bnot_band Bool.not_and
 
 @[simp]
-theorem not_or : ∀ a b : Bool, !(a || b) = (!a && !b) := by decide
+theorem not_or : ∀ a b : Bool, (!(a || b)) = (!a && !b) := by decide
 #align bool.bnot_bor Bool.not_or
 
 theorem not_inj : ∀ {a b : Bool}, !a = !b → a = b := by decide
chore: formatting issues (#4947)

Co-authored-by: Scott Morrison <scott.morrison@anu.edu.au> Co-authored-by: Parcly Taxel <reddeloostw@gmail.com>

Diff
@@ -80,12 +80,12 @@ theorem not_false' : ¬false := fun.
 #align bool.not_ff Bool.not_false'
 
 -- Porting note: new theorem
-theorem eq_iff_eq_true_iff {a b : Bool} : a = b ↔ ((a = true) ↔ (b = true)) :=
-by cases a <;> cases b <;> simp
+theorem eq_iff_eq_true_iff {a b : Bool} : a = b ↔ ((a = true) ↔ (b = true)) := by
+  cases a <;> cases b <;> simp
 
 -- Porting note: new theorem
 theorem beq_eq_decide_eq [DecidableEq α]
-  (a b : α) : (a == b) = decide (a = b) := rfl
+    (a b : α) : (a == b) = decide (a = b) := rfl
 
 -- Porting note: new theorem
 theorem beq_comm [BEq α] [LawfulBEq α] {a b : α} : (a == b) = (b == a) :=
chore: add space after exacts (#4945)

Too often tempted to change these during other PRs, so doing a mass edit here.

Co-authored-by: Scott Morrison <scott.morrison@anu.edu.au>

Diff
@@ -404,7 +404,7 @@ theorem ofNat_toNat (b : Bool) : ofNat (toNat b) = b := by
 theorem injective_iff {α : Sort _} {f : Bool → α} : Function.Injective f ↔ f false ≠ f true :=
   ⟨fun Hinj Heq ↦ ff_ne_tt (Hinj Heq), fun H x y hxy ↦ by
     cases x <;> cases y
-    exacts[rfl, (H hxy).elim, (H hxy.symm).elim, rfl]⟩
+    exacts [rfl, (H hxy).elim, (H hxy.symm).elim, rfl]⟩
 #align bool.injective_iff Bool.injective_iff
 
 /-- **Kaminski's Equation** -/
chore: fix upper/lowercase in comments (#4360)
  • Run a non-interactive version of fix-comments.py on all files.
  • Go through the diff and manually add/discard/edit chunks.
Diff
@@ -112,12 +112,12 @@ theorem exists_bool {p : Bool → Prop} : (∃ b, p b) ↔ p false ∨ p true :=
   | .inr h => ⟨_, h⟩ ⟩
 #align bool.exists_bool Bool.exists_bool
 
-/-- If `p b` is decidable for all `b : bool`, then `∀ b, p b` is decidable -/
+/-- If `p b` is decidable for all `b : Bool`, then `∀ b, p b` is decidable -/
 instance decidableForallBool {p : Bool → Prop} [∀ b, Decidable (p b)] : Decidable (∀ b, p b) :=
   decidable_of_decidable_of_iff forall_bool.symm
 #align bool.decidable_forall_bool Bool.decidableForallBool
 
-/-- If `p b` is decidable for all `b : bool`, then `∃ b, p b` is decidable -/
+/-- If `p b` is decidable for all `b : Bool`, then `∃ b, p b` is decidable -/
 instance decidableExistsBool {p : Bool → Prop} [∀ b, Decidable (p b)] : Decidable (∃ b, p b) :=
   decidable_of_decidable_of_iff exists_bool.symm
 #align bool.decidable_exists_bool Bool.decidableExistsBool
@@ -370,12 +370,12 @@ theorem right_le_or : ∀ x y : Bool, y ≤ (x || y) := by decide
 theorem or_le : ∀ {x y z}, x ≤ z → y ≤ z → (x || y) ≤ z := by decide
 #align bool.bor_le Bool.or_le
 
-/-- convert a `bool` to a `ℕ`, `false -> 0`, `true -> 1` -/
+/-- convert a `Bool` to a `ℕ`, `false -> 0`, `true -> 1` -/
 def toNat (b : Bool) : Nat :=
   cond b 1 0
 #align bool.to_nat Bool.toNat
 
-/-- convert a `ℕ` to a `bool`, `0 -> false`, everything else -> `true` -/
+/-- convert a `ℕ` to a `Bool`, `0 -> false`, everything else -> `true` -/
 def ofNat (n : Nat) : Bool :=
   decide (n ≠ 0)
 #align bool.of_nat Bool.ofNat
fix: correct names of LinearOrder decidable fields (#4006)

This renames

  • decidable_eq to decidableEq
  • decidable_lt to decidableLT
  • decidable_le to decidableLE
  • decidableLT_of_decidableLE to decidableLTOfDecidableLE
  • decidableEq_of_decidableLE to decidableEqOfDecidableLE

These fields are data not proofs, so they should be lowerCamelCased.

Diff
@@ -323,8 +323,8 @@ instance linearOrder : LinearOrder Bool where
   le_trans := by unfold LE.le; decide
   le_antisymm := by unfold LE.le Preorder.toLE; decide
   le_total := by unfold LE.le Preorder.toLE PartialOrder.toPreorder; decide
-  decidable_le := by unfold LE.le Preorder.toLE PartialOrder.toPreorder; exact inferInstance
-  decidable_eq := inferInstance
+  decidableLE := by unfold LE.le Preorder.toLE PartialOrder.toPreorder; exact inferInstance
+  decidableEq := inferInstance
   max := or
   max_def := λ a b => by cases a <;> cases b <;> decide
   min := and
chore: tidy various files (#2446)
Diff
@@ -36,8 +36,8 @@ theorem decide_False {h} : @decide False h = false :=
 @[simp]
 theorem decide_coe (b : Bool) {h} : @decide b h = b := by
   cases b
-  { exact decide_eq_false $ λ j => by cases j }
-  { exact decide_eq_true $ rfl }
+  · exact decide_eq_false $ λ j => by cases j
+  · exact decide_eq_true $ rfl
 #align bool.to_bool_coe Bool.decide_coe
 
 theorem coe_decide (p : Prop) [d : Decidable p] : decide p ↔ p :=
chore: bump std (#2156)
Diff
@@ -74,10 +74,7 @@ theorem decide_or (p q : Prop) [Decidable p] [Decidable q] : decide (p ∨ q) =
   by_cases p <;> by_cases q <;> simp [*]
 #align bool.to_bool_or Bool.decide_or
 
-@[simp]
-theorem decide_eq {p q : Prop} [Decidable p] [Decidable q] : decide p = decide q ↔ (p ↔ q) :=
-  ⟨fun h ↦ (coe_decide p).symm.trans <| by simp [h], decide_congr⟩
-#align bool.to_bool_eq Bool.decide_eq
+#align bool.to_bool_eq decide_eq_decide
 
 theorem not_false' : ¬false := fun.
 #align bool.not_ff Bool.not_false'
chore: add missing #align statements (#1902)

This PR is the result of a slight variant on the following "algorithm"

  • take all mathlib 3 names, remove _ and make all uppercase letters into lowercase
  • take all mathlib 4 names, remove _ and make all uppercase letters into lowercase
  • look for matches, and create pairs (original_lean3_name, OriginalLean4Name)
  • for pairs that do not have an align statement:
    • use Lean 4 to lookup the file + position of the Lean 4 name
    • add an #align statement just before the next empty line
  • manually fix some tiny mistakes (e.g., empty lines in proofs might cause the #align statement to have been inserted too early)
Diff
@@ -97,12 +97,15 @@ theorem beq_comm [BEq α] [LawfulBEq α] {a b : α} : (a == b) = (b == a) :=
 @[simp]
 theorem default_bool : default = false :=
   rfl
+#align bool.default_bool Bool.default_bool
 
 theorem dichotomy (b : Bool) : b = false ∨ b = true := by cases b <;> simp
+#align bool.dichotomy Bool.dichotomy
 
 @[simp]
 theorem forall_bool {p : Bool → Prop} : (∀ b, p b) ↔ p false ∧ p true :=
   ⟨fun h ↦ by simp [h], fun ⟨h₁, h₂⟩ b ↦ by cases b <;> assumption⟩
+#align bool.forall_bool Bool.forall_bool
 
 @[simp]
 theorem exists_bool {p : Bool → Prop} : (∃ b, p b) ↔ p false ∨ p true :=
@@ -110,6 +113,7 @@ theorem exists_bool {p : Bool → Prop} : (∃ b, p b) ↔ p false ∨ p true :=
   fun h ↦ match h with
   | .inl h => ⟨_, h⟩
   | .inr h => ⟨_, h⟩ ⟩
+#align bool.exists_bool Bool.exists_bool
 
 /-- If `p b` is decidable for all `b : bool`, then `∀ b, p b` is decidable -/
 instance decidableForallBool {p : Bool → Prop} [∀ b, Decidable (p b)] : Decidable (∀ b, p b) :=
@@ -123,6 +127,7 @@ instance decidableExistsBool {p : Bool → Prop} [∀ b, Decidable (p b)] : Deci
 
 theorem cond_eq_ite {α} (b : Bool) (t e : α) : cond b t e = if b then t else e := by
   cases b <;> simp
+#align bool.cond_eq_ite Bool.cond_eq_ite
 
 @[simp]
 theorem cond_decide {α} (p : Prop) [Decidable p] (t e : α) :
@@ -138,6 +143,7 @@ theorem not_ne_id : not ≠ id := fun h ↦ ff_ne_tt <| congrFun h true
 #align bool.bnot_ne_id Bool.not_ne_id
 
 theorem coe_bool_iff : ∀ {a b : Bool}, (a ↔ b) ↔ a = b := by decide
+#align bool.coe_bool_iff Bool.coe_bool_iff
 
 theorem eq_true_of_ne_false : ∀ {a : Bool}, a ≠ false → a = true := by decide
 #align bool.eq_tt_of_ne_ff Bool.eq_true_of_ne_false
@@ -339,6 +345,7 @@ theorem le_true {x : Bool} : x ≤ true :=
 #align bool.le_tt Bool.le_true
 
 theorem lt_iff : ∀ {x y : Bool}, x < y ↔ x = false ∧ y = true := by decide
+#align bool.lt_iff Bool.lt_iff
 
 @[simp]
 theorem false_lt_true : false < true :=
@@ -346,6 +353,7 @@ theorem false_lt_true : false < true :=
 #align bool.ff_lt_tt Bool.false_lt_true
 
 theorem le_iff_imp : ∀ {x y : Bool}, x ≤ y ↔ x → y := by decide
+#align bool.le_iff_imp Bool.le_iff_imp
 
 theorem and_le_left : ∀ x y : Bool, (x && y) ≤ x := by decide
 #align bool.band_le_left Bool.and_le_left
@@ -383,23 +391,28 @@ theorem ofNat_le_ofNat {n m : Nat} (h : n ≤ m) : ofNat n ≤ ofNat m := by
     cases Nat.decEq m 0 with
     | isFalse hm => rw [decide_eq_false hm]; exact le_true
     | isTrue hm => subst hm; have h := le_antisymm h (Nat.zero_le n); contradiction
+#align bool.of_nat_le_of_nat Bool.ofNat_le_ofNat
 
 theorem toNat_le_toNat {b₀ b₁ : Bool} (h : b₀ ≤ b₁) : toNat b₀ ≤ toNat b₁ := by
   cases h with
   | inl h => subst h; exact Nat.zero_le _
   | inr h => subst h; cases b₀ <;> simp;
+#align bool.to_nat_le_to_nat Bool.toNat_le_toNat
 
 theorem ofNat_toNat (b : Bool) : ofNat (toNat b) = b := by
   cases b <;> rfl
+#align bool.of_nat_to_nat Bool.ofNat_toNat
 
 @[simp]
 theorem injective_iff {α : Sort _} {f : Bool → α} : Function.Injective f ↔ f false ≠ f true :=
   ⟨fun Hinj Heq ↦ ff_ne_tt (Hinj Heq), fun H x y hxy ↦ by
     cases x <;> cases y
     exacts[rfl, (H hxy).elim, (H hxy.symm).elim, rfl]⟩
+#align bool.injective_iff Bool.injective_iff
 
 /-- **Kaminski's Equation** -/
 theorem apply_apply_apply (f : Bool → Bool) (x : Bool) : f (f (f x)) = f x := by
   cases x <;> cases h₁ : f true <;> cases h₂ : f false <;> simp only [h₁, h₂]
+#align bool.apply_apply_apply Bool.apply_apply_apply
 
 end Bool
chore: fix most phantom #aligns (#1794)
Diff
@@ -157,7 +157,7 @@ theorem or_inl {a b : Bool} (H : a) : a || b := by simp [H]
 #align bool.bor_inl Bool.or_inl
 
 theorem or_inr {a b : Bool} (H : b) : a || b := by cases a <;> simp [H]
-#align bool.bot_inr Bool.or_inr
+#align bool.bor_inr Bool.or_inr
 
 theorem and_comm : ∀ a b, (a && b) = (b && a) := by decide
 #align bool.band_comm Bool.and_comm
Bug fix: Bool.not_ne_self missing "()" (#1755)

where !b ≠ b is interpreted as (!decide (b ≠ b)), but meant to be (!b) ≠ b.

Diff
@@ -220,7 +220,7 @@ theorem ne_not {a b : Bool} : a ≠ !b ↔ a = b :=
 theorem not_ne : ∀ {a b : Bool}, (!a) ≠ b ↔ a = b := not_not_eq
 #align bool.bnot_ne Bool.not_ne
 
-lemma not_ne_self : ∀ b : Bool, !b ≠ b := by decide
+lemma not_ne_self : ∀ b : Bool, (!b) ≠ b := by decide
 #align bool.bnot_ne_self Bool.not_ne_self
 
 lemma self_ne_not : ∀ b : Bool, b ≠ !b := by decide
feat: port Data.List.Count (#1410)

Co-authored-by: ChrisHughes24 <chrishughes24@gmail.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: thirdsgames <thirdsgames2018@gmail.com> Co-authored-by: zeramorphic <zeramorphic@proton.me> Co-authored-by: zeramorphic <50671761+zeramorphic@users.noreply.github.com>

Diff
@@ -82,6 +82,18 @@ theorem decide_eq {p q : Prop} [Decidable p] [Decidable q] : decide p = decide q
 theorem not_false' : ¬false := fun.
 #align bool.not_ff Bool.not_false'
 
+-- Porting note: new theorem
+theorem eq_iff_eq_true_iff {a b : Bool} : a = b ↔ ((a = true) ↔ (b = true)) :=
+by cases a <;> cases b <;> simp
+
+-- Porting note: new theorem
+theorem beq_eq_decide_eq [DecidableEq α]
+  (a b : α) : (a == b) = decide (a = b) := rfl
+
+-- Porting note: new theorem
+theorem beq_comm [BEq α] [LawfulBEq α] {a b : α} : (a == b) = (b == a) :=
+  eq_iff_eq_true_iff.2 (by simp [@eq_comm α])
+
 @[simp]
 theorem default_bool : default = false :=
   rfl
chore: add source headers to ported theory files (#1094)

The script used to do this is included. The yaml file was obtained from https://raw.githubusercontent.com/wiki/leanprover-community/mathlib/mathlib4-port-status.md

Diff
@@ -2,6 +2,11 @@
 Copyright (c) 2014 Microsoft Corporation. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Leonardo de Moura, Jeremy Avigad
+
+! This file was ported from Lean 3 source module data.bool.basic
+! leanprover-community/mathlib commit c4658a649d216f57e99621708b09dcb3dcccbd23
+! Please do not edit these lines, except to modify the commit id
+! if you have ported upstream changes.
 -/
 import Mathlib.Init.Data.Bool.Lemmas
 import Mathlib.Init.Data.Nat.Lemmas

Dependencies

1 files ported (100.0%)
262 lines ported (100.0%)

All dependencies are ported!