Documentation

Cslib.Foundations.Data.HasFresh

class Cslib.HasFresh (α : Type u) :

A type α has a computable fresh function if it is always possible, for any finite set of α, to compute a fresh element not in the set.

  • fresh : Finset αα

    Given a finite set, returns an element not in the set.

  • fresh_notMem (s : Finset α) : fresh ss

    Proof that fresh returns a fresh element for its input set.

Instances
    theorem Cslib.HasFresh.fresh_exists {α : Type u} [HasFresh α] (s : Finset α) :
    ∃ (a : α), as

    An existential version of the HasFresh typeclass. This is useful for the sake of brevity in proofs.

    Configuration for the free_union term elaborator.

    • singleton : Bool

      For free_union Var, include all x : Var. Defaults to true.

    • finset : Bool

      For free_union Var, include all xs : Finset Var. Defaults to true.

    Instances For

      Elaborate a FreeUnionConfig.

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For

        Given a DecidableEq Var instance, this elaborator automatically constructs the union of any variables, finite sets of variables, and optionally the results of provided functions mapping to variables. This is configurable with optional boolean boolean arguments singleton and finset.

        As an example, consider the following:

        variable (x : ℕ) (xs : Finset ℕ) (var : String)
        
        def f (_ : String) : Finset ℕ := {1, 2, 3}
        def g (_ : String) : Finset ℕ := {4, 5, 6}
        
        -- info: ∅ ∪ {x} ∪ id xs : Finset ℕ
        #check free_union ℕ
        
        -- info: ∅ ∪ {x} ∪ id xs ∪ f var ∪ g var : Finset ℕ
        #check free_union [f, g] ℕ
        
        info: ∅ ∪ id xs : Finset ℕ
        #check free_union (singleton := false) ℕ
        
        -- info: ∅ ∪ {x} : Finset ℕ
        #check free_union (finset := false) ℕ
        
        -- info: ∅ : Finset ℕ
        #check free_union (singleton := false) (finset := false) ℕ
        
        Equations
        • One or more equations did not get rendered due to their size.
        Instances For

          Elaborator for free_union.

          Equations
          • One or more equations did not get rendered due to their size.
          Instances For
            noncomputable def Cslib.HasFresh.of_infinite (α : Type u) [Infinite α] :

            All infinite types have an associated (at least noncomputable) fresh function. This, in conjunction with HasFresh.not_of_finite, characterizes HasFresh.

            Equations
            Instances For
              def Cslib.HasFresh.ofNatEmbed {α : Type u} [DecidableEq α] (e : α) :

              Construct a fresh element from an embedding of using Nat.find.

              Equations
              Instances For
                def Cslib.HasFresh.ofSucc {α : Type u} [Inhabited α] [SemilatticeSup α] (f : αα) (hf : ∀ (x : α), x < f x) :

                Construct a fresh element given a function f with x < f x.

                Equations
                Instances For

                  has a computable fresh function.

                  Equations

                  has a computable fresh function.

                  Equations

                  has a computable fresh function.

                  Equations

                  If α has a computable fresh function, then so does Finset α.

                  Equations

                  If α is inhabited, then Multiset α has a computable fresh function.

                  Equations

                  ℕ → ℕ has a computable fresh function.

                  Equations