Documentation

Pretty.Defs.Basic

Basic definitions #

Layout #

structure Layout :

Layout definition. We encode it as a pair of String and List String so that the layout always has at least one line (Section 3.1)

Instances For
    Equations

    Document #

    inductive Doc :

    Document definition (syntax of $\Sigma_e$, Figure 4)

    Instances For
      inductive Choiceless :
      DocProp

      Choiceless document definition (Section 3.2) We make it a predicate of Doc, since it's a subset of Doc.

      Instances For

        Rendering and widening #

        inductive Render :
        DocLayoutProp

        Rendering relation definition ($⇓_\mathcal{R}$, Figure 6)

        Instances For
          inductive Widen :
          DocList DocProp

          Widening relation definition ($⇓_\mathcal{W}$, Figure 6)

          Instances For

            Measure #

            structure Meas {α : Type} :

            Measure definition (Figure 10)

            Instances For

              Various measure operations (Figure 10) #

              def Meas.adjust_align {α : Type} (i : ) :
              MeasMeas
              • adjustAlign;
              Equations
              • Meas.adjust_align i x = match x with | { last := last, cost := cost, doc := doc, x := x, y := y } => { last := last, cost := cost, doc := Doc.align doc, x := x, y := max i y }
              def Meas.adjust_nest {α : Type} (n : ) :
              MeasMeas
              • adjustNest;
              Equations
              • Meas.adjust_nest n x = match x with | { last := last, cost := cost, doc := doc, x := x, y := y } => { last := last, cost := cost, doc := Doc.nest n doc, x := x, y := y }
              def Meas.concat {α : Type} (F : Factory α) :
              MeasMeasMeas
              • concatenation (∘); and
              Equations
              • One or more equations did not get rendered due to their size.
              def dominates {α : Type} (F : Factory α) (m₁ : Meas) (m₂ : Meas) :
              • domination (≼)
              Equations

              Measure computation/rendering #

              inductive MeasRender {α : Type} (F : Factory α) :
              DocMeasProp

              Measure computation/rendering definition (Figure 11)

              Instances For

                Pareto frontier #

                def cost_increasing {α : Type} (F : Factory α) (ms : List Meas) :

                A list of measures is strictly increasing in cost

                Equations
                • One or more equations did not get rendered due to their size.
                def cost_increasing_non_strict {α : Type} (F : Factory α) (ms : List Meas) :

                A list of measures is (non-strictly) increasing in cost

                Equations
                • One or more equations did not get rendered due to their size.
                def last_decreasing {α : Type} (ms : List Meas) :

                A list of measures is strictly decreasing in length of last line

                Equations
                def pareto {α : Type} (F : Factory α) (ms : List Meas) :

                A predicate that a list of measures form a Pareto frontier (Section 5.4) This definition is not the same as the definition described in the paper, which is based on non-domination. However, they are equivalent, proven at pareto_nondom_iff_pareto in Pretty.Claims.Pareto.

                Equations

                Various list of measures operations (Figure 12) #

                def dedup {α : Type} (F : Factory α) :
                List MeasList Meas
                • dedup;
                Equations
                def merge {α : Type} (F : Factory α) :
                List Meas × List MeasList Meas
                • merge (⊎);
                Equations
                • One or more equations did not get rendered due to their size.
                • merge F ([], ms) = ms
                • merge F (ms, []) = ms

                Measure set #

                inductive MeasureSet {α : Type} :
                • tainted: {α : Type} → MeasMeasureSet
                • set: {α : Type} → (ms : List Meas) → ms []MeasureSet

                Measure set definition (Figure 12). Unlike the definition in the paper, we carry the proof that ms is non-empty instead of relying on the implicit non-empty assumption everywhere.

                Instances For