Theory SAIS
theory SAIS
imports Induce Get_Types
begin
section "SAIS"
function sais_r0 ::
"nat list ⇒
nat list"
where
"sais_r0 [] = []" |
"sais_r0 [x] = [0]" |
"sais_r0 (a # b # xs) =
(let
T = a # b # xs;
ST = abs_get_suffix_types T;
LMS0 = extract_lms ST [0..<length T];
SA = sa_induce id T ST LMS0;
LMS1 = extract_lms ST SA;
names = rename_mapping T ST LMS1;
T' = rename_string LMS0 names;
LMS2 = (if distinct T' then LMS1 else order_lms LMS0 (sais_r0 T'))
in sa_induce id T ST LMS2)"
by pat_completeness blast+
function sais_r1 ::
"nat list ⇒
nat list"
where
"sais_r1 [] = []" |
"sais_r1 [x] = [0]" |
"sais_r1 (a # b # xs) =
(let
T = a # b # xs;
ST = get_suffix_types T;
LMS0 = extract_lms ST [0..<length T];
SA = sa_induce id T ST LMS0;
LMS1 = extract_lms ST SA;
names = rename_mapping T ST LMS1;
T' = rename_string LMS0 names;
LMS2 = (if distinct T' then LMS1 else order_lms LMS0 (sais_r1 T'))
in sa_induce id T ST LMS2)"
by pat_completeness blast+
abbreviation "sais ≡ sais_r1"
end