Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Roqc/test-suite/success/   (Beweissystem des Inria Version 9.1.0©)  Datei vom 15.8.2025 mit Größe 3 kB image not shown  

Quelle  auto.v   Sprache: Coq

 
(* coq-prog-args: ("-async-proofs" "off") *)
(* Wish #2154 by E. van der Weegen *)

(* auto was not using f_equal-style lemmas with metavariables occurring
   only in the type of an evar of the concl, but not directly in the
   concl itself *)


Parameters
  (F: Prop -> Prop)
  (G: forall T, (T -> Prop) -> Type)
  (L: forall A (P: A -> Prop), G A P -> forall x, F (P x))
  (Q: unit -> Prop).

#[exportHint Resolve L.

Goal G unit Q -> F (Q tt).
  intro.
  eauto. 
Qed.

(* Test implicit arguments in "using" clause *)

Goal forall n:nat, nat * nat.
epose (H := pair O).
auto using H.
Undo.
eauto using H.
Qed.

Create HintDb test discriminated.

Parameter foo : forall x, x = x + 0.
#[exportHint Resolve foo : test.

Parameter C : nat -> Type -> Prop.

Parameter c_inst : C 0 nat.

#[exportHint Resolve c_inst : test.

#[exportHint Mode C - + : test.
#[exportHint Resolve c_inst : test2.
#[exportHint Mode C + + : test2.

Goal exists n, C n nat.
Proof.
  eexists. Fail progress debug eauto with test2. 
  progress eauto with test.
Qed.

(** Patterns of Extern have a "matching" semantics.
    It is not so for apply/exact hints *)


Class B (A : Type).
Class I. 
#[exportInstance i : I := {}.
  
Definition flip {A B C : Type} (f : A -> B -> C) := fun y x => f x y.
Class D (f : nat -> nat -> nat).
Definition ftest (x y : nat) := x + y.
Definition flipD (f : nat -> nat -> nat) : D f -> D (flip f).
  Admitted.
Module Instnopat.
  Local Instance: B nat := {}.
  (* pattern_of_constr -> B nat *)
  (* exact hint *)
  Check (_ : B nat).
  (* map_eauto -> B_instance0 *)
  (* NO Constr_matching.matches !!! *)
  Check (_ : B _).

  Goal exists T, B T.
    eexists.
    eauto with typeclass_instances.
  Qed.

  Local Instance: D ftest := {}.
  Local Hint Resolve flipD | 0 : typeclass_instances.
  (* pattern: D (flip _) *)
  Fail Timeout 1 Check (_ : D _). (* loops applying flipD *)  
  
End Instnopat.

Module InstnopatApply.
  Local Instance: I -> B nat := {}.
  (* pattern_of_constr -> B nat *)
  (* apply hint  *)
  Check (_ : B nat).
  (* map_eauto -> B_instance0 *)
  (* NO Constr_matching.matches !!! *)
  Check (_ : B _).

  Goal exists T, B T.
    eexists.
    eauto with typeclass_instances.
  Qed.
End InstnopatApply.
  
Module InstPat.
  #[exportHint Extern 3 (B nat) => split : typeclass_instances.
  (* map_eauto -> Extern hint *)
  (* Constr_matching.matches -> true *)
  Check (_ : B nat).
  (* map_eauto -> Extern hint *)
  (* Constr_matching.matches -> false:
     Because an inductive in the pattern does not match an evar in the goal *)

  Check (_ : B _).

  Goal exists T, B T.
    eexists.
    (* map_existential -> Extern hint *)
    (* Constr_matching.matches -> false *)
    Fail progress eauto with typeclass_instances.
    (* map_eauto -> Extern hint *)
    (* Constr_matching.matches -> false *)
    Fail typeclasses eauto.
  Abort.

  #[exportHint Extern 0 (D (flip _)) => apply flipD : typeclass_instances.
  Module withftest.
    Local Instance: D ftest := {}.

    Check (_ : D _).
    (* D_instance_0 : D ftest *)
    Check (_ : D (flip _)).
    (* ... : D (flip ftest) *)
  End withftest.
  Module withoutftest.
    #[exportHint Extern 0 (D ftest) => split : typeclass_instances.
    Check (_ : D _).
    (* ? : D ?, _not_ looping *)
    Check (_ : D (flip _)).
    (* ? : D (flip ?), _not_ looping *)

    Check (_ : D (flip ftest)).
    (* flipD ftest {|  |} : D (flip ftest) *)
  End withoutftest.
End InstPat.

Messung V0.5
C=81 H=100 G=90

¤ Dauer der Verarbeitung: 0.10 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.