Skip to content

Commit 1c30ff2

Browse files
mfornetclaude
andauthored
programs: fix Float specs referencing removed wp_call_of_terminates (#146)
`main` fails `Build & verify proofs`: the Float{Trunc,Round,Reinterpret} specs call `wp_call_of_terminates`, which no longer exists. PR #113 dropped that alias in favour of the byte-identical `wp_call_tw` and repointed its call sites, but the Float Programs PR (#132) branched beforehand and reintroduced the dead name, so the two merged into a red main. `wp_call_of_terminates` was defined as `wp_call_tw hRun hPost` with an identical signature, so this is a pure rename of all 22 call sites (2 + 6 + 14). Verified locally: all three `Project.Float*.Spec` targets build. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 1c41a12 commit 1c30ff2

3 files changed

Lines changed: 22 additions & 22 deletions

File tree

programs/lean/Project/FloatReinterpret/Spec.lean

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ private theorem func0_term (env : HostEnv Unit) (st : Store Unit) (sp x : UInt32
9696
st'.globals.globals[0]? = some (.i32 sp) ∧ st'.mem.pages = 16) := by
9797
apply TerminatesWith.of_wp_entry_for (f := ⟨[.f32], [], func0, [.f32], none⟩) rfl
9898
unfold func0; wp_run
99-
apply wp_call_of_terminates (func1_term env st sp x [] hg hp h16 hb)
99+
apply wp_call_tw (func1_term env st sp x [] hg hp h16 hb)
100100
rintro st1 vs1 ⟨v1, rfl, hg1, hp1⟩
101101
wp_run
102102
exact ⟨v1, rfl, hg1, hp1⟩
@@ -112,7 +112,7 @@ private theorem func2_term (env : HostEnv Unit) (st : Store Unit) (sp x : UInt32
112112
st'.globals.globals[0]? = some (.i32 sp) ∧ st'.mem.pages = 16) := by
113113
apply TerminatesWith.of_wp_entry_for (f := ⟨[.f32], [], func2, [.f32], none⟩) rfl
114114
unfold func2; wp_run
115-
apply wp_call_of_terminates (func3_term env st sp (f64PromoteF32 x) [] hg hp h16 hb)
115+
apply wp_call_tw (func3_term env st sp (f64PromoteF32 x) [] hg hp h16 hb)
116116
rintro st3 vs3 ⟨v3, rfl, hg3, hp3⟩
117117
wp_run
118118
exact ⟨f32DemoteF64 v3, rfl, hg3, hp3⟩
@@ -144,7 +144,7 @@ private theorem func7_term (env : HostEnv Unit) (st : Store Unit) (sp x y : UInt
144144
st'.globals.globals[0]? = some (.i32 sp) ∧ st'.mem.pages = 16) := by
145145
apply TerminatesWith.of_wp_entry_for (f := ⟨[.f32, .f32], [], func7, [.f32], none⟩) rfl
146146
unfold func7; wp_run
147-
apply wp_call_of_terminates (func8_term env st sp x y [] hg hp h16 hb)
147+
apply wp_call_tw (func8_term env st sp x y [] hg hp h16 hb)
148148
rintro st8 vs8 ⟨v8, rfl, hg8, hp8⟩
149149
wp_run
150150
exact ⟨v8, rfl, hg8, hp8⟩
@@ -160,10 +160,10 @@ private theorem func9_term (env : HostEnv Unit) (st : Store Unit) (sp x : UInt32
160160
st'.globals.globals[0]? = some (.i32 sp) ∧ st'.mem.pages = 16) := by
161161
apply TerminatesWith.of_wp_entry_for (f := ⟨[.f32], [], func9, [.f32], none⟩) rfl
162162
unfold func9; wp_run
163-
apply wp_call_of_terminates (func5_term env st sp x [] hg hp)
163+
apply wp_call_tw (func5_term env st sp x [] hg hp)
164164
rintro st5 vs5 ⟨v5, rfl, hg5, hp5⟩
165165
wp_run
166-
apply wp_call_of_terminates (func6_term env st5 sp (2147483647 &&& v5) [] hg5 hp5)
166+
apply wp_call_tw (func6_term env st5 sp (2147483647 &&& v5) [] hg5 hp5)
167167
rintro st6 vs6 ⟨v6, rfl, hg6, hp6⟩
168168
wp_run
169169
exact ⟨v6, rfl, hg6, hp6⟩
@@ -179,13 +179,13 @@ private theorem func4_term (env : HostEnv Unit) (st : Store Unit) (sp x y : UInt
179179
st'.globals.globals[0]? = some (.i32 sp) ∧ st'.mem.pages = 16) := by
180180
apply TerminatesWith.of_wp_entry_for (f := ⟨[.f32, .f32], [], func4, [.f32], none⟩) rfl
181181
unfold func4; wp_run
182-
apply wp_call_of_terminates (func5_term env st sp y [] hg hp)
182+
apply wp_call_tw (func5_term env st sp y [] hg hp)
183183
rintro st5 vs5 ⟨v5, rfl, hg5, hp5⟩
184184
wp_run
185-
apply wp_call_of_terminates (func5_term env st5 sp x [.i32 (2147483648 &&& v5)] hg5 hp5)
185+
apply wp_call_tw (func5_term env st5 sp x [.i32 (2147483648 &&& v5)] hg5 hp5)
186186
rintro st5' vs5' ⟨v5', rfl, hg5', hp5'⟩
187187
wp_run
188-
apply wp_call_of_terminates
188+
apply wp_call_tw
189189
(func6_term env st5' sp ((2147483648 &&& v5) ||| (2147483647 &&& v5')) [] hg5' hp5')
190190
rintro st6 vs6 ⟨v6, rfl, hg6, hp6⟩
191191
wp_run
@@ -215,11 +215,11 @@ theorem check_terminates : FloatReinterpretSpec := by
215215
globals_set0 (1048576 - 16) hg
216216
apply wp_block_cons; apply wp_block_cons
217217
wp_run
218-
apply wp_call_of_terminates
218+
apply wp_call_tw
219219
(func0_term env _ (1048576 - 16) x [] hg10 (by rfl) (by decide) (by decide))
220220
rintro st0 vs0 ⟨v0, rfl, hg0, hp0⟩
221221
wp_run
222-
apply wp_call_of_terminates (func9_term env st0 (1048576 - 16) x [.f32 v0] hg0 hp0)
222+
apply wp_call_tw (func9_term env st0 (1048576 - 16) x [.f32 v0] hg0 hp0)
223223
rintro st9 vs9 ⟨v9, rfl, hg9, hp9⟩
224224
wp_run
225225
have hnt : ¬ ((1048576 - 16 : UInt32).toNat + 12 + 4 > 16 * 65536) := by decide
@@ -230,11 +230,11 @@ theorem check_terminates : FloatReinterpretSpec := by
230230
simp [hp9, hg9]
231231
· -- v0 = v9: continue; second comparison
232232
simp [heq09]
233-
apply wp_call_of_terminates
233+
apply wp_call_tw
234234
(func0_term env st9 (1048576 - 16) x [] hg9 hp9 (by decide) (by decide))
235235
rintro st0' vs0' ⟨v0', rfl, hg0', hp0'⟩
236236
wp_run
237-
apply wp_call_of_terminates
237+
apply wp_call_tw
238238
(func2_term env st0' (1048576 - 16) x [.f32 v0'] hg0' hp0' (by decide) (by decide))
239239
rintro st2 vs2 ⟨v2, rfl, hg2, hp2⟩
240240
wp_run
@@ -255,11 +255,11 @@ theorem check_terminates : FloatReinterpretSpec := by
255255
globals_set0 (1048576 - 16) hg
256256
apply wp_block_cons; apply wp_block_cons
257257
wp_run
258-
apply wp_call_of_terminates
258+
apply wp_call_tw
259259
(func7_term env _ (1048576 - 16) x y [] hg11 (by rfl) (by decide) (by decide))
260260
rintro st7 vs7 ⟨v7, rfl, hg7, hp7⟩
261261
wp_run
262-
apply wp_call_of_terminates (func4_term env st7 (1048576 - 16) x y [.f32 v7] hg7 hp7)
262+
apply wp_call_tw (func4_term env st7 (1048576 - 16) x y [.f32 v7] hg7 hp7)
263263
rintro st4 vs4 ⟨v4, rfl, hg4, hp4⟩
264264
wp_run
265265
have hnt : ¬ ((1048576 - 16 : UInt32).toNat + 12 + 4 > 16 * 65536) := by decide

