Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support autoParam in structure fields #461

Closed
dselsam opened this issue May 13, 2021 · 1 comment
Closed

Support autoParam in structure fields #461

dselsam opened this issue May 13, 2021 · 1 comment

Comments

@dselsam
Copy link
Contributor

dselsam commented May 13, 2021

The following work:

def FooD (x y : Nat) (h : x = y := by rfl) : Unit := ()

example : Unit := FooD 1 1

inductive FooI where
  | mk (x y : Nat) (h : x = y := by rfl)

example : FooI := FooI.mk 1 1

But this does not:

structure FooS where
  x : Nat
  y : Nat
  h : x = y := by rfl -- error: type mismatch
@sgouezel
Copy link

sgouezel commented May 13, 2021

A weird example of the above, which is used a lot in mathlib, is when a field is defined in some structure foo, and the autoParam is provided in a structure extending foo. Like in

structure FooS where
  x : Nat
  y : Nat
  h : x = y

structure BarS extends FooS where 
  h' : x = y
  h := h'

The reason is that BarS may include new axioms that make it possible to prove automatically h from other fields, while it wasn't the case in FooS.

leodemoura added a commit that referenced this issue Jul 27, 2021
It was exposed by the second example at #461.
ChrisHughes24 pushed a commit to ChrisHughes24/lean4 that referenced this issue Dec 2, 2022
Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
Co-authored-by: Mario Carneiro <di.gama@gmail.com>
ChrisHughes24 pushed a commit to ChrisHughes24/lean4 that referenced this issue Dec 2, 2022
…ib3 (leanprover#457)

This PR discards and replaces with a direct port from mathlib3 the files:
* `Algebra/Group/Defs.lean`
* `Algebra/Group/Basic.lean`
These files contained an ad-hoc redevelopment of parts of the algebraic hierarchy, and the expense of interfacing their content with other material which we need to port from mathlib3 to support tactic development was too high.

The rest of the PR consists of making everything work again!

To do so, we add *partial* ports of mathlib3's
* `Algebra/Group/Units.lean`
* `Algebra/Group/Semiconj.lean`
* `Algebra/Group/Commute.lean`
(just the initial segment of each which was required to provide the lemmas we need to patch up problems from the main replacement above).

~~Unfortunately it's still not working: there are mysterious (to me!) failures in `Tactic/Ring.lean`, which all seem to come down to the simplifier not wanting to use `zero_add` and `add_zero`, even though `exact` or `rw` accepts them. If @digama0 or @gebner would be able to have a look at these and provide some advice I'd much appreciate it.~~

- [x] depends on: leanprover#461 

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants