Casting for ProtocolSpec and related structures #
We define custom dependent casts (registered as DCast instances) for the following structures:
ProtocolSpecMessageIdxandChallengeIdx(Full)Transcript- Related oracle interface instances
We also show basic properties about these casts.
Casting Protocol Specifications #
Casting a ProtocolSpec across an equality of the number of rounds
One should use the type-class function dcast instead of this one.
Instances For
Casting (Partial) Transcripts #
@[simp]
theorem
ProtocolSpec.cast_dir_idx
{n₁ n₂ : ℕ}
{pSpec₁ : ProtocolSpec n₁}
{pSpec₂ : ProtocolSpec n₂}
{hn : n₁ = n₂}
(hSpec : ProtocolSpec.cast hn pSpec₁ = pSpec₂)
{i : Fin n₁}
:
theorem
ProtocolSpec.cast_Type_idx
{n₁ n₂ : ℕ}
{pSpec₁ : ProtocolSpec n₁}
{pSpec₂ : ProtocolSpec n₂}
{hn : n₁ = n₂}
(hSpec : ProtocolSpec.cast hn pSpec₁ = pSpec₂)
{i : Fin n₁}
:
@[simp]
theorem
ProtocolSpec.cast_dir_idx_symm
{n₁ n₂ : ℕ}
{pSpec₁ : ProtocolSpec n₁}
{pSpec₂ : ProtocolSpec n₂}
{hn : n₁ = n₂}
(hSpec : ProtocolSpec.cast hn pSpec₁ = pSpec₂)
{i : Fin n₂}
:
theorem
ProtocolSpec.cast_Type_idx_symm
{n₁ n₂ : ℕ}
{pSpec₁ : ProtocolSpec n₁}
{pSpec₂ : ProtocolSpec n₂}
{hn : n₁ = n₂}
(hSpec : ProtocolSpec.cast hn pSpec₁ = pSpec₂)
{i : Fin n₂}
:
theorem
ProtocolSpec.cast_symm
{n₁ n₂ : ℕ}
{pSpec₁ : ProtocolSpec n₁}
{pSpec₂ : ProtocolSpec n₂}
{hn : n₁ = n₂}
(hSpec : ProtocolSpec.cast hn pSpec₁ = pSpec₂)
:
def
ProtocolSpec.MessageIdx.cast
{n₁ n₂ : ℕ}
(hn : n₁ = n₂)
{pSpec₁ : ProtocolSpec n₁}
{pSpec₂ : ProtocolSpec n₂}
(hSpec : ProtocolSpec.cast hn pSpec₁ = pSpec₂)
(i : pSpec₁.MessageIdx)
:
pSpec₂.MessageIdx
Casting a message index across an equality of ProtocolSpecs.
Instances For
@[simp]
theorem
ProtocolSpec.MessageIdx.cast_injective
{n₁ n₂ : ℕ}
(hn : n₁ = n₂)
{pSpec₁ : ProtocolSpec n₁}
{pSpec₂ : ProtocolSpec n₂}
(hSpec : ProtocolSpec.cast hn pSpec₁ = pSpec₂)
:
Function.Injective (MessageIdx.cast hn hSpec)
@[implicit_reducible]
instance
ProtocolSpec.MessageIdx.instDCast₂ :
DCast₂ ℕ ProtocolSpec fun (x : ℕ) (pSpec : ProtocolSpec x) => pSpec.MessageIdx
theorem
ProtocolSpec.MessageIdx.cast_eq_dcast₂
{n₁ n₂ : ℕ}
{pSpec₁ : ProtocolSpec n₁}
{pSpec₂ : ProtocolSpec n₂}
{hn : n₁ = n₂}
{hSpec : ProtocolSpec.cast hn pSpec₁ = pSpec₂}
{i : pSpec₁.MessageIdx}
:
@[simp]
theorem
ProtocolSpec.Message.cast_idx_symm
{n₁ n₂ : ℕ}
{hn : n₁ = n₂}
{pSpec₁ : ProtocolSpec n₁}
{pSpec₂ : ProtocolSpec n₂}
(hSpec : ProtocolSpec.cast hn pSpec₁ = pSpec₂)
{i : pSpec₂.MessageIdx}
:
theorem
ProtocolSpec.Message.cast_idx
{n₁ n₂ : ℕ}
{hn : n₁ = n₂}
{pSpec₁ : ProtocolSpec n₁}
{pSpec₂ : ProtocolSpec n₂}
(hSpec : ProtocolSpec.cast hn pSpec₁ = pSpec₂)
{i : pSpec₁.MessageIdx}
:
def
ProtocolSpec.ChallengeIdx.cast
{n₁ n₂ : ℕ}
(hn : n₁ = n₂)
{pSpec₁ : ProtocolSpec n₁}
{pSpec₂ : ProtocolSpec n₂}
(hSpec : ProtocolSpec.cast hn pSpec₁ = pSpec₂)
(i : pSpec₁.ChallengeIdx)
:
pSpec₂.ChallengeIdx
Casting a challenge index across an equality of ProtocolSpecs.
Instances For
@[simp]
theorem
ProtocolSpec.ChallengeIdx.cast_injective
{n₁ n₂ : ℕ}
(hn : n₁ = n₂)
{pSpec₁ : ProtocolSpec n₁}
{pSpec₂ : ProtocolSpec n₂}
(hSpec : ProtocolSpec.cast hn pSpec₁ = pSpec₂)
:
Function.Injective (ChallengeIdx.cast hn hSpec)
@[implicit_reducible]
instance
ProtocolSpec.ChallengeIdx.instDCast₂ :
DCast₂ ℕ ProtocolSpec fun (x : ℕ) (pSpec : ProtocolSpec x) => pSpec.ChallengeIdx
theorem
ProtocolSpec.ChallengeIdx.cast_eq_dcast₂
{n₁ n₂ : ℕ}
{pSpec₁ : ProtocolSpec n₁}
{pSpec₂ : ProtocolSpec n₂}
{hn : n₁ = n₂}
{hSpec : ProtocolSpec.cast hn pSpec₁ = pSpec₂}
{i : pSpec₁.ChallengeIdx}
:
@[simp]
theorem
ProtocolSpec.Challenge.cast_idx
{n₁ n₂ : ℕ}
{hn : n₁ = n₂}
{pSpec₁ : ProtocolSpec n₁}
{pSpec₂ : ProtocolSpec n₂}
(hSpec : ProtocolSpec.cast hn pSpec₁ = pSpec₂)
{i : pSpec₁.ChallengeIdx}
:
@[simp]
theorem
ProtocolSpec.Challenge.cast_idx_symm
{n₁ n₂ : ℕ}
{hn : n₁ = n₂}
{pSpec₁ : ProtocolSpec n₁}
{pSpec₂ : ProtocolSpec n₂}
(hSpec : ProtocolSpec.cast hn pSpec₁ = pSpec₂)
{i : pSpec₂.ChallengeIdx}
:
def
ProtocolSpec.Transcript.cast
{n₁ n₂ : ℕ}
(hn : n₁ = n₂)
{pSpec₁ : ProtocolSpec n₁}
{pSpec₂ : ProtocolSpec n₂}
{k : Fin (n₁ + 1)}
{l : Fin (n₂ + 1)}
(hIdx : ↑k = ↑l)
(hSpec : ProtocolSpec.cast hn pSpec₁ = pSpec₂)
(T : Transcript k pSpec₁)
:
Transcript l pSpec₂
Casting two partial transcripts across an equality of ProtocolSpecs, where the cutoff indices
are equal.
Instances For
@[simp]
@[implicit_reducible]
instance
ProtocolSpec.Transcript.instDCast₃ :
DCast₃ ℕ (fun (n : ℕ) => Fin (n + 1)) (fun (n : ℕ) (x : Fin (n + 1)) => ProtocolSpec n)
fun (x : ℕ) (k : Fin (x + 1)) (pSpec : ProtocolSpec x) => Transcript k pSpec
Casting Full Transcripts #
def
ProtocolSpec.FullTranscript.cast
{n₁ n₂ : ℕ}
(hn : n₁ = n₂)
{pSpec₁ : ProtocolSpec n₁}
{pSpec₂ : ProtocolSpec n₂}
(hSpec : ProtocolSpec.cast hn pSpec₁ = pSpec₂)
(T : pSpec₁.FullTranscript)
:
pSpec₂.FullTranscript
Casting a transcript across an equality of ProtocolSpecs.
Internally invoke Transcript.cast with the last indices.
Instances For
@[simp]
@[implicit_reducible]
instance
ProtocolSpec.FullTranscript.instDCast₂ :
DCast₂ ℕ ProtocolSpec fun (x : ℕ) (pSpec : ProtocolSpec x) => pSpec.FullTranscript
theorem
ProtocolSpec.FullTranscript.cast_eq_dcast₂
{n₁ n₂ : ℕ}
(hn : n₁ = n₂)
{pSpec₁ : ProtocolSpec n₁}
{pSpec₂ : ProtocolSpec n₂}
(hSpec : ProtocolSpec.cast hn pSpec₁ = pSpec₂)
{T : pSpec₁.FullTranscript}
:
theorem
ProtocolSpec.challengeOracleInterface_cast
{n₁ n₂ : ℕ}
(hn : n₁ = n₂)
{pSpec₁ : ProtocolSpec n₁}
{pSpec₂ : ProtocolSpec n₂}
{h : n₁ = n₂}
{hSpec : ProtocolSpec.cast h pSpec₁ = pSpec₂}
{i : pSpec₁.ChallengeIdx}
: