Theory Min_Ed_Dist0
subsection "Minimum Edit Distance"
theory Min_Ed_Dist0
imports
"HOL-Library.IArray"
"HOL-Library.Code_Target_Numeral"
"HOL-Library.Product_Lexorder"
"HOL-Library.RBT_Mapping"
"../state_monad/State_Main"
"../heap_monad/Heap_Main"
Example_Misc
"../util/Tracing"
"../util/Ground_Function"
begin
subsubsection "Misc"
text "Executable argmin"
fun argmin :: "('a ⇒ 'b::order) ⇒ 'a list ⇒ 'a" where
"argmin f [a] = a" |
"argmin f (a#as) = (let m = argmin f as in if f a ≤ f m then a else m)"
fun argmin2 :: "('a ⇒ 'b::order) ⇒ 'a list ⇒ 'a * 'b" where
"argmin2 f [a] = (a, f a)" |
"argmin2 f (a#as) = (let fa = f a; (am,m) = argmin2 f as in if fa ≤ m then (a, fa) else (am,m))"
subsubsection "Edit Distance"