Compute the hash of a single expression. This is useful for testing hash compatibility with Lean.
(expr: &Arc<Expr>)
| 331 | /// This is useful for testing hash compatibility with Lean. |
| 332 | pub 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. |
no test coverage detected