Documentation

Canonical

structure Canonical.Var :

A variable with a name, and whether it is proof irrelevant (unused).

Instances For
    Equations

    The value of a let declaration, which can be a term, custom reduction behavior (like recursor), or opaque.

    Instances For
      Equations
      Equations
      structure Canonical.Let :

      A let declaration, with a name and value.

      Instances For
        structure Canonical.Tm :

        A term is an n-ary, β-normal, η-long λ expression: λ params lets . head args

        Instances For
          structure Canonical.Typ :

          A type is an n-ary Π-type: Π params lets . codomain

          Instances For
            Equations

            The return type of Canonical, with the generated terms.

            Instances For
              Equations
              • One or more equations did not get rendered due to their size.
              @[extern term_to_string]
              @[extern typ_to_string]
              @[extern canonical]

              Generate terms of a given type, with given timeout, desired count, synth and debug flags

              @[extern refine]
              opaque Canonical.refine :
              TypBoolBool

              Start a server with the refinement UI on the given type.

              structure Canonical.Pi (A : Type u) (B : AType v) :
              Type (max u v)

              Some Lean Π-types cannot be converted into Canonical Π-types, and are instead converted into this structure.

              • f (a : A) : B a
              Instances For

                define is a list of names that should be defined if this HardCode is triggered

                Instances For

                  Rather than recursively unfolding definitions, HARD_CODE overrides the definitions introduced by a given symbol.

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

                      Structure for storing the type and value of let definitions.

                      Instances For
                        @[reducible, inline]

                        When translating to Canonical, we maintain a state of translated constant symbols.

                        Equations
                        Instances For

                          For readability, we identify free variables by their userName, but with the suffix of the FVarId.name for completeness.

                          Equations
                          Instances For
                            Equations
                            Instances For

                              A Tm representing a natural number.

                              Equations
                              Instances For

                                The default arity of a type e.

                                The arities of the types of the parameters of type e.

                                Equations
                                Instances For
                                  Equations
                                  Instances For
                                    partial def Canonical.defineLiteral (val : Lean.Literal) (insideLet : Nat) :

                                    At present, only small natural numbers are converted into a Tm. Other literals are opaque.

                                    partial def Canonical.define (declName : Lean.Name) (insideLet : Nat) (force : Bool := false) :

                                    Insert declName into the ToCanonicalM definitions, with the correct type and value.

                                    partial def Canonical.toTyp (e : Lean.Expr) (insideLet : Nat) (params : List Var := []) (paramTypes defTypes : List (Option Typ) := []) (defs : List Let := []) (args : List Lean.Expr := []) :

                                    Translate an Expr into a Typ, by collecting the forallE bindings and app arguments until a head symbol is reached.

                                    partial def Canonical.toBody (ty : Lean.Expr) (params : List Var) (defs : List Let) (head : String) (args : List Lean.Expr) (insideLet : Nat) (arity : List Nat) (state : Array Tm := #[]) (typeArgs : List Lean.Expr := []) :

                                    When we reach the head symbol, we call toBody with its type and paramArities. This function is responsible for recursively tranlating the arguments and building the resultant Tm.

                                    partial def Canonical.toTerm (term type : Lean.Expr) (insideLet arity : Nat) (params : List Var := []) (defs : List Let := []) (args typeArgs : List Lean.Expr := []) :

                                    Transalate an Expr to a Tm, by collecting the lam bindings and app arguments until a head symbol is reached.

                                    Converts an Expr e into a Canonical Typ, complete with Definitions in the lets.

                                    Equations
                                    • One or more equations did not get rendered due to their size.
                                    Instances For
                                      @[reducible, inline]

                                      When translating from Canonical, we associate names in the Tm with corresponding Lean FVarIds

                                      Equations
                                      Instances For

                                        Create n fresh LevelMVars.

                                        Equations
                                        Instances For
                                          partial def Canonical.toLam (type : Lean.Expr) (term : Tm) (typeArgs : List Lean.Expr) (paramIndex : Nat) :

                                          Builds a lambda expression of type type following the parameters of Tm term.

                                          partial def Canonical.toApp (type spine : Lean.Expr) (args : List Tm) (argsIndex : Nat) (typeArgs : List Lean.Expr) :

                                          Builds an application of type type following the args

                                          Turn instances of Pi wrapper into native forallE.

                                          Lean's default unfolding predicate copied from Lean.Meta.GetUnfoldableConst.

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

                                            Custom unfolding predicate that unfolds definitions whose body is a forallE.

                                            Equations
                                            Instances For
                                              • count : USize

                                                Canonical produces count proofs.

                                              • synth : Bool

                                                Guarantees completeness with respect to iota reduction.

                                              • pi : Bool

                                                Provides (A → B) : Sort as an axiom to Canonical.

                                              • debug : Bool
                                              • refine : Bool

                                                Opens the refinement UI (beta).

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

                                                  A version of Core.checkInterrupted that does not crash.

                                                  Equations
                                                  Instances For
                                                    def Canonical.canonicalIO (type : Typ) (timeout : UInt64) (count : USize) (synth debug : Bool) :
                                                    Equations
                                                    Instances For

                                                      The widget for the refinement UI.

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

                                                          Canonical exhaustively searches for terms in dependent type theory.

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