Skip to content

Commit

Permalink
chore(Logic/Equiv): change type of sumEquivSigmaBool to simp normal…
Browse files Browse the repository at this point in the history
… form (#21338)

`simp` eagerly rewrites `Bool.casesOn` to `Bool.rec`, so using the former in the type signature prevents related `simp` lemmas from firing.

See [Zulip discussion](https://leanprover.zulipchat.com/#narrow/channel/287929-mathlib4/topic/.60.40.5Bsimp.5D.60.20lemmas.20about.20Equiv.2EsumEquivSigmaBool.20don't.20fire).
  • Loading branch information
lambda-fairy authored and jt496 committed Feb 3, 2025
1 parent 95fd661 commit 917ade6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Mathlib/Logic/Equiv/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ In this file we continue the work on equivalences begun in `Mathlib/Logic/Equiv/
* canonical isomorphisms between various types: e.g.,
- `Equiv.sumEquivSigmaBool` is the canonical equivalence between the sum of two types `α ⊕ β`
and the sigma-type `Σ b : Bool, b.casesOn α β`;
and the sigma-type `Σ b, bif b then β else α`;
- `Equiv.prodSumDistrib : α × (β ⊕ γ) ≃ (α × β) ⊕ (α × γ)` shows that type product and type sum
satisfy the distributive law up to a canonical equivalence;
Expand Down Expand Up @@ -476,7 +476,7 @@ def piOptionEquivProd {α} {β : Option α → Type*} :
`β` to be types from the same universe, so it cannot be used directly to transfer theorems about
sigma types to theorems about sum types. In many cases one can use `ULift` to work around this
difficulty. -/
def sumEquivSigmaBool (α β) : α ⊕ β ≃ Σ b : Bool, b.casesOn α β :=
def sumEquivSigmaBool (α β) : α ⊕ β ≃ Σ b, bif b then β else α :=
fun s => s.elim (fun x => ⟨false, x⟩) fun x => ⟨true, x⟩, fun s =>
match s with
| ⟨false, a⟩ => inl a
Expand Down

0 comments on commit 917ade6

Please sign in to comment.