MCPcopy Create free account
hub / github.com/argumentcomputer/ix / hash_expr

Function hash_expr

crates/ixon/src/sharing.rs:333–338  ·  view source on GitHub ↗

Compute the hash of a single expression. This is useful for testing hash compatibility with Lean.

(expr: &Arc<Expr>)

Source from the content-addressed store, hash-verified

331/// This is useful for testing hash compatibility with Lean.
332pub fn hash_expr(expr: &Arc<Expr>) -> blake3::Hash {
333 let (_info_map, ptr_to_hash, _) =
334 analyze_block(std::slice::from_ref(expr), false);
335 let ptr = expr.as_ref() as *const Expr;
336 *ptr_to_hash.get(&ptr).expect("Expression not found in ptr_to_hash")
337}
338
339/// Topological sort of subterms (leaves first, parents last).
340/// CRITICAL: Keys are sorted by hash bytes for deterministic output.
341/// This ensures Lean and Rust produce the same topological order.

Callers 1

rs_expr_hash_matchesFunction · 0.85

Calls 2

analyze_blockFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected