Skip to content

Some extensions to expand-record #900

@patrick-nicodemus

Description

@patrick-nicodemus

I think expand-record is potentially pretty valuable to me and I have an idea to extend it.

I am thinking about the following problem right now:

Record Graph := {
  Ob : Type;
  Hom : Ob -> Ob -> Type
}.
Record GraphHom (A B : Graph) := {
   f_ob :> Ob A -> Ob B;
   fmap : forall (x y : Ob A), Hom x y -> Hom (f_ob x) (f_ob y)
}.

Goal forall (A : Graph), GraphHom A A.

After record expansion this problem is easy to solve by a proof search tool like sauto.
But sauto doesn't perform induction, including destructing records, so I think the
utility of sauto could be much improved by this kind of reduction.

My idea here is to

  1. extend the record_expansion to record declarations and not just definitions, so that one could use an elpi command to derive Record expand_GraphHom Ob_A Hom_A Ob_B Hom_B := { expand_f_ob : Ob_A -> Ob_A; expand_fmap : forall (x y : Ob_A), ... }.
  2. write a tactic which would reduce the goal A : Graph |- GraphHom A A to Ob_A, Hom_A :- expand_GraphHom Ob_A Hom_A Ob_A Hom_A, after which you could apply a constructor and solve the goals.

There are many other small opportunities for improvement. For example one could ask that expand take a list of record arguments, not just one.

I'm wondering if you have any feedback on this plan or if you would accept a PR for such an extension, either the tactic or the plan to expand the command to records.

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