Skip to content

Commit 5f857a9

Browse files
author
Traian Florin Serbanuta
committed
Progress
1 parent cb7af42 commit 5f857a9

File tree

3 files changed

+108
-1
lines changed

3 files changed

+108
-1
lines changed

theories/Core/Equivocation.v

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,14 @@ Definition equivocation_in_trace
126126
/\ input item = Some msg
127127
/\ ~ trace_has_message (field_selector output) msg prefix.
128128

129+
(**
130+
Note that the [equivocation_in_trace] definition counts as an equivocation
131+
a message which is emitted at the same time it is received.
132+
However, the received-not-sent evidence of equivocation would not be able to
133+
detect such a case; hence, we here define the property of a VLSM to never
134+
be allowed to send the message it receives in the same transition.
135+
*)
136+
129137
#[export] Instance equivocation_in_trace_dec
130138
`{EqDecision message}
131139
: RelDecision equivocation_in_trace.

theories/Core/Equivocation/MinimalEquivocationTrace.v

Lines changed: 81 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ From VLSM.Lib Require Import Preamble ListExtras StdppListSet StdppExtras NatExt
44
From VLSM.Lib Require Import Measurable EquationsExtras.
55
From VLSM.Core Require Import VLSM Composition.
66
From VLSM.Core Require Import Equivocation MessageDependencies TraceableVLSM.
7-
From VLSM.Core Require Import AnnotatedVLSM MsgDepLimitedEquivocation.
7+
From VLSM.Core Require Import TraceWiseEquivocation.
88

99
(** * Core: Minimally Equivocating Traces
1010
@@ -702,4 +702,84 @@ Proof.
702702
by intros ? **; eapply minimal_equivocation_choice_monotone.
703703
Qed.
704704

705+
Lemma state_to_minimal_equivocation_trace_equivocation_monotonic_final :
706+
forall (s : composite_state IM) (Hs_pre : composite_constrained_state_prop IM s)
707+
(is : composite_state IM) (tr : list (composite_transition_item IM)),
708+
state_to_minimal_equivocation_trace s Hs_pre = (is, tr) ->
709+
forall (item : composite_transition_item IM), item ∈ tr ->
710+
forall v : validator,
711+
msg_dep_is_globally_equivocating IM message_dependencies sender
712+
(destination item) v ->
713+
msg_dep_is_globally_equivocating IM message_dependencies sender s v.
714+
Proof.
715+
intros * Htr_min; rewrite <- Forall_forall.
716+
assert (Hall := state_to_minimal_equivocation_trace_equivocation_monotonic _ _ _ _ Htr_min).
717+
apply reachable_composite_state_to_trace in Htr_min;
718+
[| by apply minimal_equivocation_choice_is_choosing_well].
719+
induction Htr_min using finite_valid_trace_init_to_rev_ind;
720+
[by constructor |].
721+
apply Forall_app; split; [| by apply Forall_singleton].
722+
apply input_valid_transition_origin in Ht as Hs.
723+
apply input_valid_transition_destination in Ht as Hsf.
724+
eapply Forall_impl.
725+
- by apply IHHtr_min; [| intros * ->; eapply Hall; simplify_list_eq].
726+
- cbn; intros item Hitem_s v Hv.
727+
apply Hitem_s in Hv.
728+
specialize (Hall tr []); setoid_rewrite app_nil_r in Hall.
729+
apply (Hall _ eq_refl).
730+
by apply valid_trace_get_last in Htr_min; subst.
731+
Qed.
732+
733+
Section sec_tracewise_equivocation.
734+
735+
Context
736+
(Hfull : forall i, message_dependencies_full_node_condition_prop (IM i) message_dependencies)
737+
(PreFree := pre_loaded_with_all_messages_vlsm Free)
738+
.
739+
740+
Lemma minimal_equivocation_trace_includes_tracewise_equivocation :
741+
forall (s : composite_state IM) (Hs : constrained_state_prop Free s),
742+
forall is tr, state_to_minimal_equivocation_trace s Hs = (is, tr) ->
743+
forall v, is_equivocating_tracewise_no_has_been_sent IM A sender s v ->
744+
exists (m : message), (sender m = Some v) /\ equivocation_in_trace PreFree m tr.
745+
Proof.
746+
intros s Hs is tr Heqtr v Heqv.
747+
edestruct Heqv.
748+
- eapply reachable_composite_state_to_trace; [| done].
749+
by apply minimal_equivocation_choice_is_choosing_well.
750+
- by eexists.
751+
Qed.
752+
753+
Lemma minimal_equivocation_trace_equivocation_is_statewise_equivocating :
754+
forall (s : composite_state IM) (Hs : constrained_state_prop Free s),
755+
forall is tr, state_to_minimal_equivocation_trace s Hs = (is, tr) ->
756+
forall (m : message), equivocation_in_trace PreFree m tr ->
757+
forall (v : validator), sender m = Some v ->
758+
is_equivocating_statewise IM A sender s v.
759+
Proof.
760+
intros * Htr_min m (pre & item & suffix & -> & Hinput & Hno_output) v Hsender.
761+
eapply full_node_is_globally_equivocating_statewise_iff;
762+
[by apply channel_authentication_sender_safety | done |].
763+
eapply full_node_is_globally_equivocating_iff; [done.. |].
764+
eapply state_to_minimal_equivocation_trace_equivocation_monotonic_final;
765+
[done | by apply elem_of_app; right; left |].
766+
apply reachable_composite_state_to_trace in Htr_min;
767+
[| by apply minimal_equivocation_choice_is_choosing_well].
768+
apply finite_valid_trace_init_to_prefix with (pre := pre ++ [item]) in Htr_min;
769+
[| by exists suffix; simplify_list_eq].
770+
rewrite finite_trace_last_is_last in Htr_min.
771+
apply valid_trace_last_pstate in Htr_min as Hditem.
772+
eapply full_node_is_globally_equivocating_iff; [done.. |].
773+
apply finite_valid_trace_init_to_snoc in Htr_min as Hitem.
774+
destruct Hitem as (_ & Hitem & _).
775+
exists m; constructor; [done |..].
776+
- exists (projT1 (l item)).
777+
apply input_valid_transition_preloaded_project_active_free in Hitem.
778+
by eapply has_been_received_step_update; [done | left].
779+
- contradict Hno_output.
780+
destruct (has_been_sent_step_update (vlsm := Free) Hitem m) as [[] _]; [done |..].
781+
Admitted.
782+
783+
End sec_tracewise_equivocation.
784+
705785
End sec_minimal_equivocation_trace.

theories/Core/MessageDependencies.v

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -823,6 +823,25 @@ Definition full_node_is_globally_equivocating
823823
(s : composite_state IM) (v : validator) : Prop :=
824824
exists m : message, FullNodeGlobalEquivocationEvidence s v m.
825825

826+
Lemma full_node_is_globally_equivocating_statewise_iff
827+
(A : validator -> index) (Hsender_safety : sender_safety_alt_prop IM A sender) :
828+
forall (s : composite_state IM), constrained_state_prop Free s ->
829+
forall (v : validator),
830+
full_node_is_globally_equivocating s v
831+
<->
832+
is_equivocating_statewise IM A sender s v.
833+
Proof.
834+
intros s Hs v; split.
835+
- intros [m [Hsender [i Hreceived] Hnsent]].
836+
exists i, m; split_and!; [done | | done].
837+
by do 2 red; contradict Hnsent; eexists.
838+
- intros (i & m & Hsender & Hnsent & Hreceived).
839+
exists m; constructor; [done | by eexists |].
840+
do 2 red in Hnsent; contradict Hnsent.
841+
apply valid_state_has_trace in Hs as (? & ? & ?).
842+
by eapply has_been_sent_iff_by_sender.
843+
Qed.
844+
826845
Lemma full_node_is_globally_equivocating_stronger s v :
827846
full_node_is_globally_equivocating s v ->
828847
msg_dep_is_globally_equivocating s v.

0 commit comments

Comments
 (0)