Navigating through tableaux with PathIn #
To define relations between nodes in a tableau we need to represent the whole
tableau and point to a specific node inside it. This is the PathIn
type.
Its values say "go to this child, then to this child, ... stop here."
A path in a tableau. Three constructors for the empty path, a local step or a pdl step.
The loc
and pdl
steps correspond to two out of three constructors of Tableau
.
A PathIn
only goes downwards, it cannot use LoadedPathRepeat
s.
- nil {Hist : History} {X : Sequent} {a✝ : Tableau Hist X} : PathIn a✝
- loc {Hist : History} {X : Sequent} {nrep : ¬rep Hist X} {nbas : ¬X.basic} {lt : LocalTableau X} {next : (Y : Sequent) → Y ∈ endNodesOf lt → Tableau (X :: Hist) Y} {Y : Sequent} (Y_in : Y ∈ endNodesOf lt) (tail : PathIn (next Y Y_in)) : PathIn (Tableau.loc nrep nbas lt next)
- pdl {Hist : History} {X Y : Sequent} {nrep : ¬rep Hist X} {bas : X.basic} {r : PdlRule X Y} {next : Tableau (X :: Hist) Y} (tail : PathIn next) : PathIn (Tableau.pdl nrep bas r next)
Instances For
Equations
Edge Relation #
Notation ⋖_ for edge
(because ⋖ is taken in Mathlib).
Equations
- «term_⋖__» = Lean.ParserDescr.trailingNode `«term_⋖__» 1022 1023 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " ⋖_ ") (Lean.ParserDescr.cat `term 1023))
Instances For
Appending a one-step loc
path is also a ⋖_ child.
When using this, this may be helpful:
convert this; rw [← heq_iff_eq, heq_eqRec_iff_heq, eqRec_heq_iff_heq]
.
Appending a one-step pdl
path is also a ⋖_ child.
The root has no parent. Note this holds even when Hist ≠ [].
Equations
- edge_natLT_relHom = { toFun := PathIn.length, map_rel' := ⋯ }
Instances For
The ⋖_
relation in a tableau is well-founded.
Proven by lifting the relation to the length of histories.
That length goes up with ⋖_
, so because <
is wellfounded on Nat
also ⋖_
is well-founded via RelHomClass.wellFounded
.
Enable "<" notation for transitive closure of ⋖_.
Equations
- instLTPathIn = { lt := Relation.TransGen edge }
Enable "≤" notation for reflexive transitive closure of ⋖_
Equations
- instLEPathIn = { le := Relation.ReflTransGen edge }
The "<" in a tableau is antisymmetric.
An induction principle for PathIn
with a base case at the root of the tableau and
an induction step using the edge
relation ⋖_
.
QUESTIONS:
- Do we need to add any of these attributes? @[induction_eliminator, elab_as_elim]
- Should it be a def or a theorem? (
motive
toProp
or toSort u
?)
From Path to History #
Prefix of a path, taking only the first k
steps.
Equations
- PathIn.nil.prefix x_2 = PathIn.nil
- tail.pdl.prefix k = Fin.cases PathIn.nil (fun (j : Fin tail.pdl.length) => (tail.prefix j).pdl) k
- (PathIn.loc Y_in tail).prefix k = Fin.cases PathIn.nil (fun (j : Fin (PathIn.loc Y_in tail).length) => PathIn.loc Y_in (tail.prefix j)) k
Instances For
Path Rewinding #
Rewinding a path, removing the last k
steps. Cannot go into Hist.
Used to go to the companion of a repeat. Returns .nil
when k
is the length of the whole path.
We use +1 in the type because rewind 0
is always possible, even with history []
.
Defined using Fin.lastCases.
Equations
- PathIn.nil.rewind x_2 = PathIn.nil
- (PathIn.loc Y_in tail).rewind k = Fin.lastCases PathIn.nil (PathIn.loc Y_in ∘ tail.rewind ∘ Fin.cast ⋯) k
- tail.pdl.rewind k = Fin.lastCases PathIn.nil (PathIn.pdl ∘ tail.rewind ∘ Fin.cast ⋯) k
Instances For
Equations
- One or more equations did not get rendered due to their size.
- allPaths (Tableau.pdl nrep bas r next) = {PathIn.nil} ∪ Finset.image (fun (p : PathIn next) => p.pdl) (allPaths next)
- allPaths (Tableau.lrep lpr) = {PathIn.nil}
Instances For
Induction principle going from the leaves (= childless nodes) to the root.
Suppose whenever the motive
holds at all children then it holds at the parent.
Then it holds at all nodes.