Skip to main content

CausalSetSpacetime

Struct CausalSetSpacetime 

Source
pub struct CausalSetSpacetime { /* private fields */ }
Expand description

An element of a causal set, with the elements that precede it.

A causal set is a set C with a relation ≺ that is transitive, irreflexive and locally finite: for any x, z only finitely many y satisfy x ≺ y ≺ z. Transitivity and irreflexivity together exclude cycles (Sorkin 2003, p. 5). There are no coordinates, distances or durations, only the order.

predecessors holds every element x with x ≺ self: the past of this element, not only its links, the relations not implied by transitivity (Sorkin 2003, p. 5). Irreflexivity is local: add_predecessor is the only way to extend the past, and it refuses the element’s own id. No method changes the id. Transitivity, acyclicity across elements and local finiteness are properties of the whole set, which one element cannot see; whoever builds the set keeps them.

It implements none of the coordinate or time traits, so it cannot fill a Context’s spacetime slot. A context carries it in its data slot instead, as Data<CausalSetSpacetime>. The Default element has id 0, no label and an empty past, which keeps irreflexivity.

§Example

use deep_causality_context::*;

let mut e = CausalSetSpacetime::new(3, Some("C".into()));

assert!(e.add_predecessor(1));
assert!(e.add_predecessor(2));
assert!(!e.add_predecessor(3)); // an element does not precede itself

assert!(e.is_after(1));
assert_eq!(e.predecessor_count(), 2);

The past is not writable from outside the type:

ⓘ
use deep_causality_context::*;

let mut e = CausalSetSpacetime::new(3, None);
e.predecessors.insert(3); // private field

Nor can it change the id to one it records as a predecessor:

ⓘ
use deep_causality_context::*;

let mut e = CausalSetSpacetime::new(3, None);
e.add_predecessor(5);
e.id = 5; // private field

§References

  • Sorkin, R. D. (2003). Causal Sets: Discrete Gravity (Notes for the Valdivia Summer School). arXiv:gr-qc/0309009, p. 5. Copy: papers/sorkin_2003_causal_sets_discrete_gravity_arXiv_gr-qc_0309009.pdf.

Implementations§

Source§

impl CausalSetSpacetime

Source

pub fn new(id: ContextoidId, label: Option<String>) -> Self

Source§

impl CausalSetSpacetime

Source

pub fn label(&self) -> Option<&str>

The label, if one was given.

Source

pub fn predecessors(&self) -> &BTreeSet<ContextoidId>

Every element that precedes this one, in ascending id order.

Source

pub fn add_predecessor(&mut self, parent_id: ContextoidId) -> bool

Records parent_id ≺ self. Returns whether it was added: false when parent_id is this element’s own id, which irreflexivity forbids, or when it is already recorded.

Source

pub fn is_after(&self, other_id: ContextoidId) -> bool

Whether other_id ≺ self.

Source

pub fn predecessor_count(&self) -> usize

How many elements precede this one: the cardinality of its past.

Trait Implementations§

Source§

impl Clone for CausalSetSpacetime

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for CausalSetSpacetime

Source§

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

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

impl Default for CausalSetSpacetime

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Display for CausalSetSpacetime

Source§

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

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

impl Identifiable for CausalSetSpacetime

Source§

fn id(&self) -> ContextoidId

Returns the unique id of this item.
Source§

impl PartialEq for CausalSetSpacetime

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for CausalSetSpacetime

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> 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<Borrowed> SampleBorrow<Borrowed> for Borrowed

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> 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.