Documentation

Cedar.Data.Set

Canonical list-based sets #

This file defines a simple set data type, backed by a sorted duplicate-free list. Functions on sets assume but don't require their inputs to be well-formed (sorted and duplicate-free). Separate theorems show that these functions produce well-formed outputs when given well-formed inputs.

Use Set.make to construct well-formed sets from lists.

inductive Cedar.Data.Set (α : Type u) :
Instances For
    def Cedar.Data.instReprSet.repr {α✝ : Type u_1} [Repr α✝] :
    Set α✝NatStd.Format
    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      instance Cedar.Data.instReprSet {α✝ : Type u_1} [Repr α✝] :
      Repr (Set α✝)
      Equations
      def Cedar.Data.instDecidableEqSet.decEq {α✝ : Type u_1} [DecidableEq α✝] (x✝ x✝¹ : Set α✝) :
      Decidable (x✝ = x✝¹)
      Equations
      Instances For
        @[reducible, inline]
        abbrev Cedar.Data.Set.elts {α : Type u} (s : Set α) :
        List α
        Equations
        Instances For
          def Cedar.Data.Set.toList {α : Type u} (s : Set α) :
          List α

          Creates an ordered/duplicate free list from a set provided the underlying set is well formed.

          Equations
          Instances For
            def Cedar.Data.Set.make {α : Type u_1} [LT α] [DecidableLT α] (elts : List α) :
            Set α

            Creates a well-formed set from the given list.

            Equations
            Instances For
              def Cedar.Data.Set.empty {α : Type u_1} :
              Set α

              Empty set ∅

              Equations
              Instances For
                def Cedar.Data.Set.isEmpty {α : Type u_1} [DecidableEq α] (s : Set α) :

                s == ∅

                Equations
                Instances For
                  def Cedar.Data.Set.contains {α : Type u_1} [DecidableEq α] (s : Set α) (elt : α) :

                  elt ∈ s

                  Equations
                  Instances For
                    def Cedar.Data.Set.subset {α : Type u_1} [DecidableEq α] (s₁ s₂ : Set α) :

                    s₁ ⊆ s₂

                    Equations
                    Instances For
                      def Cedar.Data.Set.intersects {α : Type u_1} [DecidableEq α] (s₁ s₂ : Set α) :

                      s₁ ∩ s₂ ≠ ∅

                      Equations
                      Instances For
                        def Cedar.Data.Set.intersect {α : Type u_1} [DecidableEq α] (s₁ s₂ : Set α) :
                        Set α

                        s₁ ∩ s₂

                        Equations
                        Instances For
                          def Cedar.Data.Set.union {α : Type u_1} [LT α] [DecidableLT α] (s₁ s₂ : Set α) :
                          Set α

                          s₁ ∪ s₂

                          Equations
                          Instances For
                            def Cedar.Data.Set.filter {α : Type u_1} (f : αBool) (s : Set α) :
                            Set α

                            Filters s using f.

                            Equations
                            Instances For
                              def Cedar.Data.Set.difference {α : Type u_1} [LT α] [DecidableLT α] [DecidableEq α] (s₁ s₂ : Set α) :
                              Set α

                              s₁ \ s₂.

                              Equations
                              Instances For
                                def Cedar.Data.Set.map {α : Type u_1} {β : Type u_2} [LT β] [DecidableLT β] (f : αβ) (s : Set α) :
                                Set β

                                Maps f to s.

                                Equations
                                Instances For
                                  def Cedar.Data.Set.mapOrErr {α : Type u_1} {β : Type u_2} {ε : Type u_3} [DecidableEq β] [LT β] [DecidableRel fun (x1 x2 : β) => x1 < x2] (f : αExcept ε β) (s : Set α) (err : ε) :
                                  Except ε (Set β)

                                  Maps f to s and returns the result of err if any error is encountered.

                                  Equations
                                  Instances For
                                    def Cedar.Data.Set.all {α : Type u_1} (f : αBool) (s : Set α) :

                                    Returns true if all elements of s satisfy f.

                                    Equations
                                    Instances For
                                      def Cedar.Data.Set.any {α : Type u_1} (f : αBool) (s : Set α) :

                                      Returns true if some element of s satisfies f.

                                      Equations
                                      Instances For
                                        def Cedar.Data.Set.size {α : Type u_1} (s : Set α) :
                                        Equations
                                        Instances For
                                          def Cedar.Data.Set.singleton {α : Type u_1} (a : α) :
                                          Set α
                                          Equations
                                          Instances For
                                            def Cedar.Data.Set.wellFormed {α : Type u_1} [LT α] [DecidableLT α] (s : Set α) :

                                            Checks if a set if well-formed

                                            Equations
                                            Instances For
                                              def Cedar.Data.Set.singleton? {α : Type u_1} [Inhabited α] (s : Set α) :

                                              If s is a singleton set, returns the single element

                                              Equations
                                              Instances For
                                                def Cedar.Data.Set.foldl {α : Type u_1} {β : Type u_2} (f : αβα) (init : α) (s : Set β) :
                                                α
                                                Equations
                                                Instances For
                                                  instance Cedar.Data.Set.instLT {α : Type u_1} [LT α] :
                                                  LT (Set α)
                                                  Equations
                                                  instance Cedar.Data.Set.decLt {α : Type u_1} [LT α] [DecidableEq α] [DecidableLT α] (n m : Set α) :
                                                  Decidable (n < m)
                                                  Equations
                                                  instance Cedar.Data.Set.instMembership {α : Type u_1} :
                                                  Membership α (Set α)
                                                  Equations
                                                  def Cedar.Data.Set.map₁ {β : Type u_1} {α : Type u_2} [LT β] [DecidableLT β] (s : Set α) (f : { a : α // a s }β) :
                                                  Set β
                                                  Equations
                                                  Instances For
                                                    def Cedar.Data.Set.all₁ {α : Type u_1} (s : Set α) (f : { a : α // a s }Bool) :
                                                    Equations
                                                    Instances For
                                                      def Cedar.Data.Set.any₁ {α : Type u_1} (s : Set α) (f : { a : α // a s }Bool) :
                                                      Equations
                                                      Instances For