Skip to content

Commit

Permalink
New merkletree proof
Browse files Browse the repository at this point in the history
  • Loading branch information
Eagle941 committed Nov 3, 2023
1 parent 4d6558d commit b12b886
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
19 changes: 19 additions & 0 deletions ProvenZk/Merkle.lean
Original file line number Diff line number Diff line change
Expand Up @@ -528,4 +528,23 @@ theorem recover_equivalence
. apply recover_proof_reversible (Item := Item)
assumption

theorem eq_root_eq_tree {H} [ph: Fact (perfect_hash H)] {t₁ t₂ : MerkleTree α H d}:
t₁.root = t₂.root ↔ t₁ = t₂ := by
induction d with
| zero => cases t₁; cases t₂; tauto
| succ _ ih =>
cases t₁
cases t₂
apply Iff.intro
. intro h
have h := Fact.elim ph h
injection h with h
injection h with _ h
injection h
congr <;> {rw [←ih]; assumption}
. intro h
injection h
subst_vars
rfl

end MerkleTree
2 changes: 1 addition & 1 deletion ProvenZk/Misc.lean
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ lemma select_rw [Fact (Nat.Prime N)] {b i1 i2 out : (ZMod N)} : (Gates.select b

lemma double_prop {a b c d : Prop} : (b ∧ a ∧ c ∧ a ∧ d) ↔ (b ∧ a ∧ c ∧ d) := by
simp
tauto
tauto

0 comments on commit b12b886

Please sign in to comment.