src/HOL/Lex/Chopper.thy
author nipkow
Thu, 04 Mar 2004 10:04:42 +0100
changeset 14428 bb2b0e10d9be
parent 10338 291ce4c4b50e
permissions -rw-r--r--
Conversion of ML files to Isar.

(*  Title:      HOL/Lex/Chopper.thy
    ID:         $Id$
    Author:     Tobias Nipkow
    Copyright   1995 TUM

A 'chopper' is a function which returns
  1. a chopped up prefix of the input string
  2. together with the remaining suffix.

It is a longest_prefix_chopper if it
  1. chops up as much of the input as possible and
  2. chops it up into the longest substrings possible.

A chopper is parametrized by a language ('a list => bool),
i.e. a set of strings.
*)

theory Chopper = List_Prefix:

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

constdefs
  is_longest_prefix_chopper :: "('a list => bool) => 'a chopper => bool"
 "is_longest_prefix_chopper L chopper == !xs.
       (!zs. chopper(xs) = ([],zs) -->
             zs=xs & (!ys. ys ~= [] & ys <= xs --> ~L(ys))) &
       (!ys yss zs. chopper(xs) = (ys#yss,zs) -->
          ys ~= [] & L(ys) & xs=ys@concat(yss)@zs &
          chopper(concat(yss)@zs) = (yss,zs) &
          (!as. as <= xs & ys <= as & ys ~= as --> ~L(as)))"

end