### Abstract

The Knuth-Morris-Pratt algorithm is often used to show that the problem of finding a string s in a text t can be solved deterministically in O(|s| + |t|) time. We use the Isabelle Refinement Framework to formulate and verify the algorithm. Via refinement, we apply some optimisations and finally use the Sepref tool to obtain executable code in Imperative/HOL.

### License

BSD License

### Topics

- Computer science/Algorithms

### Session Knuth_Morris_Pratt

- KMP

### Depends on

- The Imperative Refinement Framework

### Auto-related entries

- van Emde Boas Trees
- Imperative Insertion Sort
- A Fully Verified Executable LTL Model Checker

## Cite

×

Knuth_Morris_Pratt-AFP

    @article{Knuth_Morris_Pratt-AFP,
      author  = {Fabian Hellauer and Peter Lammich},
      title   = {The string search algorithm by Knuth, Morris and Pratt},
      journal = {Archive of Formal Proofs},
      month   = {December},
      year    = {2017},
      note    = {\url{https://isa-afp.org/entries/Knuth_Morris_Pratt.html},
                 Formal proof development},
      ISSN    = {2150-914x},
    }

Download

## Download

× Download latest

Older releases:

- Sep 13, 2023 : Isabelle2023
- Oct 27, 2022 : Isabelle2022
- Dec 14, 2021 : Isabelle2021-1
- Feb 23, 2021 : Isabelle2021
- Apr 18, 2020 : Isabelle2020
- Jun 11, 2019 : Isabelle2019
- Aug 16, 2018 : Isabelle2018
- Dec 18, 2017 : Isabelle2017