0
|
1 |
structure Prolog =
|
|
2 |
struct
|
|
3 |
|
|
4 |
local
|
|
5 |
val parse_ast_translation = []
|
|
6 |
val parse_preproc = None
|
|
7 |
val parse_postproc = None
|
|
8 |
val parse_translation = []
|
|
9 |
val print_translation = []
|
|
10 |
val print_preproc = None
|
|
11 |
val print_postproc = None
|
|
12 |
val print_ast_translation = []
|
|
13 |
in
|
|
14 |
|
|
15 |
(**** begin of user section ****)
|
|
16 |
|
|
17 |
(**** end of user section ****)
|
|
18 |
|
|
19 |
val thy = extend_theory (FOL.thy)
|
|
20 |
"Prolog"
|
|
21 |
([],
|
|
22 |
[],
|
|
23 |
[(["list"], 1)],
|
|
24 |
[(["list"], ([["term"]], "term"))],
|
|
25 |
[(["Nil"], "'a list"),
|
|
26 |
(["app"], "['a list, 'a list, 'a list] => o"),
|
|
27 |
(["rev"], "['a list, 'a list] => o")],
|
|
28 |
Some (NewSext {
|
|
29 |
mixfix =
|
|
30 |
[Infixr(":", "['a, 'a list]=> 'a list", 60)],
|
|
31 |
xrules =
|
|
32 |
[],
|
|
33 |
parse_ast_translation = parse_ast_translation,
|
|
34 |
parse_preproc = parse_preproc,
|
|
35 |
parse_postproc = parse_postproc,
|
|
36 |
parse_translation = parse_translation,
|
|
37 |
print_translation = print_translation,
|
|
38 |
print_preproc = print_preproc,
|
|
39 |
print_postproc = print_postproc,
|
|
40 |
print_ast_translation = print_ast_translation}))
|
|
41 |
[("appNil", "app(Nil,ys,ys)"),
|
|
42 |
("appCons", "app(xs,ys,zs) ==> app(x:xs, ys, x:zs)"),
|
|
43 |
("revNil", "rev(Nil,Nil)"),
|
|
44 |
("revCons", "[| rev(xs,ys); app(ys, x:Nil, zs) |] ==> rev(x:xs, zs)")]
|
|
45 |
|
|
46 |
val ax = get_axiom thy
|
|
47 |
|
|
48 |
val appNil = ax "appNil"
|
|
49 |
val appCons = ax "appCons"
|
|
50 |
val revNil = ax "revNil"
|
|
51 |
val revCons = ax "revCons"
|
|
52 |
|
|
53 |
|
|
54 |
end
|
|
55 |
end
|