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

Benutzer

Quelle  Com.thy

  Sprache: Isabelle
 

chapter Instantiating the Framework with a simple While-Language using procedures

section Commands

theory Com imports "../StaticInter/BasicDefs" begin

subsection Variables and Values

type_synonym vname = string ― names for variables
type_synonym pname = string ― names for procedures

datatype val
  = Bool bool      ― Boolean value
  | Intg int       ― integer value

abbreviation "true == Bool True"
abbreviation "false == Bool False"


subsection Expressions

datatype bop = Eq | And | Less | Add | Sub     ― names of binary operations

datatype expr
  = Val val                                          ― value
  | Var vname                                        ― local variable
  | BinOp expr bop expr    (_ «_¬ _ [80,0,8180)  ― binary operation


fun binop :: "bop ==> val ==> val ==> val option"
where "binop Eq v1 v2 = Some(Bool(v1 = v2))"
  | "binop And (Bool b1) (Bool b2) = Some(Bool(b1 b2))"
  | "binop Less (Intg i1) (Intg i2) = Some(Bool(i1 < i2))"
  | "binop Add (Intg i1) (Intg i2) = Some(Intg(i1 + i2))"
  | "binop Sub (Intg i1) (Intg i2) = Some(Intg(i1 - i2))"
  | "binop bop v1 v2 = None"


subsection Commands

datatype cmd
  = Skip
  | LAss vname expr        (_:=_ [70,7070)  ― local assignment
  | Seq cmd cmd            (_;;/ _ [60,6160)
  | Cond expr cmd cmd      (if '(_') _/ else _ [80,79,7970)
  | While expr cmd         (while '(_') _ [80,7970)
  | Call pname "expr list" "vname list" 
    ― Call needs procedure, actual parameters and variables for return values



fun num_inner_nodes :: "cmd ==> nat" (#:_)
where "#:Skip = 1"
  | "#:(V:=e) = 2"       (* additional Skip node *)
  | "#:(c1;;c2) = #:c1 + #:c2"
  | "#:(if (b) c1 else c2) = #:c1 + #:c2 + 1"
  | "#:(while (b) c) = #:c + 2" (* additional Skip node *)
  | "#:(Call p es rets) = 2"       (* additional Skip (=Return) node *)


lemma num_inner_nodes_gr_0 [simp]:"#:c > 0"
by(induct c) auto

lemma [dest]:"#:c = 0 ==> False"
by(induct c) auto


end

Messung V0.5 in Prozent
C=89 H=100 G=94

¤ Dauer der Verarbeitung: 0.9 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