Eine aufbereitete Darstellung der Quelle

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

Benutzer

Quelle  Commands.thy   Sprache: Isabelle

 

(*  Title:      HOL/Examples/Commands.thy
    Author:     Makarius
*)


section ‹Some Isar command definitions›

theory Commands
imports Main
keywords
  "print_test" :: diag and
  "global_test" :: thy_decl and
  "local_test" :: thy_decl
begin

subsection ‹Diagnostic command: no state change›

ML ‹
 Outer_Syntax.command 🚫‹print_test› "print term test"
 (Parse.term >> (fn s => Toplevel.keep (fn st =>
 let
 val ctxt = Toplevel.context_of st;
 val t = Syntax.read_term ctxt s;
 val ctxt' = Proof_Context.augment t ctxt;
 in Pretty.writeln (Syntax.pretty_term ctxt' t) end)));
 
›

print_test x
print_test "λx. x = a"


subsection ‹Old-style global theory declaration›

ML ‹
 Outer_Syntax.command 🚫‹global_test› "test constant declaration"
 (Parse.binding >> (fn b => Toplevel.theory (fn thy =>
 let
 val thy' = Sign.add_consts [(b, typ‹'a›, NoSyn)] thy;
 in thy' end)));
 
›

global_test a
global_test b
print_test a


subsection ‹Local theory specification›

ML ‹
 Outer_Syntax.local_theory 🚫‹local_test› "test local definition"
 (Parse.binding -- (🚫‹=› |-- Parse.term) >> (fn (b, s) => fn lthy =>
 let
 val t = Syntax.read_term lthy s;
 val (def, lthy') = Local_Theory.define ((b, NoSyn), ((Thm.def_binding b, []), t)) lthy;
 in lthy' end));
 
›

local_test true = True
print_test true
thm true_def

local_test identity = "λx. x"
print_test "identity x"
thm identity_def

context fixes x y :: nat
begin

local_test test = "x + y"
print_test test
thm test_def

end

print_test "test 0 1"
thm test_def

end

Messung V0.5 in Prozent
C=57 H=0 G=40

¤ Dauer der Verarbeitung: 0.10 Sekunden  (vorverarbeitet am  2026-09-29) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

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

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Statistik
#Sources=1126438
#Domains=1867298