Skip to main content

SumUpdateL

Struct SumUpdateL 

Source
pub struct SumUpdateL<U>(pub U);
Expand description

Apply an update to the left side of a Sum.

This requires the resource to be in the Left state.

§Example

use creusot_std::{
    ghost::resource::Resource,
    logic::ra::{
        excl::{Excl, ExclUpdate},
        sum::{Sum, SumUpdateL},
    },
    prelude::*,
};

let mut res: Ghost<Resource<Sum<Excl<Int>, Excl<()>>>> =
    Resource::alloc(snapshot!(Sum::Left(Excl(1))));
ghost! { res.update(SumUpdateL(ExclUpdate(snapshot!(2)))) };
proof_assert!(res@ == Sum::Left(Excl(2)));

Tuple Fields§

§0: U

Trait Implementations§

Source§

impl<R1: RA, R2: RA, U: Update<R1>> Update<Sum<R1, R2>> for SumUpdateL<U>

Source§

fn premise(self, from: Sum<R1, R2>) -> bool

logic(open, inline)

match from {
    Sum::Left(from) => self.0.premise(from),
    Sum::Right(_) => false,
}
Source§

fn update(self, from: Sum<R1, R2>, ch: U::Choice) -> Sum<R1, R2>

logic(open, inline)

match from {
    Sum::Left(from) => Sum::Left(self.0.update(from, ch)),
    x => x, /* Dummy */
}

requires

self.premise(from)

Source§

fn frame_preserving(self, from: Sum<R1, R2>, frame: Sum<R1, R2>) -> U::Choice

logic

requires

self.premise(from)

requires

from.op(frame) != None

ensures

self.update(from, result).op(frame) != None

Source§

type Choice = <U as Update<R1>>::Choice

If the update is non-deterministic, it will pick a choice of this type for the update.

Auto Trait Implementations§

§

impl<U> Freeze for SumUpdateL<U>
where U: Freeze,

§

impl<U> Objective for SumUpdateL<U>
where U: Objective,

§

impl<U> RefUnwindSafe for SumUpdateL<U>
where U: RefUnwindSafe,

§

impl<U> Send for SumUpdateL<U>
where U: Send,

§

impl<U> Sync for SumUpdateL<U>
where U: Sync,

§

impl<U> Unpin for SumUpdateL<U>
where U: Unpin,

§

impl<U> UnsafeUnpin for SumUpdateL<U>
where U: UnsafeUnpin,

§

impl<U> UnwindSafe for SumUpdateL<U>
where U: UnwindSafe,

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