Skip to main content

Transparency

Enum Transparency 

Source
pub enum Transparency<'a> {
    All,
    Excluding(&'a (dyn Fn(&str) -> bool + Sync)),
}
Expand description

The δ-transparency axis (Lean’s TransparencyMode): normalize_at/normalize_checked_at keep an @[irreducible] constant folded with its body intact, while normalize stays the kernel’s own always-unfolding setting. How much δ a reduction is allowed — Lean’s TransparencyMode, narrowed to the axis that actually changes the answer.

FOLLOWING LEAN, INCLUDING WHERE IT IS SUBTLE. Reducibility in Lean is an ELABORATOR attribute: Lean’s KERNEL unfolds every definition whatever its attribute, which is why example : secret = 5 := rfl on an @[irreducible] def secret : Nat := 5 is refused by the elaborator and accepted by the kernel. So Transparency::All is the kernel’s own setting and stays what normalize uses, and Transparency::Excluding is the elaborator’s default transparency — the setting under which an @[irreducible] constant keeps its body AND stays folded. Collapsing the two in either direction is a real loss: always-transparent makes LOGOS prove by rfl what Lean’s elaborator refuses (the over-permissive direction), and routing irreducibility through add_declaration instead throws the body away and manufactures a silent axiom.

The opacity set is supplied as a PREDICATE rather than read out of the Context, so the reducer does not have to know how the attribute is stored: a reducibility map in Context wires in as Transparency::Excluding(&|n| ctx.is_irreducible(n)) and nothing here changes.

Variants§

§

All

Unfold every definition. The kernel’s setting.

§

Excluding(&'a (dyn Fn(&str) -> bool + Sync))

Keep every constant the predicate accepts FOLDED, body intact. The elaborator’s default.

+ Sync is not decoration: without it Transparency is not Send, and a normalisation entry point that cannot cross a thread boundary cannot be run on a SIZED STACK — which is what stops a deep term ABORTING the process instead of failing. The bound costs nothing: every predicate here is built from Context::is_irreducible, and Context is Sync.

Trait Implementations§

Source§

impl<'a> Clone for Transparency<'a>

Source§

fn clone(&self) -> Transparency<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Copy for Transparency<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for Transparency<'a>

§

impl<'a> !RefUnwindSafe for Transparency<'a>

§

impl<'a> Send for Transparency<'a>

§

impl<'a> Sync for Transparency<'a>

§

impl<'a> Unpin for Transparency<'a>

§

impl<'a> UnsafeUnpin for Transparency<'a>

§

impl<'a> !UnwindSafe for Transparency<'a>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.