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 1 kB image not shown  

Quelle  PatternsInBinders.v   Sprache: Coq

 
(** The purpose of this file is to test functional properties of the
    destructive patterns used in binders ([fun] and [forall]). *)



Definition swap {A B} '((x,y) : A*B) := (y,x).

(** Tests the use of patterns in [fun] and [Definition] *)
Section TestFun.

  Variables A B : Type.

  Goal forall (x:A) (y:B), swap (x,y) = (y,x).
  ProofreflexivityQed.

  Goal forall u:A*B, swap (swap u) = u.
  Proofdestruct u. reflexivityQed.

  Goal @swap A B = fun '(x,y) => (y,x).
  ProofreflexivityQed.

End TestFun.


(** Tests the use of patterns in [forall] *)
Section TestForall.

  Variables A B : Type.

  Goal forall '((x,y) : A*B), swap (x,y) = (y,x).
  Proofintros [x y]. reflexivityQed.

  Goal forall x0:A, exists '((x,y) : A*A), swap (x,y) = (x,y).
  Proof.
    intros x0.
    exists (x0,x0).
    reflexivity.
  Qed.

End TestForall.



(** Tests the use of patterns in dependent definitions. *)

Section TestDependent.

  Inductive Fin (n:nat) := Z : Fin n.

  Definition F '(n,p) : Type := (Fin n * Fin p)%type.

  Definition both_z '(n,p) : F (n,p) := (Z _,Z _).

End TestDependent.


(** Tests with a few other types just to make sure parsing is
    robust. *)

Section TestExtra.

  Definition proj_informative {A P} '(exist _ x _ : { x:A | P x }) : A := x.

  Inductive Foo := Bar : nat -> bool -> unit -> nat -> Foo.

  Definition foo '(Bar n b tt p) :=
    if b then n+p else n-p.

End TestExtra.

100%


¤ Dauer der Verarbeitung: 0.15 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 ist noch experimentell.