Skip to content

autoParam in structure fields lost in inheritance #1158

Closed
@raghuram-13

Description

@raghuram-13

Prerequisites

  • Put an X between the brackets on this line if you have done all of the following:
    • Checked that your issue isn't already filed.
    • Reduced the issue to a self-contained, reproducible test case.

Description

autoParams defined for fields of a structure A are sometimes lost in structures B extending them (as far as I can tell, when A is not the first structure B inherits from).

Steps to Reproduce

class magma (α) where op : α → α → α

infix:70 " ⋆ " => magma.op (self := inferInstance)

class leftIdMagma (α) extends magma α where
  identity : α
  id_op (a : α) : identity ⋆ a = a := by intro; rfl

class rightIdMagma (α) extends magma α where
  identity : α
  op_id (a : α) : a ⋆ identity = a := by intro; rfl

class semigroup (α) extends magma α where
  assoc (a b c : α) : (a ⋆ b) ⋆ c = a ⋆ (b ⋆ c) := by intro _ _ _; rfl

class idMagma (α) extends leftIdMagma α, rightIdMagma α

class monoid (α) extends idMagma α, semigroup α

def fnCompMonoid {base : Sort _} : monoid (base → base) :=
{ op := Function.comp, identity := id
-- , op_id := by intro; rfl
-- , assoc := by intros; rfl
}

Expected behavior: fnCompMonoid is successfully defined with the op_id and assoc fields produced using the tactics specified for those fields.

Actual behavior: The op_id and assoc fields need to be specified as in the commented-out lines.

Reproduces how often: Only for fields inherited from a parent structure other than the first parent of a structure (as far as I can tell).

Versions

Additional Information

The above example worked in a nightly version from October 2021.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions