Commit c6f06bc6 authored by Jean-Christophe Filliâtre's avatar Jean-Christophe Filliâtre
Browse files

edit_distance: intermediate lemmas

to be proved with Coq, later
to do that, it would be nice to have recursive definitions translated to Coq
as such when possible
parent 9f201f2b
......@@ -39,6 +39,59 @@ theory Word
predicate min_dist (w1 w2: word) (n: int) =
dist w1 w2 n /\ forall m: int. dist w1 w2 m -> n <= m
(* intermediate lemmas *)
(* TODO: prove the following lemmas in Coq (proofs are in Why2
repository, in examples/edit-distance/words.v)
It would be really helpful to have recursive definitions output
as such in Coq when possible *)
(***
use export list.Append
function last_char (a: char) (u: word) : char = match u with
| Nil -> a
| Cons c u' -> last_char c u'
end
function but_last (a: char) (u: word) : word = match u with
| Nil -> Nil
| Cons c u' -> Cons a (but_last c u')
end
lemma first_last_explicit:
forall u: word, a: char.
but_last a u ++ Cons (last_char a u) Nil = Cons a u
lemma first_last:
forall a: char, u: word. exists v: word, b: char.
v ++ Cons b Nil = Cons a u /\ length v = length u
lemma key_lemma_right:
forall w1 w'2: word, m: int, a: char.
dist w1 w'2 m ->
forall w2: word. w'2 = Cons a w2 ->
exists u1 v1: word, k: int.
w1 = u1 ++ v1 /\ dist v1 w2 k /\ k + length u1 <= m + 1
lemma dist_symetry:
forall w1 w2: word, n: int. dist w1 w2 n -> dist w2 w1 n
lemma key_lemma_left:
forall w1 w2: word, m: int, a: char.
dist (Cons a w1) w2 m ->
exists u2 v2: word, k: int.
w2 = u2 ++ v2 /\ dist w1 v2 k /\ k + length u2 <= m + 1
lemma dist_concat_left:
forall u v w: word, n: int.
dist v w n -> dist (u ++ v) w (length u + n)
lemma dist_concat_right:
forall u v w: word, n: int.
dist v w n -> dist v (u ++ w) (length u + n)
***)
(* end of intermediate lemmas *)
lemma min_dist_equal:
forall w1 w2: word, a: char, n: int.
min_dist w1 w2 n -> min_dist (Cons a w1) (Cons a w2) n
......
......@@ -4,40 +4,31 @@
<file name="../edit_distance.mlw" verified="false" expanded="true">
<theory name="Word" verified="false" expanded="true">
<goal name="min_dist_equal" sum="3d9a456ed12e2816ce8864d5cf0ab831" proved="false" expanded="true">
<proof prover="cvc3" timelimit="30" edited="" obsolete="true"><undone/>
</proof>
<proof prover="alt-ergo" timelimit="30" edited="" obsolete="true">
<result status="timeout" time="27.19"/>
</proof>
</goal>
<goal name="min_dist_diff" sum="4015bdb0b34c4343107f056d5e1ed1f9" proved="false" expanded="true">
<proof prover="alt-ergo" timelimit="30" edited="" obsolete="true">
<result status="timeout" time="44.19"/>
</proof>
</goal>
<goal name="min_dist_eps" sum="0b1723159f9fb8ec3f503bb7e0cb16f4" proved="true" expanded="false">
<proof prover="coq" timelimit="20" edited="edit_distance_Word_min_dist_eps_1.v" obsolete="false">
<result status="valid" time="0.43"/>
<result status="valid" time="0.70"/>
</proof>
</goal>
<goal name="min_dist_eps_length" sum="c2c90d9dc7c409bb88ee27f06189633f" proved="true" expanded="false">
<proof prover="coq" timelimit="20" edited="edit_distance_Word_min_dist_eps_length_1.v" obsolete="false">
<result status="valid" time="0.47"/>
<result status="valid" time="0.75"/>
</proof>
</goal>
</theory>
<theory name="WP EditDistance" verified="true" expanded="false">
<goal name="suffix_length" sum="4d219c5494bb9a132e2bcd56ccd675e4" proved="true" expanded="false">
<proof prover="coq" timelimit="20" edited="edit_distance_WP_EditDistance_suffix_length_1.v" obsolete="false">
<result status="valid" time="0.59"/>
<result status="valid" time="1.00"/>
</proof>
</goal>
<goal name="WP_parameter distance" expl="correctness of parameter distance" sum="8a605e9a5c20c02132987dd701850a28" proved="true" expanded="false">
<transf name="split_goal" proved="true" expanded="false">
<goal name="WP_parameter distance.1" expl="precondition" sum="482ce4a63d91491d0b2069818a38675d" proved="true" expanded="false">
<proof prover="alt-ergo" timelimit="30" edited="" obsolete="false">
<result status="valid" time="0.02"/>
<result status="valid" time="0.03"/>
</proof>
</goal>
<goal name="WP_parameter distance.2" expl="precondition" sum="057f96a39d96bcce1b7f7b65e718f669" proved="true" expanded="false">
......@@ -59,22 +50,22 @@
<transf name="split_goal" proved="true" expanded="false">
<goal name="WP_parameter distance.5.1" expl="for loop preservation" sum="173e25f2fbfb94fd4f27e448346cab7e" proved="true" expanded="false">
<proof prover="alt-ergo" timelimit="20" edited="" obsolete="false">
<result status="valid" time="0.04"/>
<result status="valid" time="0.02"/>
</proof>
</goal>
<goal name="WP_parameter distance.5.2" expl="for loop preservation" sum="a58536bd9183d46f98b7415c7a2a1b29" proved="true" expanded="false">
<proof prover="alt-ergo" timelimit="20" edited="" obsolete="false">
<result status="valid" time="0.03"/>
<result status="valid" time="0.01"/>
</proof>
</goal>
<goal name="WP_parameter distance.5.3" expl="for loop preservation" sum="a7c38461dc9744059ae56f0b75d5a310" proved="true" expanded="false">
<proof prover="alt-ergo" timelimit="20" edited="" obsolete="false">
<result status="valid" time="0.01"/>
<result status="valid" time="0.03"/>
</proof>
</goal>
<goal name="WP_parameter distance.5.4" expl="for loop preservation" sum="f6adcd2670c299f9ef50fdbca89cde90" proved="true" expanded="false">
<proof prover="alt-ergo" timelimit="20" edited="" obsolete="false">
<result status="valid" time="0.02"/>
<result status="valid" time="0.04"/>
</proof>
</goal>
<goal name="WP_parameter distance.5.5" expl="for loop preservation" sum="df16b3564e58b7a2f4bd746b5402f818" proved="true" expanded="false">
......@@ -89,14 +80,14 @@
</goal>
<goal name="WP_parameter distance.5.7" expl="for loop preservation" sum="890c1087e856e6784bea7f7fb6d782b2" proved="true" expanded="false">
<proof prover="alt-ergo" timelimit="20" edited="" obsolete="false">
<result status="valid" time="0.02"/>
<result status="valid" time="0.03"/>
</proof>
</goal>
</transf>
</goal>
<goal name="WP_parameter distance.6" expl="precondition" sum="66f368b6b047a3a0a26224ef1c6c506b" proved="true" expanded="false">
<proof prover="alt-ergo" timelimit="30" edited="" obsolete="false">
<result status="valid" time="0.04"/>
<result status="valid" time="0.02"/>
</proof>
</goal>
<goal name="WP_parameter distance.7" expl="normal postcondition" sum="0ecee843c99e1c903413c7ed8150429d" proved="true" expanded="false">
......@@ -106,7 +97,7 @@
</goal>
<goal name="WP_parameter distance.8" expl="for loop initialization" sum="22677abb3494ce245a35b8ad386715bf" proved="true" expanded="false">
<proof prover="alt-ergo" timelimit="30" edited="" obsolete="false">
<result status="valid" time="0.02"/>
<result status="valid" time="0.03"/>
</proof>
</goal>
<goal name="WP_parameter distance.9" expl="for loop preservation" sum="7c79fe48346041308ffbe873b5aca0c7" proved="true" expanded="false">
......@@ -118,14 +109,14 @@
</goal>
<goal name="WP_parameter distance.9.2" expl="for loop preservation" sum="60596c4c51f7b5944b196b73caa95f2d" proved="true" expanded="false">
<proof prover="alt-ergo" timelimit="20" edited="" obsolete="false">
<result status="valid" time="0.03"/>
<result status="valid" time="0.04"/>
</proof>
</goal>
</transf>
</goal>
<goal name="WP_parameter distance.10" expl="precondition" sum="c32b5bb92aa006791797cac1a9c1a5f4" proved="true" expanded="false">
<proof prover="alt-ergo" timelimit="30" edited="" obsolete="false">
<result status="valid" time="0.04"/>
<result status="valid" time="0.02"/>
</proof>
</goal>
<goal name="WP_parameter distance.11" expl="normal postcondition" sum="3bb84f4ea560aa03da294943cd3ee8ac" proved="true" expanded="false">
......@@ -151,7 +142,7 @@
</goal>
<goal name="WP_parameter distance.13.2" expl="for loop preservation" sum="b44bdcf4f1c706accce3c64a4390087f" proved="true" expanded="false">
<proof prover="alt-ergo" timelimit="20" edited="" obsolete="false">
<result status="valid" time="0.04"/>
<result status="valid" time="0.03"/>
</proof>
</goal>
<goal name="WP_parameter distance.13.3" expl="for loop preservation" sum="02aefcc18f2bc6ed080dd9db43f48d06" proved="true" expanded="false">
......@@ -161,19 +152,19 @@
</goal>
<goal name="WP_parameter distance.13.4" expl="for loop preservation" sum="4925e9033ca9cbd374c42be6f9374902" proved="true" expanded="false">
<proof prover="z3" timelimit="20" edited="" obsolete="false">
<result status="valid" time="0.04"/>
<result status="valid" time="0.05"/>
</proof>
</goal>
<goal name="WP_parameter distance.13.5" expl="for loop preservation" sum="6bdbe13e9dd586420f3199ab5d880fa2" proved="true" expanded="false">
<proof prover="alt-ergo" timelimit="20" edited="" obsolete="false">
<result status="valid" time="5.81"/>
<result status="valid" time="5.74"/>
</proof>
</goal>
<goal name="WP_parameter distance.13.6" expl="for loop preservation" sum="3942c2e4de6f646ae6841c4d57654c23" proved="true" expanded="false">
<transf name="split_goal" proved="true" expanded="false">
<goal name="WP_parameter distance.13.6.1" expl="for loop preservation" sum="f05ee215abf0219e2703812c14165121" proved="true" expanded="false">
<proof prover="alt-ergo" timelimit="20" edited="" obsolete="false">
<result status="valid" time="0.03"/>
<result status="valid" time="0.04"/>
</proof>
</goal>
<goal name="WP_parameter distance.13.6.2" expl="for loop preservation" sum="8e8b91bc77444d3a61565c4c5ed196da" proved="true" expanded="false">
......@@ -183,7 +174,7 @@
</goal>
<goal name="WP_parameter distance.13.6.3" expl="for loop preservation" sum="68f01bfc90ab9dab8e39e5cc194d73ba" proved="true" expanded="false">
<proof prover="alt-ergo" timelimit="20" edited="" obsolete="false">
<result status="valid" time="0.02"/>
<result status="valid" time="0.03"/>
</proof>
</goal>
<goal name="WP_parameter distance.13.6.4" expl="for loop preservation" sum="e70c8ff8846d98fbc7438a3d26994dc8" proved="true" expanded="false">
......@@ -193,12 +184,12 @@
</goal>
<goal name="WP_parameter distance.13.6.5" expl="for loop preservation" sum="31bc2c9553d93894df1c33a2b8c54ae6" proved="true" expanded="false">
<proof prover="coq" timelimit="20" edited="edit_distance_WP_EditDistance_WP_parameter_distance_1.v" obsolete="false">
<result status="valid" time="0.62"/>
<result status="valid" time="1.00"/>
</proof>
</goal>
<goal name="WP_parameter distance.13.6.6" expl="for loop preservation" sum="5fd710c81355838704937a9350ddd2a3" proved="true" expanded="false">
<proof prover="alt-ergo" timelimit="20" edited="" obsolete="false">
<result status="valid" time="0.04"/>
<result status="valid" time="0.06"/>
</proof>
</goal>
<goal name="WP_parameter distance.13.6.7" expl="for loop preservation" sum="746b7e0c280424bbae1b73ad4d9a2b65" proved="true" expanded="false">
......@@ -208,7 +199,7 @@
</goal>
<goal name="WP_parameter distance.13.6.8" expl="for loop preservation" sum="950da5869d435191a418c461607c327e" proved="true" expanded="false">
<proof prover="alt-ergo" timelimit="20" edited="" obsolete="false">
<result status="valid" time="0.03"/>
<result status="valid" time="0.04"/>
</proof>
</goal>
<goal name="WP_parameter distance.13.6.9" expl="for loop preservation" sum="0d8e8ef8aa43aa53ea831ef7327165c3" proved="true" expanded="false">
......@@ -218,12 +209,12 @@
</goal>
<goal name="WP_parameter distance.13.6.10" expl="for loop preservation" sum="6ca44d456711451c05ce36cf06ebabac" proved="true" expanded="false">
<proof prover="alt-ergo" timelimit="20" edited="" obsolete="false">
<result status="valid" time="0.02"/>
<result status="valid" time="0.03"/>
</proof>
</goal>
<goal name="WP_parameter distance.13.6.11" expl="for loop preservation" sum="ccec34f13c891c12bbab90bbd8f07bcc" proved="true" expanded="false">
<proof prover="coq" timelimit="20" edited="edit_distance_WP_EditDistance_WP_parameter_distance_2.v" obsolete="false">
<result status="valid" time="0.71"/>
<result status="valid" time="1.16"/>
</proof>
</goal>
<goal name="WP_parameter distance.13.6.12" expl="for loop preservation" sum="3ed2c027f8d658fcf3e07a22184101e1" proved="true" expanded="false">
......@@ -233,14 +224,14 @@
</goal>
<goal name="WP_parameter distance.13.6.13" expl="for loop preservation" sum="c13f7295bd436f956b2412339c52d207" proved="true" expanded="false">
<proof prover="alt-ergo" timelimit="20" edited="" obsolete="false">
<result status="valid" time="0.03"/>
<result status="valid" time="0.04"/>
</proof>
</goal>
</transf>
</goal>
<goal name="WP_parameter distance.13.7" expl="for loop preservation" sum="6e74242d528e537ca658725785512266" proved="true" expanded="false">
<proof prover="cvc3" timelimit="20" edited="" obsolete="false">
<result status="valid" time="0.05"/>
<result status="valid" time="0.06"/>
</proof>
<proof prover="alt-ergo" timelimit="20" edited="" obsolete="false">
<result status="valid" time="0.03"/>
......@@ -250,12 +241,12 @@
</goal>
<goal name="WP_parameter distance.14" expl="precondition" sum="463c47d3f59963fef73eb5bcd28e40aa" proved="true" expanded="false">
<proof prover="alt-ergo" timelimit="30" edited="" obsolete="false">
<result status="valid" time="0.03"/>
<result status="valid" time="0.04"/>
</proof>
</goal>
<goal name="WP_parameter distance.15" expl="normal postcondition" sum="82371112879afafab69b2118ca585ea9" proved="true" expanded="false">
<proof prover="alt-ergo" timelimit="30" edited="" obsolete="false">
<result status="valid" time="0.04"/>
<result status="valid" time="0.03"/>
</proof>
</goal>
</transf>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment