1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
//! [`ProofSummary`] — Lean-authored display + identifier projection of
//! a [`crate::LeanEvidence`] handle.
//!
//! The summary owns only bounded `String` fields (declared name, kind
//! string, pretty-printed type signature). It carries no `'lean`
//! lifetime because no `Obj<'lean>` survives the decode: the Lean
//! shim materialises the three strings against the session
//! environment before returning, so the Rust value is independent of
//! the runtime that produced it and can be stored, cloned, or sent
//! across thread boundaries.
//!
//! Strings on `ProofSummary` are **display text for diagnostics and
//! storage**. They are not semantic keys; comparing two summaries by
//! field equality does not imply equality of the underlying Lean
//! declarations. **Evidence handles and the summaries derived from
//! them are not proof certificates outside the Lean session that
//! produced or validated them.**
use Obj;
use take_ctor_objects;
use TryFromLean;
use LeanResult;
/// Soft byte cap the Lean-side summariser applies to each `ProofSummary` field.
///
/// Mirrors `proofSummaryByteLimit` in
/// `fixtures/lean/LeanRsFixture/Elaboration.lean`. Bounded so the Rust side
/// can pre-size buffers or budget log lines without an extra FFI round-trip.
pub const LEAN_PROOF_SUMMARY_BYTE_LIMIT: usize = 4 * 1024;
/// Bounded display projection of a kernel-checked Lean declaration.
///
/// Produced by [`crate::LeanSession::summarize_evidence`]. Owns only
/// `String`s, so it has no `'lean` parameter and is freely cloneable
/// or stashable. Every field is bounded by
/// [`LEAN_PROOF_SUMMARY_BYTE_LIMIT`] on the Lean side (UTF-8-safe
/// truncation at a `Char` boundary).
///
/// All fields are diagnostic only. Comparing two summaries by field
/// equality does **not** imply equality of the underlying Lean
/// declarations; route semantic comparisons through a Lean-authored
/// equality export.