Files
pplus-library/modules/align/affine-gap/proof/affine_gap.dfy
T
alexm 568474d52f
Test (in pplus-core) / in-core (push) Failing after 28m44s
Initial commit
2026-11-12 22:23:48 -05:00

30 lines
846 B
Plaintext

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
{
}