Quellcodebibliothek Statistik Leitseite products/sources/formale Sprachen/Roqc/theories/Corelib/Strings/   (Beweissystem des Inria Version 9.1.0©)  Datei vom 15.8.2025 mit Größe 1 kB image not shown  

Quelle  PrimStringAxioms.v   Sprache: Coq

 
From Corelib Require Import BinNums PosDef IntDef ListDef.
From Corelib Require Export PrimInt63 Uint63Axioms.
From Corelib Require Export PrimString.

Definition char63_valid (c : char63) :=
  PrimInt63.land c 255%uint63 = c.

(** * Conversion to / from lists *)

Notation of_nat n := (of_Z (Z.of_nat n)).
Notation to_nat i := (Z.to_nat (to_Z i)).

Definition to_list (s : string) : list char63 :=
  ListDef.map (fun i => get s (of_nat i)) (ListDef.seq 0 (to_nat (length s))).

Fixpoint of_list (cs : list char63) : string :=
  match cs with
  | nil       => ""%pstring
  | cons c cs => cat (make 1 c) (of_list cs)
  end.

Axiom of_to_list :
  forall (s : string),
    of_list (to_list s) = s.

Axiom to_list_length :
  forall (s : string),
    Datatypes.length (to_list s) <= to_nat max_length.

Axiom to_list_char63_valid :
  forall (s : string),
    ListDef.Forall char63_valid (to_list s).

(** * Axioms relating string operations with list operations *)

Axiom length_spec :
  forall (s : string),
    to_nat (length s) = Datatypes.length (to_list s).

Axiom get_spec :
  forall (s : string) (i : int),
    get s i = ListDef.nth (to_nat i) (to_list s) 0%uint63.

Axiom make_spec :
  forall (i : int) (c : char63),
    to_list (make i c) =
      ListDef.repeat (PrimInt63.land c 255%uint63)
        (Nat.min (to_nat i) (to_nat max_length)).

Axiom sub_spec :
  forall (s : string) (off len : int),
    to_list (sub s off len) =
      ListDef.firstn (to_nat len) (ListDef.skipn (to_nat off) (to_list s)).

Axiom cat_spec :
  forall (s1 s2 : string),
    to_list (cat s1 s2) =
      ListDef.firstn (to_nat max_length) (to_list s1 ++ to_list s2).

Notation char63_compare := PrimInt63.compare (only parsing).

Axiom compare_spec :
  forall (s1 s2 : string),
    compare s1 s2 =
      ListDef.list_compare char63_compare (to_list s1) (to_list s2).

Messung V0.5
C=97 H=91 G=93

¤ Dauer der Verarbeitung: 0.4 Sekunden  ¤

*© 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.