Documentation

Cvc.Typed.Synth

Syntax-guided synthesis, typed #

Declare the universally quantified variables (declareSygusVar) and the functions to find (synthFun), constrain them (addSygusConstraint), then checkSynth, whose ifSolved branch can read a solution with getSynthSolution. A Grammar σ carries its parameters, so synthFun takes only the grammar and answers a Term σ; synthAnyFun takes the signature instead.

@[reducible, inline]

The outcome of a synthesis check.

Equations
Instances For
    @[reducible, inline]
    abbrev Cvc.Typed.Solver.EnvSolvedT [Ω] (s : Solver) (m : Type → Type) (α : Type) :

    Code running where the solver last found a synthesis solution.

    Equations
    Instances For
      @[reducible, inline]

      Code running where the solver last found a synthesis solution.

      Equations
      Instances For
        @[reducible, inline]
        abbrev Cvc.Typed.Solver.EnvUnsolvableT [Ω] (s : Solver) (m : Type → Type) (α : Type) :

        Code running where the solver last showed the synthesis conjecture has no solution.

        Equations
        Instances For
          @[reducible, inline]

          Code running where the solver last showed the synthesis conjecture has no solution.

          Equations
          Instances For
            @[reducible, inline]
            abbrev Cvc.Typed.Solver.EnvSynthUnknownT [Ω] (s : Solver) (m : Type → Type) (α : Type) :

            Code running where the solver last gave up on a synthesis conjecture.

            Equations
            Instances For
              @[reducible, inline]

              Code running where the solver last gave up on a synthesis conjecture.

              Equations
              Instances For
                def Cvc.Typed.Solver.declareSygusVar [Ω] (s : Solver) (α : Type) [ToTyp α] (symbol : String) :
                Env (Term α)

                Declares a universally quantified variable of the sort α describes.

                Takes its type explicitly, like Solver.declareConstAs.

                Equations
                Instances For
                  def Cvc.Typed.Solver.synthFun [Ω] (s : Solver) {σ : Type} (symbol : String) (g : Grammar σ) :
                  Env (Term σ)

                  Declares a function to synthesize, restricted to what g generates, at g's signature.

                  Equations
                  Instances For
                    def Cvc.Typed.Solver.synthAnyFun' [Ω] (s : Solver) (symbol : String) (boundVars : BVars) (α : Type) [ToTyp α] :
                    Env (Term (BVars.signatureTo α boundVars))

                    Declares a function to synthesize, unrestricted, over boundVars and with codomain α.

                    Equations
                    Instances For
                      @[reducible, inline]
                      abbrev Cvc.Typed.Solver.synthAnyFun [Ω] (s : Solver) {α : Type} [ToTyp α] (symbol : String) (boundVars : BVars) :
                      Env (Term (BVars.signatureTo α boundVars))

                      Declares a function to synthesize, unrestricted, over boundVars and with codomain α.

                      Equations
                      Instances For

                        Adds a formula the synthesized functions must satisfy.

                        Equations
                        Instances For

                          Adds a formula the synthesized functions may assume.

                          Equations
                          Instances For
                            def Cvc.Typed.Solver.addSygusInvConstraint [Ω] (s : Solver) {α β γ δ : Type} (inv : Term α) (pre : Term β) (trans : Term γ) (post : Term δ) :

                            Constrains inv to be an inductive invariant of the transition system.

                            pre must imply inv, inv must be preserved by trans, and inv must imply post. inv, pre and post are predicates over a state, trans one over two states; cvc5 checks that their signatures agree.

                            Equations
                            Instances For

                              Tries to solve the synthesis conjecture, as a raw result.

                              Equations
                              Instances For

                                Tries to find another solution, as a raw result.

                                Equations
                                Instances For

                                  Tries to solve the synthesis conjecture, and runs the branch for the answer.

                                  ifSolved runs in s.EnvSolved, where getSynthSolution is available. An omitted branch throws if its answer comes up.

                                  Equations
                                  Instances For

                                    Tries to find another solution to the synthesis conjecture, with checkSynth's branches.

                                    Only possible where a solution was already found.

                                    Equations
                                    Instances For
                                      def Cvc.Typed.Solver.checkSynth? {m : Type → Type} [Ω] [Monad m] [MonadLiftT BaseIO m] {α : Type} (s : Solver) (ifSolved : s.EnvSolvedT m (Option α) := pure none) (ifUnsolvable : s.EnvUnsolvableT m (Option α) := pure none) (ifUnknown : s.EnvSynthUnknownT m (Option α) := liftM (Untyped.Solver.unexpectedSynthUnknown s false)) :
                                      EnvT m (Option α)

                                      checkSynth, whose solved and unsolvable branches default to none.

                                      An unknown answer still fails, as with checkSat?.

                                      Equations
                                      Instances For
                                        def Cvc.Typed.Solver.getSynthSolution [Ω] (s : Solver) {σ : Type} (fn : Term σ) :

                                        The solution found for a synthesized function.

                                        A solution has the signature of the function it solves for, so the index carries across.

                                        Equations
                                        Instances For
                                          def Cvc.Typed.Solver.getSynthSolutions [Ω] (s : Solver) {σ : Type} (fns : Terms σ) :

                                          The solution found for a synthesized function.

                                          A solution has the signature of the function it solves for, so the index carries across.

                                          Equations
                                          Instances For
                                            def Cvc.Typed.Solver.findSynth [Ω] (s : Solver) {σ : Type} (target : Synth.FindTarget) (g : Grammar σ) :
                                            Env (Option (Term σ))

                                            Enumerates a term of interest, rather than solving a conjecture, none if cvc5 finds none.

                                            The grammar says what may be enumerated, and its start sort is what comes back.

                                            Equations
                                            Instances For
                                              def Cvc.Typed.Solver.findSynth! [Ω] (s : Solver) {σ : Type} (target : Synth.FindTarget) (g : Grammar σ) :
                                              Env (Term σ)

                                              findSynth, failing rather than answering none.

                                              Equations
                                              Instances For

                                                Enumerates a term of interest with no grammar to restrict it, none if cvc5 finds none.

                                                Sort-erased, nothing saying what sort the answer has; Untyped.Term.typeCheck puts an index on.

                                                Equations
                                                Instances For

                                                  findAnySynth, failing rather than answering none.

                                                  Equations
                                                  Instances For

                                                    Enumerates the next term of interest, none if cvc5 finds none.

                                                    Sort-erased, like findAnySynth.

                                                    Equations
                                                    Instances For

                                                      findSynthNext, failing rather than answering none.

                                                      Equations
                                                      Instances For
                                                        def Cvc.Typed.Symbols.Sig.Idents.declareSygusIn {S : Sig} [Ω] [Symbols S] (solver : Solver) (idents : S.Idents) :

                                                        Declares some identifiers as sygus-variables in solver.

                                                        Equations
                                                        • One or more equations did not get rendered due to their size.
                                                        Instances For
                                                          def Cvc.Typed.Symbols.Sig.Idents.declareSygusAtIn {S : Sig} [Ω] [Symbols S] (k : Nat) (solver : Solver) (idents : S.Idents) :
                                                          Env (S.TermsAt k)

                                                          Declares some identifiers as sygus-variables in solver, named for step k.

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