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

Formalization for SMC protocols #136

Draft
wants to merge 138 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
138 commits
Select commit Hold shift + click to select a range
3275147
lemma 3.1
t6s Apr 10, 2024
4713b10
cleaning
t6s Apr 10, 2024
91cef06
Lemma 3.2
t6s Apr 10, 2024
22e2c29
Lemma 3.3 in a new file probability/smc.v
gregweng Apr 19, 2024
79fee7c
WIP: try to prove Lemma 3.4
gregweng Apr 24, 2024
ae6146a
WIP: lemma 3.4
gregweng May 13, 2024
4d2a5da
WIP: try prob + uniform dist
gregweng May 16, 2024
0438fad
pXY_unif
t6s May 16, 2024
7405564
comments
t6s May 16, 2024
86a9d01
adapt smc_useful_tools to mc2 (#1)
t6s May 16, 2024
1ae2f57
WIP: cpr_eqE_mul
gregweng May 22, 2024
d11ba90
WIP: progress but not yet finished lemma 3.5
gregweng May 29, 2024
5979d82
WIP: lemma 3.5 with a new approach
gregweng May 30, 2024
654ba1c
WIP: checking how to prove fdist_cond Y0 |= X' _|_ Z'
gregweng Jun 5, 2024
9571191
By a lemma with graphoid lemmas, prove lemma 3.5
gregweng Jun 6, 2024
2dc2086
clean up lemma_3_5 (#2)
garrigue Jun 6, 2024
d39e077
simplify proof of lemma_3_5 (#3)
garrigue Jun 13, 2024
3e13173
Lemma 3.6 and Theorem 3.7, before the entropy part
gregweng Jun 13, 2024
66b7a15
Proved Theorem 3.7 (masked condition removal) entropy version
gregweng Jun 26, 2024
3c9709d
Rebase: unto infotheo master
gregweng Jul 17, 2024
26691ff
WIP: how to handle forall and one instance of it?
gregweng Jul 24, 2024
144f02e
WIP: cannot swap two assumption in one implication?
gregweng Jul 24, 2024
d7371ba
WIP: discussed about how to continue proofs
gregweng Jul 26, 2024
fd67582
WIP: fun_cond_entropy_eq0
gregweng Jul 29, 2024
3186927
WIP: try to continue fun_cond_entropy_eq0
gregweng Jul 30, 2024
9bb3a81
add some comments
gregweng Jul 30, 2024
eb1a3cc
WIP: stuck because associativity in distribution expressions
gregweng Aug 2, 2024
9bc2aa9
WIP: fun cond removal entropy
gregweng Aug 7, 2024
ddef3cf
fun_cond_removal_entropy
gregweng Aug 7, 2024
5a67d2e
WIP: want to prove pi2 but need joint_entropy_indeRV first
gregweng Aug 21, 2024
1c178b6
protocol pi2 eq2 is done
gregweng Aug 21, 2024
0dc4e99
WIP: try to prove eq_fin
gregweng Aug 29, 2024
dd11e5c
WIP: Found that the type of TX in eq3 may need to be 'I_p
gregweng Aug 29, 2024
081e0f2
WIP: try to prove eq3 with TX is I_m.+2
gregweng Aug 30, 2024
f801c63
Proved eq3
gregweng Aug 31, 2024
564237b
Successfully prove two hypothese for eq3 can be provided by lemmas an…
gregweng Sep 2, 2024
865c3ad
WIP: Try to prove eqn4 but vector brings some difficulties
gregweng Sep 3, 2024
703002d
Generalize lemma_3_5
gregweng Sep 5, 2024
98a99d6
Proved eqn4
gregweng Sep 5, 2024
ce34562
Proved eqn6
gregweng Sep 6, 2024
4e0542f
WIP: need cond_entropy1 and cond_entropy conversion
gregweng Sep 6, 2024
60464d3
WIP: trying to convert cond_entropy and cond_entropy1_RV
gregweng Sep 7, 2024
c20588a
WIP: make the eqn2 proof works again
gregweng Sep 10, 2024
8e7b326
Commit before the meeting
gregweng Sep 18, 2024
96db7ff
WIP: cpr_cond_entropy
gregweng Sep 18, 2024
579303b
cpr_cond_entropy
garrigue Sep 18, 2024
da27598
shorten proof of cpr_cond_entropy
garrigue Sep 19, 2024
12eb3ea
small cleanup
garrigue Sep 19, 2024
a28d0fe
cleanup
t6s Sep 25, 2024
c53ff3c
remove surjective_pairing
garrigue Sep 26, 2024
7cb3296
eqn3 proved after a new version of cpr_cond_entropy with a new hypoth…
gregweng Sep 26, 2024
c6b352b
WIP: Stuck at:
gregweng Oct 1, 2024
14abca8
WIP: show function composition results equal to random variables
gregweng Oct 1, 2024
bb2ef59
WIP: eqn3 proven with random variables instead of function compositions
gregweng Oct 1, 2024
c86a45d
WIP: for eqn4, the problem is if P|= s2 _|_ [%...s2...]
gregweng Oct 1, 2024
a50e5e7
Completed the pi2_alice_view_is_leakage_free_proof; inde_RV2_comp st…
gregweng Oct 2, 2024
14d08cc
Fix
gregweng Oct 3, 2024
562e600
For showing premises clearly, Move cpr_cond_entropy to another section
gregweng Oct 4, 2024
9f94801
Change the order in mc_removal_pr,
gregweng Oct 5, 2024
aacf39e
Completed eqn6_proof
gregweng Oct 17, 2024
0f2b44f
extra_pr section
t6s Oct 23, 2024
79b5086
Proved eqn8 again
gregweng Oct 24, 2024
4870723
Proved that from Bob's view pi2 is secure
gregweng Oct 25, 2024
bfaf0b2
try to use pairwise-like inde generator
gregweng Oct 25, 2024
9515b44
Rename indep hypothese
gregweng Oct 30, 2024
b6fead2
WIP: try to unify correct and information leakage but need a better w…
gregweng Oct 31, 2024
1bc5513
SMC scalar product proved again with rV and TX
gregweng Nov 5, 2024
ac6d667
Try to connect the algorithm correctness and information leakage free
gregweng Nov 6, 2024
d3f312e
Connect algorithm and leakage analysis by proving relations between r…
gregweng Nov 7, 2024
4c6caa1
A comment to summarize the work
gregweng Nov 7, 2024
977f95c
Try to introduce module for encapsulating information-leakage-free pr…
gregweng Nov 21, 2024
e4368a3
Commit Jacques' SMC interpreter
gregweng Nov 22, 2024
d727199
WIP: try to figure out howto prove pr2_unif (line 747)
gregweng Nov 23, 2024
931b845
Add hypothesis that r1 is uniformly distributed
gregweng Nov 23, 2024
4662dfe
WIP: admitted the working-in-progress fdist_uniformD because it is ne…
gregweng Nov 23, 2024
4d6c274
Admitted pr2_unif before we can prove it; completed bob_view_is_leaka…
gregweng Nov 27, 2024
6746862
Commit the smc_interpreter_v1 as a reference
gregweng Nov 28, 2024
cb9af4b
WIP: try to understand where to put log
gregweng Dec 2, 2024
a63161f
Add logs
gregweng Dec 3, 2024
9edcacc
Change types in proc scalar_product to RV
gregweng Dec 4, 2024
7bd6aac
Format log lines
gregweng Dec 4, 2024
4cfb4bb
WIP: from logs to alice_view
gregweng Dec 4, 2024
948ea62
WIP: bug in log -- first Send wont appear ; build_alice_view
gregweng Dec 4, 2024
d7be3e1
Add two debug proc
gregweng Dec 5, 2024
c8a1896
Fixed the logging problem
gregweng Dec 5, 2024
6c0c7bc
Remove debugging procs
gregweng Dec 5, 2024
cb51583
Proved general binop of RVs preserves independence in pr_eqM and pr_e…
gregweng Dec 5, 2024
4b40d3b
Debug logs
gregweng Dec 7, 2024
b3f9d21
WIP: try to simulate a generator by init but fallback
gregweng Dec 7, 2024
a1843d4
WIP: try to instantiate scalar product but failed
gregweng Dec 8, 2024
6eda9a7
WIP: suddeny cannot compare two RV (eq)
gregweng Dec 11, 2024
2f492ae
WIP: smc_interpreter.v - Cannot infer an internal placeholder of type
gregweng Dec 11, 2024
24c9f68
WIP: change smc_interpreter log structure
gregweng Dec 13, 2024
9b9a5b7
WIP: Try to build the big record
gregweng Dec 14, 2024
aa5bca3
Can get RV of TX and VX from scalar_product logs
gregweng Dec 15, 2024
28b4caa
get intermediate results from rv inputs
gregweng Dec 15, 2024
3677f24
WIP: try to prove r2 unif (problem: dotproduct_rv is not binop for s1…
gregweng Dec 17, 2024
051d634
pr2_unif proved
gregweng Dec 17, 2024
9fbc692
WIP: try to integrate proofs to smc_interpreter
gregweng Dec 17, 2024
27ec108
Move neg_RV lemmas to a new section
gregweng Dec 18, 2024
b06246a
WIP: seperate sections
gregweng Dec 18, 2024
9cdb4b5
WIP: Put variables back to sections
gregweng Dec 18, 2024
4d7286d
Prepare to migrate RVInputs to smc_interpreter
gregweng Dec 19, 2024
160d42b
Prepare for information leakage proof
gregweng Dec 19, 2024
e129d1b
Can embed alice_information_leakage_free into scalar_product_informat…
gregweng Dec 19, 2024
0dcd7d5
WIP: bug when proving x1s2_x1'_indep in smc_interpreter
gregweng Dec 19, 2024
e6826db
Debugging x2s2_x1'_indep in smc_interpreter.v
gregweng Dec 20, 2024
8ce2d4e
Commit the list-to-tuple change for the information leakage free proof
gregweng Dec 23, 2024
601a2bf
simplify interpreter + wip proving equivalence of traces
garrigue Dec 23, 2024
c7d8c8d
prove cond_entropyC and finish proof for Alice view
garrigue Dec 23, 2024
e2ff392
remove unneeded funext
garrigue Dec 23, 2024
2515e1d
Added is_scalar_product to the interpreter file
gregweng Dec 30, 2024
c7d7e7b
Remove the trace definition before we really need it
gregweng Dec 30, 2024
33c2cb6
Proved is_scalar_product in smc_interpreter.v
gregweng Dec 30, 2024
d115195
Simplify the Lemma smc_scalar_productP
gregweng Dec 30, 2024
151ef25
WIP: fail at the ps2_unif in smc_interpreter.v
gregweng Jan 2, 2025
d0e7660
Rename in traces_ok
gregweng Jan 2, 2025
392195b
Fix the card of 'rV[TX]_n
gregweng Jan 3, 2025
a2054fd
WIP: Encountered type issue between add_RV_unif (finZmodType) and VX …
gregweng Jan 5, 2025
dd5cf2f
Renaming some eqn proofs
gregweng Jan 5, 2025
fa397f0
Renaming
gregweng Jan 5, 2025
b7c2583
WIP: add_RV_unif type issue
gregweng Jan 6, 2025
f50c440
Fix interpreter, adding Fail for safety
garrigue Jan 7, 2025
cde2fc8
x2s2_x1'_indepP
t6s Jan 7, 2025
f6db9b5
Move proba/smc.v to smc/smc_proba.v
gregweng Jan 9, 2025
4d53176
WIP: about how to express mutual independence for arbitrary lengthed …
gregweng Jan 10, 2025
b80d33e
WIP: proving bob is leakage free
gregweng Jan 11, 2025
970b544
Ltac1
t6s Jan 11, 2025
5327b2c
WIP: r2 inde of x2 s2 x1 s1
gregweng Jan 12, 2025
badbf9f
Add SMC party experiments
gregweng Jan 12, 2025
ae6b710
Experiment: inde_between_parties
gregweng Jan 12, 2025
f9cbf79
rename
t6s Jan 12, 2025
0e27315
fix
t6s Jan 12, 2025
f87f021
WIP: two lemmas in smc_proba.v: RV2_indeC should be provable; not sur…
gregweng Jan 13, 2025
ca00aa9
Remove old comments
gregweng Jan 13, 2025
eff3a62
WIP: Try x2s2x1s1_r2_indep
gregweng Jan 15, 2025
baf98fc
Add some comments
gregweng Jan 17, 2025
aecda0e
Finished Alice and Bob information leakage proofs in smc_interpreter.v
gregweng Jan 18, 2025
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
4 changes: 4 additions & 0 deletions _CoqProject
Original file line number Diff line number Diff line change
Expand Up @@ -94,5 +94,9 @@ toy_examples/expected_value_variance.v
toy_examples/expected_value_variance_ordn.v
toy_examples/expected_value_variance_tuple.v
toy_examples/conditional_entropy.v
smc/smc_proba.v
smc/smc_entropy.v
smc/smc_interpreter.v
smc/smc_tactics.v

-R . infotheo
12 changes: 12 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@ from 0.6.0 to 0.6.1

compatibility release

-------------------
from 0.6.1 to 0.7.0
-------------------

Port to MathComp 2

-------------------
from 0.6.0 to 0.6.1
-------------------

compatibility release

-------------------
from 0.5.2 to 0.6.0
-------------------
Expand Down
19 changes: 19 additions & 0 deletions information_theory/entropy.v
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,25 @@ rewrite -(pair_bigA _ (fun a1 a2 => P (a1, a2) * log (P (a1, a2)))) /=.
by rewrite exchange_big pair_big; apply eq_bigr => -[a b] _; rewrite fdistXE.
Qed.

Variables (C: finType) (P' : {fdist A * B * C}).

About fdistA.

Lemma joint_entropyA : `H P' = `H (fdistA P').
Proof.
congr (- _) => /=.
rewrite (eq_bigr (fun a => P' (a.1.1, a.1.2, a.2) * log (P' (a.1.1, a.1.2, a.2)))); last by case => -[].
rewrite -(pair_bigA _ (fun a1 a2 => P' (a1.1, a1.2, a2) * log (P' (a1.1, a1.2, a2)))) /=.
rewrite -(pair_bigA _ (fun a1 a2 => \sum_j P' (a1, a2, j) * log (P' (a1, a2, j)))) /=.
rewrite [RHS](eq_bigr (fun a => fdistA P' (a.1, (a.2.1, a.2.2)) * log (fdistA P' (a.1, (a.2.1, a.2.2))))); last by case => i [].
rewrite -(pair_bigA _ (fun a1 a2 => fdistA P' (a1, (a2.1, a2.2)) * log (fdistA P' (a1, (a2.1, a2.2))))) /=.
apply: eq_bigr => i _.
rewrite -(pair_bigA _ (fun a1 a2 => fdistA P' (i, (a1, a2)) * log (fdistA P' (i, (a1, a2))))) /=.
apply: eq_bigr => j _.
apply: eq_bigr => k _.
rewrite fdistAE //.
Qed.

