Theory tDL_assumption
theory tDL_assumption
imports "Sigma_Commit_Crypto.Commitment_Schemes" "Berlekamp_Zassenhaus.Finite_Field"
begin
section ‹The t-Discrete Logarithm Assumption›
text‹The t-DL game and advantage defined as in section 6 of ``The Algebraic Group
Model and its Applications'' by Fuchsbauer, Kiltz, and Loss \<^cite>‹FKL18›.›
locale t_DL = G : cyclic_group G
for G:: "('a, 'b) cyclic_group_scheme" (structure)
and t::nat
and to_type :: "nat ⇒ ('c::prime_card) mod_ring"
and exp :: "'a ⇒ 'c mod_ring ⇒ 'a"
begin
type_synonym ('grp,'mr) adversary = "'grp list ⇒ ('mr mod_ring) spmf"
text ‹The t-DL game states that given a t+1-long tuple in the form of $(g, g^{\alpha}, g^{\alpha^2}, \ldots, g^{\alpha^t})$
the Adversary has to return $\alpha$.›
definition game :: "('a,'c) adversary ⇒ bool spmf" where
"game 𝒜 = TRY do {
α ← sample_uniform (Coset.order G);
α' ← 𝒜 (map (λt'. exp ❙g ((to_type α)^t')) [0..<t+1]);
return_spmf (to_type α = α')
} ELSE return_spmf False"
text ‹The advantage is that the Adversary wins the game.
For the t-DL assumption to hold this advantage should be negligible.›
definition advantage :: " ('a,'c) adversary ⇒ real"
where "advantage 𝒜 = spmf (game 𝒜) True"
text ‹An alternative but equivalent game for the t-DL-game. This alternative game encapsulates the
event that the Adversary wins in the assert\_spmf statement.
adapted proof from Sigma\_Commit\_Crypto.Commitment\_Schemes bind\_game\_alt\_def›
lemma game_alt_def:
"game 𝒜 = TRY do {
α ← sample_uniform (Coset.order G);
α' ← 𝒜 (map (λt'. exp ❙g ((to_type α)^t')) [0..<t+1]);
_::unit ← assert_spmf (to_type α = α');
return_spmf True
} ELSE return_spmf False"
(is "?lhs = ?rhs")
proof -
have "?lhs = TRY do {
α ← sample_uniform (Coset.order G);
TRY do {
α' ← 𝒜 (map (λt'. exp ❙g ((to_type α)^t')) [0..<t+1]);
TRY return_spmf (to_type α = α')
ELSE return_spmf False
} ELSE return_spmf False
} ELSE return_spmf False"
unfolding split_def game_def
by(fold try_bind_spmf_lossless2[OF lossless_return_spmf]) simp
also have "… = TRY do {
α ← sample_uniform (Coset.order G);
TRY do {
α' ← 𝒜 (map (λt'. exp ❙g ((to_type α)^t')) [0..<t+1]);
TRY do {
_ :: unit ← assert_spmf (to_type α = α');
return_spmf True
} ELSE return_spmf False
} ELSE return_spmf False
} ELSE return_spmf False"
by(auto simp add: try_bind_assert_spmf try_spmf_return_spmf1 intro!: try_spmf_cong bind_spmf_cong)
also have "… = ?rhs"
unfolding split_def Let_def
by(fold try_bind_spmf_lossless2[OF lossless_return_spmf]) simp
finally show ?thesis .
qed
end
end