56276
|
1 |
(* Title: Tools/SML/Examples.thy
|
|
2 |
Author: Makarius
|
|
3 |
*)
|
|
4 |
|
|
5 |
header {* Standard ML within the Isabelle environment *}
|
|
6 |
|
|
7 |
theory Examples
|
|
8 |
imports Pure
|
|
9 |
begin
|
|
10 |
|
|
11 |
text {*
|
|
12 |
Isabelle/ML is a somewhat augmented version of Standard ML, with
|
|
13 |
various add-ons that are indispensable for Isabelle development, but
|
|
14 |
may cause conflicts with independent projects in plain Standard ML.
|
|
15 |
|
|
16 |
The Isabelle/Isar command 'SML_file' supports official Standard ML
|
|
17 |
within the Isabelle environment, with full support in the Prover IDE
|
|
18 |
(Isabelle/jEdit).
|
|
19 |
|
|
20 |
Here is a very basic example that defines the factorial function and
|
|
21 |
evaluates it for some arguments.
|
|
22 |
*}
|
|
23 |
|
|
24 |
SML_file "factorial.sml"
|
|
25 |
|
|
26 |
|
|
27 |
text {*
|
|
28 |
The subsequent example illustrates the use of multiple 'SML_file'
|
|
29 |
commands to build larger Standard ML projects. The toplevel SML
|
|
30 |
environment is enriched cumulatively within the theory context of
|
|
31 |
Isabelle --- independently of the Isabelle/ML environment.
|
|
32 |
*}
|
|
33 |
|
|
34 |
SML_file "Example.sig"
|
|
35 |
SML_file "Example.sml"
|
|
36 |
|
|
37 |
end
|