lean4-htt/tests/elab/grind_reducible.lean
Garmelon 08eb78a5b2
chore: switch to new test/bench suite (#12590)
This PR sets up the new integrated test/bench suite. It then migrates
all benchmarks and some related tests to the new suite. There's also
some documentation and some linting.

For now, a lot of the old tests are left alone so this PR doesn't become
even larger than it already is. Eventually, all tests should be migrated
to the new suite though so there isn't a confusing mix of two systems.
2026-02-25 13:51:53 +00:00

62 lines
2.1 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

variable {α β γ : Type}
structure Equiv (α β : Type) where
toFun : α → β
invFun : β → α
infixl:25 " ≃ " => Equiv
namespace Equiv
instance : CoeFun (α ≃ β) (fun _ => α → β) := ⟨toFun⟩
@[ext, grind ext] theorem ext {f g : Equiv α β} (H : ∀ x, f x = g x) : f = g := sorry
theorem congr_fun {f g : Equiv α β} (h : f = g) (x : α) : f x = g x := by rw [h]
def symm (e : α ≃ β) : β ≃ α := ⟨e.invFun, e.toFun⟩
def trans (e₁ : α ≃ β) (e₂ : β ≃ γ) : αγ := ⟨e₂ ∘ e₁, e₁.symm ∘ e₂.symm⟩
def sigmaCongrRight {α : Type} {β₁ β₂ : α → Type} (F : ∀ a, β₁ a ≃ β₂ a) : (Σ a, β₁ a) ≃ Σ a, β₂ a where
toFun a := ⟨a.1, F a.1 a.2⟩
invFun a := ⟨a.1, (F a.1).symm a.2⟩
def sigmaEquivProd (α β : Type) : (Σ _ : α, β) ≃ α × β where
toFun a := ⟨a.1, a.2⟩
invFun a := ⟨a.1, a.2⟩
end Equiv
variable {α₁ β₁ β₂ : Type} (e : α₁ → β₁ ≃ β₂)
def prodCongrRight : α₁ × β₁ ≃ α₁ × β₂ where
toFun ab := ⟨ab.1, e ab.1 ab.2⟩
invFun ab := ⟨ab.1, (e ab.1).symm ab.2⟩
example :
(Equiv.sigmaCongrRight e).trans (Equiv.sigmaEquivProd α₁ β₂)
= (Equiv.sigmaEquivProd α₁ β₁).trans (prodCongrRight e) := by
grind -reducible only [Equiv.congr_fun]
example :
(Equiv.sigmaCongrRight e).trans (Equiv.sigmaEquivProd α₁ β₂)
= (Equiv.sigmaEquivProd α₁ β₁).trans (prodCongrRight e) := by
grind -reducible only => finish only [Equiv.congr_fun]
example :
(Equiv.sigmaCongrRight e).trans (Equiv.sigmaEquivProd α₁ β₂)
= (Equiv.sigmaEquivProd α₁ β₁).trans (prodCongrRight e) := by
grind -reducible => cases #d592 <;> instantiate only [Equiv.congr_fun]
/--
info: Try these:
[apply] grind -reducible only [Equiv.congr_fun, #d592]
[apply] grind -reducible only [Equiv.congr_fun]
[apply] grind -reducible => cases #d592 <;> instantiate only [Equiv.congr_fun]
-/
#guard_msgs in
example :
(Equiv.sigmaCongrRight e).trans (Equiv.sigmaEquivProd α₁ β₂)
= (Equiv.sigmaEquivProd α₁ β₁).trans (prodCongrRight e) := by
grind? -reducible [Equiv.congr_fun]