End joint_entropy.

Lemma entropy_rV (A : finType) n (P : {fdist 'rV[A]_n.+1}) :
Expand Down
108 changes: 107 additions & 1 deletion probability/proba.v
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ Local Notation "{ 'RV' P -> V }" := (RV_of P (Phant _) (Phant V)).
Definition ambient_dist (P : {fdist U}) (X : {RV P -> T}) : {fdist U} := P.

End random_variable.
Notation "{ 'RV' P -> T }" := (RV_of P (Phant _) (Phant T)) : proba_scope.
Notation "{ 'RV' P -> T }" := (@RV _ T%type P ) : proba_scope.

Section random_variable_eqType.
Variables (U : finType) (A : eqType) (P : R.-fdist U).
Expand Down Expand Up @@ -1822,6 +1822,16 @@ End conditionnally_independent_discrete_random_variables.
Notation "P |= X _|_ Y | Z" := (@cinde_rv _ P _ _ _ X Y Z) : proba_scope.
Notation "X _|_ Y | Z" := (cinde_rv X Y Z) : proba_scope.

Section conditionnally_independent_discrete_random_variables_extra.

Variables (U: finType) (P : R.-fdist U) (A B C: finType).
Variables (X : {RV P -> A}) (Y : {RV P -> B}) (Z : {RV P -> C}).

Lemma cinde_rv_sym : X _|_ Y | Z -> Y _|_ X | Z.
Proof. move=>H a b c. by rewrite mulRC cpr_eq_pairC. Qed.

End conditionnally_independent_discrete_random_variables_extra.

Section independent_rv.
Variables (A : finType) (P : R.-fdist A) (TA TB : eqType).
Variables (X : {RV P -> TA}) (Y : {RV P -> TB}).
Expand Down Expand Up @@ -2231,3 +2241,99 @@ rewrite big_ord_recr /=.
Abort.

End prob_chain_rule.



Section more_rv_lemmas.
Variables (U : finType) (P : R.-fdist U).
Variables (TA TB TC UA UB UC : eqType) (f : TA -> UA) (g : TB -> UB) (h: TC -> UC).
Variables (X : {RV P -> TA}) (Y : {RV P -> TB}) (Z : {RV P -> TC}).

Local Notation "f × g" :=
(fun xy => (f xy.1, g xy.2)) (at level 10).

Lemma comp_RV2_ACA : RV2 (f `o X) (g `o Y) = f × g `o RV2 X Y.
Proof. by []. Qed.

Lemma comp_RV3_ACA : [%h `o Z, [% (f `o X), (g `o Y)]] = h × (f × g) `o [%Z, [%X, Y]].
Proof. by []. Qed.
End more_rv_lemmas.

Section more_preimset.
Variables (aT1 aT2 aT3 rT1 rT2 rT3: finType).
Variables (f : aT1 -> rT1) (g : aT2 -> rT2) (h : aT3 -> rT3).
Variables (A : {set rT1}) (B : {set rT2}) (C : {set rT3}).

Local Notation "f × g" :=
(fun xy => (f xy.1, g xy.2)) (at level 10).

Lemma preimsetX :
f × g @^-1: (A `* B) = f @^-1: A `* g @^-1: B.
Proof. by apply/setP=> -[] a b /=; rewrite !inE. Qed.

Lemma preimsetX2 :
h × (f × g) @^-1: (C `* (A `* B)) = h @^-1: C `* (f @^-1: A `* g @^-1: B).
Proof. by apply/setP=> -[] a b /=; rewrite !inE. Qed.

Lemma in_preimset x (Y : {set rT1}) : (x \in f @^-1: Y) = (f x \in Y).
Proof. by rewrite !inE. Qed.
Lemma in_preimset1 x y : (x \in f @^-1: [set y]) = (f x == y).
Proof. by rewrite !inE. Qed.
End more_preimset.


Section more_pr_lemmas.
Variables (U : finType) (P : R.-fdist U).
Variables (TA UA : finType) (f : TA -> UA) (X : {RV P -> TA}).

Lemma pr_in_comp' E :
`Pr[ (f `o X) \in E ] = `Pr[ X \in f @^-1: E ].
Proof.
rewrite !pr_inE' /Pr.
rewrite partition_big_preimset /=.
apply: eq_bigr=> i iE.
under [RHS]eq_bigr=> j ?.
rewrite fdistmapE -ssrR.sumRE.
under eq_bigl do rewrite /= inE /=.
over.
under eq_bigl do rewrite -in_preimset1.
rewrite -partition_big_preimset /= fdistmapE -ssrR.sumRE.
apply: eq_bigl=> j.
by rewrite !inE.
Qed.
End more_pr_lemmas.


Section more_fdist.
Lemma fdistmapE' (R : realType) (A B : finType) (g : A -> B)
(p : fdist R A) (b : B):
fdistmap g p b = (\sum_(a in g @^-1: [set b]) p a)%mcR.
Proof. by rewrite fdistmapE; apply: eq_bigl=> ?; rewrite !inE. Qed.
End more_fdist.


Section more_inde_rv.
Variables (A : finType) (P : R.-fdist A) (TA TB : finType).
Variables (X : {RV P -> TA}) (Y : {RV P -> TB}).

Definition inde_rv_ev :=
forall E F,
`Pr[ [% X, Y] \in E `* F] = `Pr[ X \in E ] * `Pr[ Y \in F ].

Lemma inde_rv_events' : inde_rv X Y <-> inde_rv_ev.
Proof.
split=> H; last by move=> *; rewrite -!pr_eq_set1 -H setX1.
move=> E F; rewrite !pr_inE'.
rewrite [LHS]/Pr; under eq_bigr=> *.
rewrite fdistmapE.
under eq_bigl do rewrite !inE /=.
over.
rewrite [in RHS]/Pr big_distrl /=.
under [RHS]eq_bigr=> i ?.
rewrite big_distrr /=.
under eq_bigr do rewrite -!pr_eqE' -H pr_eqE'.
over.
rewrite -big_setX; apply: eq_bigr=> *.
by rewrite fdistmapE.
Qed.
End more_inde_rv.
Loading