Documentation

Cvc.Basic.Traverse

What a traversal does next #

The answers a traversal's pre and post functions give, shared by everything that folds or walks: the terms of both layers (Cvc.Untyped.Term.fold, Cvc.Typed.Term.walk, …) and proofs (Cvc.Untyped.Solver.Proof.fold, …). Each carries the new state, and says whether to descend, skip, stop, or — for a walk — replace the node.

inductive Cvc.FoldPre (σ : Type) :

What a fold does on reaching a node, before its kids.

  • descend {σ : Type} (s : σ) : FoldPre σ

    Visit the kids.

  • skip {σ : Type} (s : σ) : FoldPre σ

    Do not visit the kids; the node is still left, post and all.

  • stop {σ : Type} (s : σ) : FoldPre σ

    End the fold.

Instances For
    inductive Cvc.FoldPost (σ : Type) :

    What a fold does on leaving a node, after its kids.

    Instances For
      inductive Cvc.WalkPre (σ R : Type) :

      What a walk does on reaching a node, before its kids. R is what replaces the node.

      • descend {σ R : Type} (s : σ) : WalkPre σ R

        Visit the kids.

      • skip {σ R : Type} (s : σ) : WalkPre σ R

        Do not visit the kids; the node is still left, post and all.

      • replace {σ R : Type} (t : R) (s : σ) : WalkPre σ R

        Replace the node, without visiting the replacement; it is then left.

      • replaceAndRevisit {σ R : Type} (t : R) (s : σ) : WalkPre σ R

        Replace the node and visit the replacement, from pre.

      • stop {σ R : Type} (s : σ) : WalkPre σ R

        End the walk, keeping every replacement made.

      Instances For
        inductive Cvc.WalkPost (σ R : Type) :

        What a walk does on leaving a node, after its kids. R is what replaces the node.

        • continue {σ R : Type} (s : σ) : WalkPost σ R

          Carry on.

        • replace {σ R : Type} (t : R) (s : σ) : WalkPost σ R

          Replace the node, and carry on.

        • replaceAndRevisit {σ R : Type} (t : R) (s : σ) : WalkPost σ R

          Replace the node and visit the replacement, from pre.

        • stop {σ R : Type} (s : σ) : WalkPost σ R

          End the walk, keeping every replacement made.

        Instances For