Jaysen Tsao

Test Blog

Hi this is test blog

/// Extract all snowflake IDs surrounded by <@!? and >, called mentions, from a string.
#[must_use]
pub fn extract_mentions(s: &str) -> Vec<u64> {
static REGEX: OnceLock<Regex> = OnceLock::new();

let regex = REGEX.get_or_init(|| Regex::new(r"<@!?(\d+)>").unwrap());
regex
.captures_iter(s)
.map(|c| c.get(1).unwrap().as_str().parse().unwrap())
.collect::<Vec<_>>()
}

Eigenproof

  1. Sets 𝐴 and 𝐡 are defined as follows:

    𝐴={π‘›βˆˆβ„€|𝑛=8π‘Ÿβˆ’3Β forΒ someΒ integerΒ π‘Ÿ}𝐡={π‘šβˆˆβ„€|π‘š=4𝑠+1Β forΒ someΒ integer 𝑠}.
    1. Prove that π΄βŠ†π΅.
    2. Disprove that π΅βŠ†π΄.
  1. π΄βŠ†π΅. Proof.

    Suppose π‘₯ is an element of set 𝐴, so π‘₯=8π‘Ÿβˆ’3 for some integer π‘Ÿ. To prove π΄βŠ†π΅, we must show that π‘₯ is also an element of set 𝐡, so π‘₯=4𝑠+1 for some integer 𝑠.

    We can rewrite π‘₯ as follows:

    π‘₯=8π‘Ÿβˆ’3=4(2π‘Ÿβˆ’1)+1.

    If we set 𝑠=2π‘Ÿβˆ’1, then we have π‘₯=4𝑠+1. 𝑠 is an integer since π‘Ÿ is an integer, and the products and differences of integers are integers. Thus, π‘₯ is an element of 𝐡. Since π‘₯ was an arbitrary element of 𝐴, we have shown that every element of 𝐴 is also an element of 𝐡, so π΄βŠ†π΅. ∎

  2. 𝐡⊈𝐴. Proof.

    Lemma: Parity Theorem for Even Integers. If π‘₯ is even, then π‘₯+1 is odd.
    Proof. If π‘₯ is even, then π‘₯=2π‘˜ for some integer π‘˜. Then π‘₯+1=2π‘˜+1, so π‘₯+1 is odd.

    For the sake of contradiction, suppose π΅βŠ†π΄. Then for all elements π‘₯∈𝐡, π‘₯∈𝐴.

    Suppose that 𝑠 is an even integer, which means 𝑠 is an integer. If we let π‘₯=4𝑠+1, then π‘₯∈𝐡 by satisfying the predicate for 𝐡.

    Since π‘₯∈𝐡, by the assumption that π΅βŠ†π΄, we have π‘₯∈𝐴. Thus, there exists some integer π‘Ÿ such that π‘₯=8π‘Ÿβˆ’3. Equating the expressions for π‘₯ in terms of π‘Ÿ and 𝑠, we have:

    8π‘Ÿβˆ’3=4𝑠+18π‘Ÿ=4𝑠+42π‘Ÿ=𝑠+1.

    Since 𝑠+1 can be written as 2π‘Ÿ for an integer π‘Ÿ, 𝑠+1 is an even integer by the definition of even integers. However, we assumed that 𝑠 is even. By the Parity Theorem for Even Integers, since 𝑠 is even, 𝑠+1 must be odd.

    𝑠 cannot be even and odd at the same time. This is a contradiction, so our assumption that π΅βŠ†π΄ must be false. Thus, π΅βŠ†π΄ is false. ∎