〜 形式検証によるソフトウェア品質保証の再考 〜
田中博悠 / tanahiro2010
一応U18 Dev の Founder


Under18 Developers
ようやく本題

> → >=(境界をずらす)+ → -(演算を入れ替える)&& → ||(条件を入れ替える)total > 1000export function discountAmount(total: number): number {
return total > 1000 ? 100 : 0
}$ npx veritas run --profile standard --offline
mutate counts: {"killed":7,"survived":1}
findings (2):
[confirmed medium] no test detects
total > 1000 -> total >= 1000$ npx veritas prove --engine z3
P-9c3a5e450416: counterexample_found
{"total":"1000"}total >= 1000total = 1000>= に直す → Lean もZ3も証明が通る>= に直したら → 証明が通ったfunction myAbs(x: number): number {
if (x === -1) return -1 // バグ
return x < 0 ? -x : x
}
// 0, 1, 5, 100 だけテスト → 全部通る$ node abs.ts
non-negative tests: passed
myAbs(-1) = -1 (expected 1)def goodAbs (x : Int) : Int :=
if x < 0 then -x else x
theorem goodAbs_eq (x : Int) :
goodAbs x = x.natAbs := by
unfold goodAbs; split <;> omegasorryAx が出るdef transferI (a b n : Int) : Option (Int × Int) :=
if 0 < n ∧ n ≤ a then some (a - n, b + n) else none
theorem transferI_nonneg (a b n a' b' : Int)
(ha : 0 ≤ a) (hb : 0 ≤ b)
(h : transferI a b n = some (a', b')) :
0 ≤ a' ∧ 0 ≤ b' := by
unfold transferI at h
split at h <;> simp_all <;> omega→ 別にモデルを作って性質を書き直す
Dougherty et al., arXiv 2509.22908(2025)

npx veritas run研究は続く。
