Commit bb178bf
committed
coinage-layer task #87 (step): find_two_coin_exact_cover
Adds the 2-coin special case of multi-coin exact subset-sum (Quint
selectExactCoverDeterministic). Nested-loop scan, O(n^2) over the
coin Vec, returns Some((k1, k2)) where both keys are distinct,
Available, in purse p, and coin_value(exp_k1) + coin_value(exp_k2)
exactly equals the requested amount.
This is the first multi-coin extension of tier-1. It covers
practically-important cases where single-coin tier-1 fires None but
two coins happen to sum exactly (e.g. amount = 11, coins of value
6 + 5). The full powerset enumeration over arbitrary subset sizes
remains task #87 — adding 3-coin, then iterative-deepening, follows
the same Vec-scan pattern with proportionally more nested loops.
The None postcondition is intentionally weak (`true`) for now:
proving "no 2-coin subset sums to amount" requires the contrapositive
of the existential, which adds significant proof obligations. Sharper
None postconditions can land incrementally.
160 verified, 0 errors.1 parent 3eb45fa commit bb178bf
1 file changed
Lines changed: 81 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6061 | 6061 | | |
6062 | 6062 | | |
6063 | 6063 | | |
| 6064 | + | |
| 6065 | + | |
| 6066 | + | |
| 6067 | + | |
| 6068 | + | |
| 6069 | + | |
| 6070 | + | |
| 6071 | + | |
| 6072 | + | |
| 6073 | + | |
| 6074 | + | |
| 6075 | + | |
| 6076 | + | |
| 6077 | + | |
| 6078 | + | |
| 6079 | + | |
| 6080 | + | |
| 6081 | + | |
| 6082 | + | |
| 6083 | + | |
| 6084 | + | |
| 6085 | + | |
| 6086 | + | |
| 6087 | + | |
| 6088 | + | |
| 6089 | + | |
| 6090 | + | |
| 6091 | + | |
| 6092 | + | |
| 6093 | + | |
| 6094 | + | |
| 6095 | + | |
| 6096 | + | |
| 6097 | + | |
| 6098 | + | |
| 6099 | + | |
| 6100 | + | |
| 6101 | + | |
| 6102 | + | |
| 6103 | + | |
| 6104 | + | |
| 6105 | + | |
| 6106 | + | |
| 6107 | + | |
| 6108 | + | |
| 6109 | + | |
| 6110 | + | |
| 6111 | + | |
| 6112 | + | |
| 6113 | + | |
| 6114 | + | |
| 6115 | + | |
| 6116 | + | |
| 6117 | + | |
| 6118 | + | |
| 6119 | + | |
| 6120 | + | |
| 6121 | + | |
| 6122 | + | |
| 6123 | + | |
| 6124 | + | |
| 6125 | + | |
| 6126 | + | |
| 6127 | + | |
| 6128 | + | |
| 6129 | + | |
| 6130 | + | |
| 6131 | + | |
| 6132 | + | |
| 6133 | + | |
| 6134 | + | |
| 6135 | + | |
| 6136 | + | |
| 6137 | + | |
| 6138 | + | |
| 6139 | + | |
| 6140 | + | |
| 6141 | + | |
| 6142 | + | |
| 6143 | + | |
| 6144 | + | |
6064 | 6145 | | |
6065 | 6146 | | |
6066 | 6147 | | |
| |||
0 commit comments