signature TERM_XML_OPS = sig type'a T type'a P val indexname: indexname P val sort: sort T val typ: typ T val term_raw: term T val term: Consts.T -> term T end
fun indexname (a, b) = if b = 0 then [a] else [a, int_atom b];
val sort = liststring;
fun typ T = T |> variant
[fn Type (a, b) => ([a], list typ b),
fn TFree (a, b) => ([a], sort b),
fn TVar (a, b) => (indexname a, sort b)];
fun term_raw t = t |> variant
[fn Const (a, b) => ([a], typ b),
fn Free (a, b) => ([a], typ b),
fn Var (a, b) => (indexname a, typ b),
fn Bound a => ([], int a),
fn Abs (a, b, c) => ([a], pair typ term_raw (b, c)),
fn op $ a => ([], pair term_raw term_raw a)];
fun var_type T = if T = dummyT then [] else typ T;
fun term consts t = t |> variant
[fn Const (a, b) => ([a], list typ (Consts.typargs consts (a, b))),
fn Free (a, b) => ([a], var_type b),
fn Var (a, b) => (indexname a, var_type b),
fn Bound a => ([], int a),
fn Abs (a, b, c) => ([a], pair typ (term consts) (b, c)),
fn t as op $ a => if can Logic.match_of_class t thenraiseMatch else ([], pair (term consts) (term consts) a),
fn t => letval (T, c) = Logic.match_of_class t in ([c], typ T) end];
fun typ body = body |> variant
[fn ([a], b) => Type (a, list typ b),
fn ([a], b) => TFree (a, sort b),
fn (a, b) => TVar (indexname a, sort b)];
fun term_raw body = body |> variant
[fn ([a], b) => Const (a, typ b),
fn ([a], b) => Free (a, typ b),
fn (a, b) => Var (indexname a, typ b),
fn ([], a) => Bound (int a),
fn ([a], b) => letval (c, d) = pair typ term_raw b in Abs (a, c, d) end,
fn ([], a) => op $ (pair term_raw term_raw a)];
fun var_type [] = dummyT
| var_type body = typ body;
fun term consts body = body |> variant
[fn ([a], b) => Const (a, Consts.instance consts (a, list typ b)),
fn ([a], b) => Free (a, var_type b),
fn (a, b) => Var (indexname a, var_type b),
fn ([], a) => Bound (int a),
fn ([a], b) => letval (c, d) = pair typ (term consts) b in Abs (a, c, d) end,
fn ([], a) => op $ (pair (term consts) (term consts) a),
fn ([a], b) => Logic.mk_of_class (typ b, a)];
end;
end;
¤ Dauer der Verarbeitung: 0.13 Sekunden
(vorverarbeitet)
¤
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 ist noch experimentell.