This commit is contained in:
commit
568474d52f
1591 files changed
+528213
No files matched your search
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"tool": "dafny",
|
||||
"version": "4.11.0",
|
||||
"flags": [
|
||||
"verify",
|
||||
"--resource-limit",
|
||||
"20000000"
|
||||
],
|
||||
"source_sha256": "5a0a04933596877e8f881204d2508c4fd6f4fc5a37aa4d0a0dce95ac4da45730",
|
||||
"verdict": "verified",
|
||||
"summary": "3 verified, 0 errors"
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"tool": "godbolt",
|
||||
"compiler": "mojo_1_2_0",
|
||||
"mojoVersion": "1.2.0",
|
||||
"source_sha256": "9310c57a1b1128544f150ac943ea5d5efd387150ba0e55de119d84398627df70",
|
||||
"stdin": "3 1 -10 -1 5 -10 -1 3 -2 -2 end\n",
|
||||
"args": "--target-cpu x86-64-v3 --fp-mode contract=off",
|
||||
"asked": "2026-11-12",
|
||||
"result": {
|
||||
"compiled": true,
|
||||
"buildStderr": "",
|
||||
"executed": true,
|
||||
"exitCode": 0,
|
||||
"stdout": "-10\n-14\n-6",
|
||||
"stderr": "",
|
||||
"timedOut": false,
|
||||
"asm": null
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
method AffineGapPenalty(length: int, open: int, extend: int) returns (result: int)
|
||||
requires length >= 1
|
||||
ensures result == open + (length - 1) * extend
|
||||
{
|
||||
result := open + (length - 1) * extend;
|
||||
}
|
||||
|
||||
// Position by position: the first position opens the gap, every later one extends it.
|
||||
method AffineByPositions(length: int, open: int, extend: int) returns (score: int)
|
||||
requires length >= 1
|
||||
ensures score == open + (length - 1) * extend
|
||||
{
|
||||
score := open;
|
||||
var i := 1;
|
||||
while i < length
|
||||
invariant 1 <= i <= length
|
||||
invariant score == open + (i - 1) * extend
|
||||
{
|
||||
score := score + extend;
|
||||
i := i + 1;
|
||||
}
|
||||
}
|
||||
|
||||
// With the same score for opening and extending, the affine model is the linear one.
|
||||
lemma AffineIsLinearWhenEqual(length: int, gap: int)
|
||||
requires length >= 1
|
||||
ensures gap + (length - 1) * gap == length * gap
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
def affine_gap_penalty(length: Int, open_: Int, extend: Int) -> Int:
|
||||
return open_ + (length - 1) * extend
|
||||
@@ -0,0 +1,2 @@
|
||||
def affine_gap_penalty(length, open_, extend):
|
||||
return open_ + (length - 1) * extend
|
||||
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"name": "AffineGapPenalty",
|
||||
"summary": "The score of a gap of Length positions when opening a gap scores Open and each further position scores Extend.",
|
||||
"tags": [
|
||||
"alignment",
|
||||
"gap model"
|
||||
],
|
||||
"sources": [
|
||||
{
|
||||
"title": "Gotoh, An improved algorithm for matching biological sequences, J. Mol. Biol. 162 (1982)",
|
||||
"url": "https://doi.org/10.1016/0022-2836(82)90398-9"
|
||||
}
|
||||
],
|
||||
"cases": [
|
||||
{
|
||||
"call": "AffineGapPenalty(1, -10, -1)"
|
||||
},
|
||||
{
|
||||
"call": "AffineGapPenalty(5, -10, -1)"
|
||||
},
|
||||
{
|
||||
"call": "AffineGapPenalty(3, -2, -2)"
|
||||
}
|
||||
],
|
||||
"references": [
|
||||
{
|
||||
"lang": "python",
|
||||
"level": "plain",
|
||||
"file": "ref/python/plain.py",
|
||||
"note": "The same formula."
|
||||
},
|
||||
{
|
||||
"lang": "mojo",
|
||||
"level": "plain",
|
||||
"file": "ref/mojo/plain.mojo",
|
||||
"note": "The same formula in Mojo."
|
||||
}
|
||||
],
|
||||
"proof": {
|
||||
"lang": "dafny",
|
||||
"file": "proof/affine_gap.dfy",
|
||||
"note": "The formula equals the score built position by position, and with Open == Extend it equals the linear model."
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// AffineGapPenalty: the score of a gap of Length positions under an affine
|
||||
// gap model (Gotoh, 1982): Open for the first position and Extend for each
|
||||
// one after it. When Open is more negative than Extend, one long gap scores
|
||||
// better than several short gaps of the same total length. With
|
||||
// Open == Extend it is the linear model.
|
||||
FUNCTION AffineGapPenalty(Length : INTEGER, Open : INTEGER, Extend : INTEGER) RETURNS INTEGER
|
||||
REQUIRE Length >= 1
|
||||
ENSURE RESULT == Open + (Length - 1) * Extend
|
||||
RETURN Open + (Length - 1) * Extend
|
||||
ENDFUNCTION
|
||||
Reference in new issue
Block a user