Documentation

Cvc.Types.Bag

Bags #

The Lean type denoting an SMT bag: a Std.TreeMap from elements to their multiplicity, so the element type must be ordered. Multiplicities are positive: the functions below drop an element whose multiplicity reaches zero, and subtraction stops there, as SMT's bag difference does.

Converting a bag to a term and back is done by Cvc.Untyped.Theory.Bag and Cvc.Typed.Theory.Bag.

@[reducible, inline]
abbrev Cvc.Bag (α : Type) [Ord α] :

An SMT bag (multiset): each element's multiplicity, absent elements standing for zero.

Equations
Instances For
    def Cvc.Bag.empty {α : Type} [Ord α] :
    Bag α

    The empty bag.

    Equations
    Instances For
      def Cvc.Bag.alter {α : Type} [Ord α] (bag : Bag α) (key : α) (f : Nat → Nat) :
      Bag α

      Applies f to an element's multiplicity, removing the element when the result is zero.

      Equations
      Instances For
        def Cvc.Bag.increment {α : Type} [Ord α] (bag : Bag α) (key : α) :
        Bag α

        Adds one occurrence of an element.

        Equations
        Instances For
          def Cvc.Bag.decrement {α : Type} [Ord α] (bag : Bag α) (key : α) :
          Bag α

          Removes one occurrence of an element, if any.

          Equations
          Instances For
            def Cvc.Bag.add {α : Type} [Ord α] (bag : Bag α) (key : α) (n : Nat) :
            Bag α

            Adds n occurrences of an element.

            Equations
            Instances For
              def Cvc.Bag.sub {α : Type} [Ord α] (bag : Bag α) (key : α) (n : Nat) :
              Bag α

              Removes n occurrences of an element, or all of them if it has fewer.

              Equations
              Instances For
                def Cvc.Bag.get? {α : Type} [Ord α] (bag : Bag α) (key : α) :

                An element's multiplicity, none if absent.

                Equations
                Instances For
                  def Cvc.Bag.get {α : Type} [Ord α] (bag : Bag α) (key : α) :

                  An element's multiplicity, zero if absent.

                  Equations
                  Instances For
                    def Cvc.Bag.contains {α : Type} [Ord α] (bag : Bag α) (key : α) :

                    Whether an element's multiplicity is positive.

                    Equations
                    Instances For
                      @[reducible, inline]
                      abbrev Cvc.Bag.mem {α : Type} [Ord α] (bag : Bag α) (key : α) :
                      Equations
                      Instances For
                        @[instance_reducible]
                        instance Cvc.Bag.instMembership {α : Type} [Ord α] :
                        Membership α (Bag α)
                        Equations
                        theorem Cvc.Bag.mem_def {α : Type} [Ord α] (bag : Bag α) {key : α} :
                        (key ∈ bag) = (bag.contains key = true)
                        @[instance_reducible]
                        instance Cvc.Bag.instDecidableMem {α : Type} [Ord α] (bag : Bag α) (key : α) :
                        Decidable (key ∈ bag)
                        Equations
                        def Cvc.Bag.toString {α : Type} [Ord α] [ToString α] (bag : Bag α) :
                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For
                          @[instance_reducible]
                          instance Cvc.Bag.instToString {α : Type} [Ord α] [ToString α] :
                          Equations
                          @[instance_reducible]
                          instance Cvc.Bag.instToTyp {α : Type} [Ord α] [A : ToTyp α] :
                          ToTyp (Bag α)
                          Equations
                          def Cvc.Bag.compare {α : Type} [Ord α] (b1 b2 : Bag α) :
                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For
                            @[instance_reducible]
                            instance Cvc.Bag.instOrd {α : Type} [Ord α] :
                            Ord (Bag α)
                            Equations