Skip to Content.
Sympa Menu

coq-club - [Coq-Club] backtracking issue with typeclasses eauto

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

[Coq-Club] backtracking issue with typeclasses eauto


Chronological Thread 
  • From: nicolas tabareau <nicolas.tabareau AT inria.fr>
  • To: coq-club AT inria.fr
  • Subject: [Coq-Club] backtracking issue with typeclasses eauto
  • Date: Mon, 7 Mar 2016 21:31:42 +0100
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=tabareau.nicolas AT gmail.com; spf=Pass smtp.mailfrom=tabareau.nicolas AT gmail.com; spf=None smtp.helo=postmaster AT mail-lb0-f174.google.com
  • Ironport-phdr: 9a23:+ZVCoRwv8if3E6TXCy+O+j09IxM/srCxBDY+r6Qd0eIXIJqq85mqBkHD//Il1AaPBtWEraIdwLON6OjJYi8p39WoiDg6aptCVhsI2409vjcLJ4q7M3D9N+PgdCcgHc5PBxdP9nC/NlVJSo6lPwWB6kO74TNaIBjjLw09fr2zQd6NyZTunLnpoNX6WEZhunmUWftKNhK4rAHc5IE9oLBJDeIP8CbPuWZCYO9MxGlldhq5lhf44dqsrtY4q3wD86Fpy8kVWqLjOq88ULZwDTI8Mmlz6te4jxTbSRqz4S4aU24RlhNTRRTM5hjgU57smir8rOt0nieAbuPsSrVhXzWp6KNiU1f0gS0OLTMw7SmDjM17i6ZSu1S9rhZ22YPdfamUMuB/d+XTZ4VJFiJ6Qs9NWnkZUcuHZIwVAr9ZMA==

Dear All, 

It seems that when typeclasses eauto manages
to finish a subgoal with exact, it does not backtrack 
on it when the other subgoals fail (below a not too 
long example that exhibits the issue). 

Do I understand the problem correctly ?

Can it be solved without the seely alias trick 
I use ? 

Best, 

-- Nicolas 

Notation "x .1" := (projT1 x) (at level 3).

Parameter myType: Type. 

Class Foo (a:myType) := {}.

Class Bar (a:myType) := {}.

Parameter fooTobar : forall a (H : Foo a), {b: myType & Bar b}.

Hint Extern 5 (Bar ?D.1) =>
    destruct D; simpl : typeclass_instances.

Hint Extern 1 myType => simple refine (fooTobar _ _).1. 

Hint Extern 5 {b: myType & Bar b} =>
  simple refine (existT Bar (_:myType) _).

Definition trivial a (H : Foo a) : {b : myType & Bar b}. 
Proof.
  (* does not try to do simple refine (fooTobar _ _).1. *)
  Fail typeclasses eauto with core typeclass_instances.
Abort.

(* just using an alias, to prevent exact to succeed *)

Definition myType2:= myType.

Hint Extern 1 myType2 => simple refine (fooTobar _ _).1. 

Hint Extern 5 {b: myType2 & Bar b} =>
  simple refine (existT Bar (_:myType2) _).

Definition trivial a (H : Foo a) : {b : myType2 & Bar b}. 
Proof.
  typeclasses eauto with core typeclass_instances.
Defined. 



Archive powered by MHonArc 2.6.18.

Top of Page