programs/lean/Project/FloatRound/Spec.lean

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ private theorem func4_term (env : HostEnv Unit) (st : Store Unit) (sp x : UInt32
104104
st'.globals.globals[0]? = some (.i32 sp) ∧ st'.mem.pages = 16) := by
105105
apply TerminatesWith.of_wp_entry_for (f := ⟨[.f32], [], func4, [.f32], none⟩) rfl
106106
unfold func4; wp_run
107-
apply wp_call_of_terminates (func5_term env st sp x [] hg hp h16 hb)
107+
apply wp_call_tw (func5_term env st sp x [] hg hp h16 hb)
108108
rintro st5 vs5 ⟨v5, rfl, hg5, hp5⟩
109109
wp_run
110110
exact ⟨v5, rfl, hg5, hp5⟩
@@ -127,7 +127,7 @@ private theorem func0_term (env : HostEnv Unit) (st : Store Unit) (sp x : UInt32
127127
have hg1 : ({st with globals := {globals := st.globals.globals.set 0 (.i32 (sp - 16))}} : Store Unit).globals.globals[0]? = some (.i32 (sp - 16)) :=
128128
globals_set0 (sp - 16) hg
129129
-- call func1(x) -> v1 = f32Trunc x (operationally), global and mem unchanged
130-
apply wp_call_of_terminates (func1_term env _ (sp - 16) x [] hg1 hp h16_1 hb1)
130+
apply wp_call_tw (func1_term env _ (sp - 16) x [] hg1 hp h16_1 hb1)
131131
rintro st1 vs1 ⟨v1, rfl, hg1', hp1'⟩
132132
-- compute frac = x - v1, enter 4-level block structure
133133
wp_run
@@ -155,7 +155,7 @@ private theorem func0_term (env : HostEnv Unit) (st : Store Unit) (sp x : UInt32
155155
· -- frac <= -0.5: floor branch (A cont: call func3)
156156
simp
157157
-- A cont: localGet 1, localGet 2, call 3
158-
apply wp_call_of_terminates
158+
apply wp_call_tw
159159
(func3_term env st1 (sp - 16) v1 [.i32 (sp - 16)] hg1' hp1' h16_1 hb1)
160160
rintro st3 vs3 ⟨v3, rfl, hg3, hp3⟩
161161
have hnt3' : (sp - 16).toNat ≤ 1048560 := by
@@ -167,7 +167,7 @@ private theorem func0_term (env : HostEnv Unit) (st : Store Unit) (sp x : UInt32
167167
· -- frac >= 0.5: ceil branch (C cont: call func2, f32Store 12, br 2)
168168
simp [hge]
169169
-- C cont: localGet 1, localGet 2, call 2
170-
apply wp_call_of_terminates
170+
apply wp_call_tw
171171
(func2_term env st1 (sp - 16) v1 [.i32 (sp - 16)] hg1' hp1' h16_1 hb1)
172172
rintro st2 vs2 ⟨v2, rfl, hg2, hp2⟩
173173
have hnt2' : (sp - 16).toNat ≤ 1048560 := by
@@ -199,12 +199,12 @@ theorem check_round_terminates : FloatRoundSpec := by
199199
apply wp_block_cons; apply wp_block_cons
200200
wp_run
201201
-- call func0(x)
202-
apply wp_call_of_terminates
202+
apply wp_call_tw
203203
(func0_term env _ (1048576 - 16) x hg6 (by rfl) (by decide) (by decide))
204204
rintro st0 vs0 ⟨v0, rfl, hg0, hp0⟩
205205
wp_run
206206
-- call func4(x)
207-
apply wp_call_of_terminates
207+
apply wp_call_tw
208208
(func4_term env st0 (1048576 - 16) x [.f32 v0] hg0 hp0 (by decide) (by decide))
209209
rintro st4 vs4 ⟨v4, rfl, hg4, hp4⟩
210210
-- f32Eq, const 1, and, br_if 0: case split on equality

programs/lean/Project/FloatTrunc/Spec.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,10 @@ theorem check_correct : FloatTruncSpec := by
163163
unfold func2
164164
apply wp_block_cons
165165
wp_run
166-
apply wp_call_of_terminates (func0_terminates env x)
166+
apply wp_call_tw (func0_terminates env x)
167167
rintro st0 vs0 rfl
168168
wp_run
169-
apply wp_call_of_terminates (func1_terminates env st0 x [.i32 (i32TruncSatF32S x)])
169+
apply wp_call_tw (func1_terminates env st0 x [.i32 (i32TruncSatF32S x)])
170170
rintro st1 vs1 rfl
171171
wp_run
172172
simp [ne_eq]

0 commit comments

Comments
 (0)