src/HOL/Lex/MaxChop.thy
author nipkow
Thu, 14 May 1998 16:54:20 +0200
changeset 4931 2ec84dee7911
parent 4714 bcdf68c78e18
child 6481 dbf2d9b3d6c8
permissions -rw-r--r--
Reordred arguments in AutoChopper. Updated README with ref to paper.

(*  Title:      HOL/Lex/MaxChop.thy
    ID:         $Id$
    Author:     Tobias Nipkow
    Copyright   1998 TUM
*)

MaxChop = MaxPrefix +

types   'a chopper = "'a list => 'a list list * 'a list"

constdefs
 is_maxchopper :: ('a list => bool) => 'a chopper => bool
"is_maxchopper P chopper ==
 !xs zs yss.
    (chopper(xs) = (yss,zs)) =
    (xs = concat yss @ zs & (!ys : set yss. ys ~= []) &
     (case yss of
        [] => is_maxpref P [] xs
      | us#uss => is_maxpref P us xs & chopper(concat(uss)@zs) = (uss,zs)))"

constdefs
 reducing :: "'a splitter => bool"
"reducing splitf ==
 !xs ys zs. splitf xs = (ys,zs) & ys ~= [] --> length zs < length xs"

consts
 chopr :: "'a splitter * 'a list => 'a list list * 'a list"
recdef chopr "measure (length o snd)"
"chopr (splitf,xs) = (if reducing splitf
                      then let pp = splitf xs
                           in if fst(pp)=[] then ([],xs)
                           else let qq = chopr (splitf,snd pp)
                                in (fst pp # fst qq,snd qq)
                      else arbitrary)"
constdefs
 chop :: 'a splitter  => 'a chopper
"chop splitf xs == chopr(splitf,xs)"

end