leanprover-community / leanprover-community/lean

Make `@[trans]`/`calc` work with `homeomorph` etc

Open
#341 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
434
Forks
79
PR merge metrics
No merged PRs in 30d

Description

Here is a minimal non-working example. See also homeomorph.trans in mathlib. It seems that calc makes very strict assumptions on the meaning of implicit arguments preceding the explicit arguments of the @[trans] lemma, and we can't satisfy these assumptions with homeomorph, local_homeomorph, monoid_hom etc, see Zulip chat.

structure inhabited_hom (α β : Type*) [inhabited α] [inhabited β] :=
(to_fun : α → β)
(map_default : to_fun (default α) = default β)

notation α `→'`:25 β := inhabited_hom α β

@[trans] def inhabited_hom.trans {α β γ : Type*} [inhabited α] [inhabited β] [inhabited γ]
  (f : α →' β) (g : β →' γ) :
  α →' γ :=
{ to_fun := λ x, g.to_fun (f.to_fun x),
  map_default := by rw [f.map_default, g.map_default] }

example {α β γ : Type*} [inhabited α] [inhabited β] [inhabited γ]
  (f : α →' β) (g : β →' γ) : α →' γ :=
calc α →' β : f
... →' γ : g

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the minimal inhabited_hom example and reading how calc resolves @[trans] lemmas. Compare this behavior with homeomorph.trans and the linked Zulip discussion; done means the example and analogous homomorphism cases elaborate successfully without breaking existing calc behavior.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.