Theory Flat_Aux
section "Instantiating the Abstract Framework"
text "We now provide concrete examples of this framework in action applying a range of the criterion shown "
subsection "Infinite Descent Examples"
subsubsection "Flat Aux Example"
theory Flat_Aux
imports "../Criterion/All"
begin
fun flat and aux where
"flat [] = []"
|"flat (l#ls) = aux l ls"
|"aux [] ls = flat ls"
|"aux (x#xs) ls = x # aux xs ls"
datatype node = Flat | Aux
type_synonym pos = nat
definition "Node ≡ {Flat, Aux}"
lemma nd_aux[simp]:"nd ≠ Aux ⟷ nd = Flat" by(cases nd, auto)
lemma nd_flat[simp]:"nd ≠ Flat ⟷ nd = Aux" by(cases nd, auto)
lemma alw_nodes:"alw (holdsS Node) nds"
unfolding alw_holdsS_iff_snth Node_def apply(rule allI)
subgoal for i by(induct i, auto) .
fun edge::"node ⇒ node ⇒ bool" where
"edge Flat Aux = HOL.True"|
"edge Aux _ = HOL.True"|
"edge Flat Flat = HOL.False"
lemma edge_Flat[simp]:"edge Flat x ⟷ x = Aux" by(cases x, auto)
lemma edge_Flat'[simp]:"edge nd Flat ⟷ nd = Aux" by(cases nd, auto)
fun PosOf::"node ⇒ pos set" where
"PosOf Flat = {0}"|
"PosOf Aux = {0,1}"
definition RR_set :: "((node × pos) × (node × pos) × slope) set" where
"RR_set = {
((Flat, 0), (Aux, 0), Decr),
((Flat, 0), (Aux, 1), Decr),
((Aux, 1), (Flat, 0), Main),
((Aux, 0), (Aux, 0), Decr),
((Aux, 1), (Aux, 1), Main)
}"
definition RR :: "node × pos ⇒ node × pos ⇒ slope ⇒ bool" where
"RR np1 np2 s ≡ ((np1, np2, s) ∈ RR_set)"
definition RRs :: "node ⇒ node ⇒ (pos ⇒ pos ⇒ slope ⇒ bool)" where
"RRs n n' ≡ (λp p' s. (((n, p), (n, p'), s) ∈ RR_set))"
lemmas RRs_defs = RRs_def RR_set_def
lemmas RR_defs = RR_def RR_set_def
lemma RR_aux_aux_1[simp]:"RR (Aux, 0) (Aux, 0) Decr" unfolding RR_defs by auto
lemma P_inPosOf:"RR (nd, P) (nd', P') sl ⟹ P ∈ PosOf nd"
"RR (nd, P) (nd', P') sl ⟹ P' ∈ PosOf nd'" by(auto simp: RR_defs)