-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
105 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,3 @@ configure | |
*.gz | ||
*.xz | ||
*.zst | ||
coq |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.Makefile.coq.d | ||
Makefile.cq | ||
Makefile.coq.conf | ||
doc | ||
Makefile.coq |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Taken from <https://github.com/coq-community/manifesto/wiki/Recommended-Project-Structure> | ||
all: Makefile.coq | ||
@+$(MAKE) -f Makefile.coq all | ||
|
||
clean: Makefile.coq | ||
@+$(MAKE) -f Makefile.coq cleanall | ||
@rm -f Makefile.coq Makefile.coq.conf | ||
@rm -rf doc | ||
|
||
Makefile.coq: _CoqProject | ||
$(COQBIN)coq_makefile -f _CoqProject -o Makefile.coq | ||
|
||
force _CoqProject Makefile: ; | ||
|
||
DOCDIR := doc | ||
|
||
doc: | ||
@test -d doc || mkdir doc | ||
coqdoc --html --utf8 -d doc/ theories/wf.v | ||
|
||
%: Makefile.coq force | ||
@+$(MAKE) -f Makefile.coq $@ | ||
|
||
.PHONY: all clean force doc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#+TITLE: README | ||
#+DESCRIPTION: A Coq development of Damerau-Levenshtein edit distance | ||
#+DATE: <2024-09-03 Tue 13:52> | ||
#+AUTODATE: t | ||
#+AUTHOR: Michael Herstine | ||
#+EMAIL: [email protected] | ||
#+OPTIONS: toc:nil org-md-headline-style:setext *:t ^:nil ^:{} | ||
|
||
* Introduction | ||
|
||
This directory contains a [[https://coq.inria.fr/][Coq]] development of Damerau-Levenshtein edit distance. It's my first Coq development, so please don't judge it too harshly. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
-Q theories DamerauLevenshtein | ||
|
||
theories/wf.v |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.lia.cache | ||
*.aux | ||
*.glob | ||
*.vo | ||
*.vok | ||
*.vos | ||
.old-files | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
(* Copyright (C) 2024 Michael Herstine *) | ||
|
||
Require Import Coq.Arith.PeanoNat. | ||
Require Import Lia. | ||
|
||
(** * Introduction *) | ||
|
||
(** This is my attempted formalization of "The String-to-String | ||
Correction Problem" by Wagner & Fischer: | ||
Wagner, Robert A., and Michael J. Fischer. 1974. "The | ||
String-to-String Correction Problem." Journal of the Acm 21 (1): | ||
168-73. https://doi.org/10.1145/321796.321811. | ||
I started with Wagner & Lowrance, but found it to be difficult to | ||
formalize. Perhaps related is the fact that Ukkonen, the next step | ||
in the evolution of these algorithms, bases his work on Wagner & | ||
Fischer. | ||
This is my first non-trivial Coq development, so it's going to be | ||
quite chatty as I figure things out. *) | ||
|
||
(** * Preliminaries *) | ||
|
||
(** Throughout, let [a] & [b] be strings. While Wagner & Fischer use | ||
capital letters for their strings, that conflicts with Coq naming | ||
conventions, so I'm going to switch to lower-case. I first thought | ||
to use the stdlib [string] to represent them, but found that List | ||
is much more featureful, so instead I'll just use a List of Ascii. | ||
*) | ||
|
||
Require Import Ascii. | ||
|
||
Open Scope char_scope. | ||
Definition c := "c". | ||
Definition a := "097". | ||
Print a. (** :=> "a" : ascii-- 'a' is ASCII code 97 *) | ||
|
||
Close Scope char_scope. | ||
Reset c. | ||
|
||
(** I've played a bit with [Vector.t], but like others found it a bit | ||
tedious to work with. John Wiegley has some interesting | ||
alternatives here | ||
<https://stackoverflow.com/questions/42302300/which-vector-library-to-use-in-coq>, | ||
but for now let's just use lists: *) | ||
|
||
Require Import List. | ||
Import ListNotations. | ||
|
||
Definition string := list ascii. | ||
|
||
Compute ["H";"e";"l";"l";"o"]. |