pub enum KernelError {
Show 14 variants
UnboundVariable(String),
NotAFunction(String),
NotAType(String),
TypeMismatch {
expected: String,
found: String,
},
NotAnInductive(String),
InvalidMotive(String),
WrongNumberOfCases {
expected: usize,
found: usize,
},
CertificationError(String),
InvalidDeclaration(String),
TerminationViolation {
fix_name: String,
reason: String,
},
PositivityViolation {
inductive: String,
constructor: String,
reason: String,
},
CannotInferHole,
StableMeaningViolation {
name: String,
change: MeaningChange,
dependents: Vec<String>,
},
IndependentRecheck {
subject: String,
error: ReCheckError,
},
}Expand description
Errors that can occur during type checking.
Variants§
UnboundVariable(String)
Reference to an undefined variable.
NotAFunction(String)
Attempted to apply a non-function term.
NotAType(String)
Expected a type (something with type Sort), got something else.
TypeMismatch
Type mismatch: expected one type, found another.
NotAnInductive(String)
Attempted to match on a non-inductive type.
InvalidMotive(String)
Invalid motive in match expression.
WrongNumberOfCases
Wrong number of cases in match expression.
CertificationError(String)
Error during proof certification.
InvalidDeclaration(String)
A checked declaration violates a semantic kernel invariant.
Unlike CertificationError, this is a rejection, not a resource limit or unsupported operation. Callers must not classify inconclusive reduction failures as invalid declarations.
TerminationViolation
Recursive call does not decrease structurally.
This error prevents infinite loops in proofs. A fixpoint must recurse on a structurally smaller argument.
PositivityViolation
Inductive type appears in negative position in constructor.
This error prevents logical paradoxes (Russell’s paradox, etc). An inductive must appear strictly positively in its constructors.
CannotInferHole
Cannot infer the type of a hole without context.
Holes (implicit arguments) need to be checked against an expected type, not inferred standalone.
StableMeaningViolation
A declaration would change what a registered name means while declarations outside the name’s own declaration unit depend on that meaning.
Every dependent was checked against the current meaning, so the change would leave each
one certified for a statement it no longer states. Lean’s environment is append-only;
LOGOS accepts a redeclaration while nothing relies on the name, and an identical one
always. dependents names every dependent by the declaration it belongs to (a derived
equation lemma by its definition, a constructor by its inductive), sorted.
IndependentRecheck
The independent kernel (crate::recheck) did not confirm a declaration this kernel
accepted: it refuted it, or reached no verdict — crate::recheck::Incomplete says why,
a construct it does not cover or a resource bound that stopped it. subject names what
was being certified.
Trait Implementations§
Source§impl Debug for KernelError
impl Debug for KernelError
Source§impl Display for KernelError
impl Display for KernelError
Source§impl Error for KernelError
impl Error for KernelError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()