Theory Redex_Patterns
section‹Redex Patterns›
theory Redex_Patterns
imports
Labels_and_Overlaps
begin
text‹Collect all rule symbols of a proof term together with the position in its source where they
appear. This is used to split a proof term into a set of single steps, whose union
(@{const join_list}) is the whole proof term again.
The redex patterns are collected in leftmost outermost order.›
fun redex_patterns :: "('f, 'v) pterm ⇒ (('f, 'v) prule × pos) list"
where
"redex_patterns (Var x) = []"
| "redex_patterns (Pfun f ss) = concat (map (λ (i, rps). map (λ (α, p). (α, i#p)) rps)
(zip [0 ..< length ss] (map redex_patterns ss)))"
| "redex_patterns (Prule α ss) = (α, []) # concat (map (λ (p1, rps). map (λ (α, p2). (α, p1@p2)) rps)
(zip (var_poss_list (lhs α)) (map redex_patterns ss)))"