Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[do not merge] Metriclightbulb #435

Draft
wants to merge 24 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
fd852ae
metrics versions of SPI proofs
tckmn Sep 16, 2024
21c90e8
fix naming
tckmn Sep 16, 2024
1ecca9d
metrics versions of LAN9250 and lightbulb
tckmn Sep 27, 2024
b487977
examples metrics proof for spi_write
tckmn Sep 27, 2024
ddb6225
slightly clean up metric lan9250
tckmn Sep 29, 2024
d626eff
strengthen metrics statement
tckmn Oct 2, 2024
78926d5
finish spi metrics
tckmn Oct 2, 2024
1fe5bd8
clean up spi metrics
tckmn Oct 3, 2024
a122633
MetricLightbulb skeleton
andres-erbsen Nov 6, 2024
0e36b33
attempt lan9250_tx
andres-erbsen Nov 8, 2024
aab339c
wip
andres-erbsen Nov 12, 2024
93092eb
new event-loop lemma with metrics WIP
andres-erbsen Nov 12, 2024
4fa46e0
metric_lightbulb_correct first passing version
andres-erbsen Nov 13, 2024
9dcb030
check in theorem statement
andres-erbsen Nov 13, 2024
9b2358b
git mv end2end/src/end2end/MetricLightbulbInvariant.v compiler/src/co…
andres-erbsen Nov 13, 2024
f618e36
still trying to get it to build...
andres-erbsen Nov 13, 2024
cbd05dd
prove mem_available_to_seplog admit/"hypothesis"
samuelgruetter Nov 14, 2024
b6c1c1e
temporarily exclude end2end build target
samuelgruetter Nov 14, 2024
2cdebfe
compat for Coq 8.18 is easy
samuelgruetter Nov 14, 2024
7c80fde
wip prettifying end-to-end metrics theorem
samuelgruetter Nov 14, 2024
4dea9bf
wip proving prettified spec
andres-erbsen Nov 14, 2024
0595cf9
metrics for lan9250_recv_no_packet
andres-erbsen Nov 14, 2024
0ad32f6
fix admits introduced by prettification, more prettification, DONE!
samuelgruetter Nov 14, 2024
5416e5b
Compute (loop_cost 1520 0).
samuelgruetter Nov 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ clean_end2end:
install_end2end:
$(MAKE) -C $(ABS_ROOT_DIR)/end2end install

all: bedrock2_ex LiveVerif_ex LiveVerifEx64 compiler_ex processor end2end
# TODO re-enable end2end
all: bedrock2_ex LiveVerif_ex LiveVerifEx64 compiler_ex processor # end2end

clean: clean_bedrock2 clean_LiveVerif clean_LiveVerifEx64 clean_compiler clean_processor clean_end2end

Expand Down
33 changes: 19 additions & 14 deletions bedrock2/src/bedrock2/MetricProgramLogic.v
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,8 @@ Ltac straightline :=
let __ := match s with String.String _ _ => idtac | String.EmptyString => idtac end in
ident_of_constr_string_cps s ltac:(fun x =>
ensure_free x;
(* NOTE: keep this consistent with the [exists _, _ /\ _] case far below *)
letexists _ as x; split; [solve [repeat straightline]|])
(* NOTE: keep this consistent with the [exists _ _, _ /\ _] case far below *)
letexists _ as x; letexists; split; [solve [repeat straightline]|])
| |- cmd _ ?c _ _ _ _ ?post =>
let c := eval hnf in c in
lazymatch c with
Expand All @@ -250,7 +250,7 @@ Ltac straightline :=
| cmd.interact _ _ _ => fail
| _ => unfold1_cmd_goal; cbv beta match delta [cmd_body]
end
| |- @list_map _ _ (get _ _) _ _ _ => unfold1_list_map_goal; cbv beta match delta [list_map_body]
| |- @list_map _ _ (get _) _ _ _ => unfold1_list_map_goal; cbv beta match delta [list_map_body]
| |- @list_map _ _ (expr _ _) _ _ _ => unfold1_list_map_goal; cbv beta match delta [list_map_body]
| |- @list_map _ _ _ nil _ _ => cbv beta match fix delta [list_map list_map_body]
| |- expr _ _ _ _ _ => unfold1_expr_goal; cbv beta match delta [expr_body]
Expand Down Expand Up @@ -310,15 +310,20 @@ Ltac straightline :=
split; [solve [repeat straightline]|]
(* NOTE: metrics only case; maybe try to unify with non-metrics? *)
| |- exists x y, ?P /\ ?Q =>
eexists; eexists; split; [solve [repeat straightline]|]
(* eexists instead of letexists ensures unification of (?a,?b) = (const,const)
does not unfold the const aggressively (e.g. word to Naive) *)
| |- exists x, Markers.split (?P /\ ?Q) =>
let x := fresh x in refine (let x := _ in ex_intro (fun x => P /\ Q) x _);
split; [solve [repeat straightline]|]
| |- Markers.unique (exists x, Markers.split (?P /\ ?Q)) =>
let x := fresh x in refine (let x := _ in ex_intro (fun x => P /\ Q) x _);
split; [solve [repeat straightline]|]
let x := fresh x in let y := fresh y in
refine (let x := _ in let y := _ in
ex_intro (fun x => exists y, P /\ Q) x (ex_intro (fun y => P /\ Q) y _));
split; [solve [repeat straightline]|]
| |- exists x y, Markers.split (?P /\ ?Q) =>
let x := fresh x in let y := fresh y in
refine (let x := _ in let y := _ in
ex_intro (fun x => exists y, P /\ Q) x (ex_intro (fun y => P /\ Q) y _));
split; [solve [repeat straightline]|]
| |- Markers.unique (exists x y, Markers.split (?P /\ ?Q)) =>
let x := fresh x in let y := fresh y in
refine (let x := _ in let y := _ in
ex_intro (fun x => exists y, P /\ Q) x (ex_intro (fun y => P /\ Q) y _));
split; [solve [repeat straightline]|]
| |- Markers.unique (Markers.left ?G) =>
change G;
unshelve (idtac; repeat match goal with
Expand All @@ -343,12 +348,12 @@ Ltac straightline :=
(* TODO: once we can automatically prove some calls, include the success-only version of this in [straightline] *)
Ltac straightline_call :=
lazymatch goal with
| |- MetricWeakestPrecondition.call ?functions ?callee _ _ _ _ =>
| |- MetricWeakestPrecondition.call ?functions ?callee _ _ _ _ _ =>
let callee_spec := lazymatch constr:(_:spec_of callee) with ?s => s end in
let Hcall := lazymatch goal with H: callee_spec functions |- _ => H end in
eapply MetricWeakestPreconditionProperties.Proper_call; cycle -1;
[ eapply Hcall | try eabstract (solve [Morphisms.solve_proper]) .. ];
[ .. | intros ? ? ? ?]
[ .. | intros ? ? ? ? ?]
end.

Ltac current_trace_mem_locals :=
Expand Down
1 change: 1 addition & 0 deletions bedrock2/src/bedrock2Examples/SPI.v
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ Section WithParameters.
end.

Lemma spi_read_ok : program_logic_goal_for_function! spi_read.
Proof.
repeat straightline.
refine ((atleastonce ["b"; "busy"; "i"] (fun v T M B BUSY I =>
v = word.unsigned I /\ word.unsigned I <> 0 /\ M = m /\
Expand Down
Loading