Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  DPC0Library.thy

  Sprache: Isabelle
 

(*
    Author:      Norbert Schirmer
    Maintainer:  Norbert Schirmer, norbert.schirmer at web de

Copyright (C) 2006-2008 Norbert Schirmer
*)


section DPC0 standard library

theory DPC0Library imports DPC0Expressions Vcg begin

text This theory constitutes a standard library for DPC0 programs. At
 first, it includes (indirectly) the C0 library and (directly) its extensions
 for DPC0 specific expressions. Secondly, the Vcg of the verification
 environment is included and its syntax extended by the DPC0 specific
 statement constructs for contextualization.
 



(* =================================================== *)
section Auxiliary functions for the concrete syntax
(* =================================================== *)


primrec pfilter:: "bool list ==> 'a list ==> 'a list"
where
"pfilter c [] = []" |
"pfilter c (v#vs) = (if hd c then v#pfilter (tl c) vs else pfilter (tl c) vs)"


primrec pmask:: "nat ==> bool list ==> nat list"
where
"pmask i [] = []" |
"pmask i (b#bs) = (if b then i#(pmask (Suc i) bs) else pmask (Suc i) bs)"


(* ============================================= *)
section Concrete syntax for Contextualization
(* ============================================= *)

syntax
  "_In":: "[ident,'a,'a] ==> ('s,'p,'f) com"
                 ("(2 IN 🍋_:/ _ :== _)" [1000,30,3021)
  "_Where":: "['a,ident,('s,'p,'f) com] ==> ('s,'p,'f) com"
                 ("(0 WHERE (_)/ FOR 🍋_ DO/ _ EREHW)" [0,0,071)
  "_WhereElse":: "['a,ident,('s,'p,'f) com,('s,'p,'f) com] ==> ('s,'p,'f) com"
                 ("(0 WHERE (_)/ FOR 🍋_ DO/ _ ELSE _ EREHW)" [0,0,0,071)


translations
  "_In c (x!!i) y" => "x!!(pfilter 🍋c i) :== pfilter 🍋c y"
  "_In c x y" => "x!!(pmask 0 🍋c) :== pfilter 🍋c y"
  "_Where m c s" => "_Loc (_locinit c (p_and 🍋c m)) s"
  "_WhereElse m c s1 s2" => "(_Loc (_locinit c (p_and 🍋c m)) s1);;
                             (_Loc (_locinit c (p_and 🍋c (p_not m))) s2)"

print_translation 
 let
 fun in_tr'
 [Const (@{const_syntax list_multsel}, _) $ x $
 (Const (@{const_syntax pfilter}, _) $
 (Const (@{syntax_const "_antiquoteCur"}, _) $ c) $ i),
 Const (@{const_syntax pfilter}, _) $
 (Const (@{syntax_const "_antiquoteCur"}, _) $ c') $ y] =
 if c = c' then
 Syntax.const @{syntax_const "_In"} $ c $
 (Syntax.const @{const_syntax list_multsel} $ x $ i) $ y
 else raise Match
 | in_tr'
 [Const (@{const_syntax list_multsel}, _) $ x $
 (Const (@{const_syntax pmask}, _) $ z $
 (Const (@{syntax_const "_antiquoteCur"}, _) $ c)),
 Const (@{const_syntax pfilter}, _) $ (Const (@{syntax_const "_antiquoteCur"}, _) $ c') $ y] =
 if c = c' then Syntax.const @{syntax_const "_In"} $ c $ x $ y
 else raise Match

 fun where_tr'
 [Const (@{syntax_const "_locinit"}, _) $ Const (c, _) $
 (Const (@{const_syntax p_and}, _) $
 (Const (@{syntax_const "_antiquoteCur"}, _) $ Const (c', _)) $ m), s] =
 if c = c' then
 Syntax.const @{syntax_const "_Where"} $ m $
 Syntax.const c $ s
 else raise Match
 | where_tr' ts = raise Match

 in
 [(@{syntax_const "_Assign"}, K in_tr'),
 (@{syntax_const "_Loc"}, K where_tr')]
 end
 


print_ast_translation 
 let
 fun where_else_tr'
 [Appl [Constant @{syntax_const "_Where"}, m, c, s1],
 Appl [Constant @{syntax_const "_Where"},
 Appl [Constant @{const_syntax p_not}, m'], c', s2]] =
 if c = c' andalso m = m' then Appl [Constant @{syntax_const "_WhereElse"}, m, c, s1, s2]
 else raise Match
 in [(@{syntax_const "_seq"}, K where_else_tr')] end
 



end

Messung V0.5 in Prozent
C=83 H=83 G=82

¤ Dauer der Verarbeitung: 0.12 Sekunden  (vorverarbeitet am  2026-06-10) ¤

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






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge