Documentation

Bdd.BDD

structure BDD :

Abstract BDD type.

Instances For
    def BDD.lift {n : } (B : BDD) (h : B.nvars n) :

    Raise the input size (nvars) of a BDD to n, given a proof that the current input size is at most n.

    Equations
    Instances For
      @[simp]
      theorem BDD.lift_nvars {n : } {B : BDD} {h : B.nvars n} :
      (B.lift h).nvars = n

      Lifting a BDD to n yields a BDD with input size (nvars) of n.

      @[simp]
      theorem BDD.lift_refl {B : BDD} :
      B.lift = B

      Lifting a BDD B to its current input size (nvars) yields back B.

      def BDD.denotation {n : } (B : BDD) (h : B.nvars n) :

      The denotation of a BDD is the Boolean function that it represents.

      Equations
      Instances For
        @[simp]
        theorem BDD.lift_denotation {n m : } {B : BDD} {h1 : B.nvars n} {h2 : n m} :
        (B.lift h1).denotation h2 = B.denotation

        lift does not affect denotation.

        @[simp]
        theorem BDD.denotation_cast {n m : } {I : Vector Bool n} {B : BDD} {hn : B.nvars n} {hm : B.nvars m} (h : n = m) :

        denotation absorbs Vector.cast.

        theorem BDD.denotation_independentOf_of_geq_nvars {n : } {i : Fin n} {B : BDD} {h1 : B.nvars n} {h2 : B.nvars i} :

        The denotation of a BDD is independent of indices greater or equal to its input size.

        BDDs are semantically equivalent when their denotations coincide.

        Equations
        Instances For
          theorem BDD.denotation_take {n m : } {I : Vector Bool n} {B : BDD} {hn : B.nvars n} {hm1 : B.nvars m} {hm2 : m n} :
          B.denotation hn I = B.denotation (I.take m)
          theorem BDD.denotation_take' {n : } {I : Vector Bool n} {B : BDD} {hn : B.nvars n} :
          B.denotation hn I = B.denotation (Vector.cast (I.take B.nvars))
          theorem BDD.denotation_eq_of_denotation_eq {n m : } {B C : BDD} (hn : max B.nvars C.nvars n) (hm : max B.nvars C.nvars m) :
          B.denotation = C.denotation B.denotation = C.denotation

          If two BDD have the same denotation with respect to some input size n, then they have the same denotation with respect to any other input size m as well.

          SemanticEquiv is Decidable.

          Use this instance to decide whether two BDDs are equivalent.

          Equations
          def BDD.size :
          BDD
          Equations
          Instances For
            def BDD.const (b : Bool) :

            Return a BDD denoting the constantly-b function.

            See also const_denotation.

            Equations
            Instances For
              def BDD.var (n : ) :

              Return a BDD denoting the nth projection function.

              See also var_denotation.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For
                def BDD.apply :
                (BoolBoolBool)BDDBDDBDD

                Apply a binary Boolean operator to two BDDs.

                See also apply_denotation.

                Equations
                • One or more equations did not get rendered due to their size.
                Instances For
                  @[simp]
                  theorem BDD.apply_nvars {B C : BDD} {o : BoolBoolBool} :
                  (apply o B C).nvars = max B.nvars C.nvars
                  def BDD.and :
                  BDDBDDBDD

                  Return a BDD denoting the conjuction of the denotations of two given BDDs.

                  See also and_denotation.

                  Equations
                  Instances For
                    def BDD.or :
                    BDDBDDBDD

                    Return a BDD denoting the disjunction of the denotations of two given BDDs.

                    See also or_denotation.

                    Equations
                    Instances For
                      def BDD.xor :
                      BDDBDDBDD
                      Equations
                      Instances For
                        def BDD.imp :
                        BDDBDDBDD
                        Equations
                        Instances For
                          def BDD.not :
                          BDDBDD

                          Return a BDD denoting the negation of the denotation of a given BDD.

                          See also not_denotation.

                          Equations
                          Instances For
                            @[simp]
                            theorem BDD.const_nvars {b : Bool} :
                            (const b).nvars = 0
                            @[simp]
                            theorem BDD.const_denotation {b : Bool} {a✝ : } {h : (const b).nvars a✝} :
                            @[simp]
                            theorem BDD.var_nvars {i : } :
                            (var i).nvars = i + 1
                            @[simp]
                            theorem BDD.var_denotation {i a✝ : } {h : (var i).nvars a✝} {I : Vector Bool a✝} :
                            (var i).denotation h I = I[i]
                            @[reducible, inline]
                            abbrev BDD.denotation' (O : BDD) :
                            Equations
                            Instances For
                              theorem BDD.apply_denotation' {B C : BDD} {op : BoolBoolBool} (I : Vector Bool (apply op B C).nvars) :
                              (apply op B C).denotation I = op (B.denotation I) (C.denotation I)
                              @[simp]
                              theorem BDD.apply_denotation {n : } {B C : BDD} {op : BoolBoolBool} {I : Vector Bool n} {h : (apply op B C).nvars n} :
                              (apply op B C).denotation h I = op (B.denotation I) (C.denotation I)
                              @[simp]
                              theorem BDD.and_nvars {B C : BDD} :
                              (B.and C).nvars = max B.nvars C.nvars
                              @[simp]
                              theorem BDD.and_denotation {n : } {B C : BDD} {I : Vector Bool n} {h : (B.and C).nvars n} :
                              (B.and C).denotation h I = (B.denotation I && C.denotation I)
                              @[simp]
                              theorem BDD.or_nvars {B C : BDD} :
                              (B.or C).nvars = max B.nvars C.nvars
                              @[simp]
                              theorem BDD.or_denotation {n : } {B C : BDD} {I : Vector Bool n} {h : (B.or C).nvars n} :
                              (B.or C).denotation h I = (B.denotation I || C.denotation I)
                              @[simp]
                              theorem BDD.xor_nvars {B C : BDD} :
                              (B.xor C).nvars = max B.nvars C.nvars
                              @[simp]
                              theorem BDD.xor_denotation {n : } {B C : BDD} {I : Vector Bool n} {h : (B.xor C).nvars n} :
                              (B.xor C).denotation h I = (B.denotation I ^^ C.denotation I)
                              @[simp]
                              theorem BDD.imp_nvars {B C : BDD} :
                              (B.imp C).nvars = max B.nvars C.nvars
                              @[simp]
                              theorem BDD.imp_denotation {n : } {B C : BDD} {I : Vector Bool n} {h : (B.imp C).nvars n} :
                              (B.imp C).denotation h I = (!B.denotation I || C.denotation I)
                              @[simp]
                              theorem BDD.not_nvars {B : BDD} :
                              @[simp]
                              theorem BDD.not_denotation {n : } {B : BDD} {I : Vector Bool n} {h : B.not.nvars n} :
                              B.not.denotation h I = !B.denotation I
                              def BDD.relabel {n : } (B : BDD) (f : Fin B.nvarsFin n) (h : ∀ (i i' : Nary.Dependency B.denotation'), i < i'f i < f i') :

                              Relabel the variables in a BDD according to a relabeling function f.

                              See also relabel_denotation.

                              Equations
                              Instances For
                                @[simp]
                                theorem BDD.relabel_nvars {n : } {B : BDD} {f : Fin B.nvarsFin n} {h : ∀ (i i' : Nary.Dependency B.denotation'), i < i'f i < f i'} :
                                (B.relabel f h).nvars = n
                                @[simp]
                                theorem BDD.relabel_denotation {n : } {B : BDD} {f : Fin B.nvarsFin n} {hf : ∀ (i i' : Nary.Dependency B.denotation'), i < i'f i < f i'} {I : Vector Bool n} {h : (B.relabel f hf).nvars n} :
                                (B.relabel f hf).denotation h I = B.denotation' (Vector.ofFn fun (i : Fin B.nvars) => I[f i])
                                def BDD.choice {B : BDD} (s : ∃ (I : Vector Bool B.nvars), B.denotation' I = true) :

                                Return an input vector that satisfies the denotation of a given BDD, under the assumption that its denotation is satisfiable.

                                See also choice_denotation.

                                Equations
                                Instances For
                                  @[simp]
                                  theorem BDD.choice_denotation {B : BDD} {s : ∃ (I : Vector Bool B.nvars), B.denotation' I = true} :

                                  Return some input vector that satisfies the denotation of a given BDD, or none if none exists.

                                  See also choice, find_none and find_some.

                                  Equations
                                  Instances For
                                    theorem BDD.find_some {B : BDD} {I : Vector Bool B.nvars} :
                                    def BDD.restrict (b : Bool) (i : ) (B : BDD) :

                                    Return a BDD denoting the restriction of a given BDD at an index i to a Boolean b.

                                    See also restrict_denotation.

                                    Equations
                                    Instances For
                                      theorem BDD.restrict_geq_eq_self {i : } {b : Bool} {B : BDD} :
                                      i B.nvarsrestrict b i B = B
                                      @[simp]
                                      theorem BDD.restrict_nvars {b : Bool} {B : BDD} {i : } :
                                      (restrict b i B).nvars = B.nvars
                                      @[simp]
                                      theorem BDD.restrict_denotation {n : } {b : Bool} {B : BDD} {I : Vector Bool n} {i : } {hi : i < n} {h : (restrict b i B).nvars n} :
                                      (restrict b i B).denotation h I = Nary.restrict (B.denotation ) b i, hi I
                                      def BDD.bforall (B : BDD) (i : ) :

                                      Universal quantification over input at index i.

                                      See also bforall_denotation.

                                      Equations
                                      Instances For
                                        def BDD.bforalls (B : BDD) (l : List ) :

                                        Universal quantification over a list of input indices l.

                                        Equations
                                        Instances For
                                          @[simp]
                                          theorem BDD.bforall_nvars {B : BDD} {i : } :
                                          @[simp]
                                          theorem BDD.bforall_denotation {n : } {B : BDD} {i : } {hi : i < n} {I : Vector Bool n} {h : (B.bforall i).nvars n} :
                                          (B.bforall i).denotation h I = decide (∀ (b : Bool), B.denotation (I.set i b hi) = true)
                                          @[simp]
                                          theorem BDD.bforall_idem {n : } {B : BDD} {i : } {hi : i < n} {I : Vector Bool n} {h : ((B.bforall i).bforall i).nvars n} :
                                          ((B.bforall i).bforall i).denotation h I = (B.bforall i).denotation I
                                          theorem BDD.bforall_comm {n : } {B : BDD} {i j : Fin B.nvars} {I : Vector Bool n} {h : ((B.bforall i).bforall j).nvars n} :
                                          ((B.bforall i).bforall j).denotation h I = ((B.bforall j).bforall i).denotation I
                                          def BDD.bexists (B : BDD) (i : ) :

                                          Existential quantification over input at index i.

                                          See also bexists_denotation.

                                          Equations
                                          Instances For
                                            def BDD.bexistss (B : BDD) (l : List ) :

                                            Existential quantification over a list of input indices l.

                                            Equations
                                            Instances For
                                              @[simp]
                                              theorem BDD.bexists_nvars {B : BDD} {i : } :
                                              @[simp]
                                              theorem BDD.bexists_denotation {n : } {B : BDD} {i : } {hi : i < n} {I : Vector Bool n} {h : (B.bexists i).nvars n} :
                                              (B.bexists i).denotation h I = decide (∃ (b : Bool), B.denotation (I.set i b hi) = true)
                                              @[simp]
                                              theorem BDD.bexists_idem {n : } {B : BDD} {i : } {hi : i < n} {I : Vector Bool n} {h : ((B.bexists i).bexists i).nvars n} :
                                              ((B.bexists i).bexists i).denotation h I = (B.bexists i).denotation I
                                              theorem BDD.bexists_comm {n : } {B : BDD} {i j : Fin B.nvars} {I : Vector Bool n} {h : ((B.bexists i).bexists j).nvars n} :
                                              ((B.bexists i).bexists j).denotation h I = ((B.bexists j).bexists i).denotation I