Theory Size_Change_Termination

Up to index of Isabelle/HOL/SizeChange

theory Size_Change_Termination
imports Interpretation Implementation
uses sct.ML

(*  Title:      HOL/Library/Size_Change_Termination.thy
    ID:         $Id$
    Author:     Alexander Krauss, TU Muenchen
*)

header "Size-Change Termination"

theory Size_Change_Termination
imports Correctness Interpretation Implementation 
uses "sct.ML"
begin

subsection {* Simplifier setup *}

text {* This is needed to run the SCT algorithm in the simplifier: *}

lemma setbcomp_simps:
  "{x∈{}. P x} = {}"
  "{x∈insert y ys. P x} = (if P y then insert y {x∈ys. P x} else {x∈ys. P x})"
  by auto

lemma setbcomp_cong:
  "A = B ==> (!!x. P x = Q x) ==> {x∈A. P x} = {x∈B. Q x}"
  by auto

lemma cartprod_simps:
  "{} × A = {}"
  "insert a A × B = Pair a ` B ∪ (A × B)"
  by (auto simp:image_def)

lemma image_simps:
  "fu ` {} = {}"
  "fu ` insert a A = insert (fu a) (fu ` A)"
  by (auto simp:image_def)

lemmas union_simps = 
  Un_empty_left Un_empty_right Un_insert_left
  
lemma subset_simps:
  "{} ⊆ B"
  "insert a A ⊆ B ≡ a ∈ B ∧ A ⊆ B"
  by auto 

lemma element_simps:
  "x ∈ {} ≡ False"
  "x ∈ insert a A ≡ x = a ∨ x ∈ A"
  by auto

lemma set_eq_simp:
  "A = B <-> A ⊆ B ∧ B ⊆ A" by auto

lemma ball_simps:
  "∀x∈{}. P x ≡ True"
  "(∀x∈insert a A. P x) ≡ P a ∧ (∀x∈A. P x)"
by auto

lemma bex_simps:
  "∃x∈{}. P x ≡ False"
  "(∃x∈insert a A. P x) ≡ P a ∨ (∃x∈A. P x)"
by auto

lemmas set_simps =
  setbcomp_simps
  cartprod_simps image_simps union_simps subset_simps
  element_simps set_eq_simp
  ball_simps bex_simps

lemma sedge_simps:
  "\<down> * x = \<down>"
  "\<Down> * x = x"
  by (auto simp:mult_sedge_def)

lemmas sctTest_simps =
  simp_thms
  if_True
  if_False
  nat.inject
  nat.distinct
  Pair_eq 

  grcomp_code 
  edges_match.simps 
  connect_edges.simps 

  sedge_simps
  sedge.distinct
  set_simps

  graph_mult_def 
  graph_leq_def
  dest_graph.simps
  graph_plus_def
  graph.inject
  graph_zero_def

  test_SCT_def
  mk_tcl_code

  Let_def
  split_conv

lemmas sctTest_congs = 
  if_weak_cong let_weak_cong setbcomp_cong


lemma SCT_Main:
  "finite_acg A ==> test_SCT A ==> SCT A"
  using LJA_Theorem4 SCT'_exec
  by auto

end