Skip to main content

KernelError

Enum KernelError 

Source
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.

Fields

§expected: String
§found: String
§

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.

Fields

§expected: usize
§found: usize
§

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.

Fields

§fix_name: String
§reason: String
§

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.

Fields

§inductive: String
§constructor: String
§reason: String
§

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.

Fields

§name: String
§dependents: Vec<String>
§

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.

Fields

§subject: String

Trait Implementations§

Source§

impl Debug for KernelError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for KernelError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for KernelError

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<KernelError> for InterfaceError

Source§

fn from(e: KernelError) -> Self

Converts to this type from the input type.
Source§

impl From<KernelError> for Verdict

Source§

fn from(error: KernelError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.