Theory Recdef

Up to index of Isabelle/HOL

theory Recdef
imports Wellfounded_Relations FunDef
uses (Tools/TFL/casesplit.ML) (Tools/TFL/utils.ML) (Tools/TFL/usyntax.ML) (Tools/TFL/dcterm.ML) (Tools/TFL/thms.ML) (Tools/TFL/rules.ML) (Tools/TFL/thry.ML) (Tools/TFL/tfl.ML) (Tools/TFL/post.ML) (Tools/recdef_package.ML)
begin

(*  Title:      HOL/Recdef.thy
    ID:         $Id: Recdef.thy,v 1.29 2007/07/11 09:09:15 berghofe Exp $
    Author:     Konrad Slind and Markus Wenzel, TU Muenchen
*)

header {* TFL: recursive function definitions *}

theory Recdef
imports Wellfounded_Relations FunDef
uses
  ("Tools/TFL/casesplit.ML")
  ("Tools/TFL/utils.ML")
  ("Tools/TFL/usyntax.ML")
  ("Tools/TFL/dcterm.ML")
  ("Tools/TFL/thms.ML")
  ("Tools/TFL/rules.ML")
  ("Tools/TFL/thry.ML")
  ("Tools/TFL/tfl.ML")
  ("Tools/TFL/post.ML")
  ("Tools/recdef_package.ML")
begin

lemma tfl_eq_True: "(x = True) --> x"
  by blast

lemma tfl_rev_eq_mp: "(x = y) --> y --> x";
  by blast

lemma tfl_simp_thm: "(x --> y) --> (x = x') --> (x' --> y)"
  by blast

lemma tfl_P_imp_P_iff_True: "P ==> P = True"
  by blast

lemma tfl_imp_trans: "(A --> B) ==> (B --> C) ==> (A --> C)"
  by blast

lemma tfl_disj_assoc: "(a ∨ b) ∨ c == a ∨ (b ∨ c)"
  by simp

lemma tfl_disjE: "P ∨ Q ==> P --> R ==> Q --> R ==> R"
  by blast

lemma tfl_exE: "∃x. P x ==> ∀x. P x --> Q ==> Q"
  by blast

use "Tools/TFL/casesplit.ML"
use "Tools/TFL/utils.ML"
use "Tools/TFL/usyntax.ML"
use "Tools/TFL/dcterm.ML"
use "Tools/TFL/thms.ML"
use "Tools/TFL/rules.ML"
use "Tools/TFL/thry.ML"
use "Tools/TFL/tfl.ML"
use "Tools/TFL/post.ML"
use "Tools/recdef_package.ML"
setup RecdefPackage.setup

lemmas [recdef_simp] =
  inv_image_def
  measure_def
  lex_prod_def
  same_fst_def
  less_Suc_eq [THEN iffD2]

lemmas [recdef_cong] =
  if_cong let_cong image_cong INT_cong UN_cong bex_cong ball_cong imp_cong

lemmas [recdef_wf] =
  wf_trancl
  wf_less_than
  wf_lex_prod
  wf_inv_image
  wf_measure
  wf_pred_nat
  wf_same_fst
  wf_empty

end

lemma tfl_eq_True:

  x = True --> x

lemma tfl_rev_eq_mp:

  x = y --> y --> x

lemma tfl_simp_thm:

  (x --> y) --> x = x' --> x' --> y

lemma tfl_P_imp_P_iff_True:

  P ==> P = True

lemma tfl_imp_trans:

  [| A --> B; B --> C |] ==> A --> C

lemma tfl_disj_assoc:

  (ab) ∨ c == abc

lemma tfl_disjE:

  [| PQ; P --> R; Q --> R |] ==> R

lemma tfl_exE:

  [| ∃x. P x; ∀x. P x --> Q |] ==> Q

lemma

  inv_image r f == {(x, y). (f x, f y) ∈ r}
  measure == inv_image less_than
  ra <*lex*> rb == {((a, b), a', b'). (a, a') ∈ raa = a' ∧ (b, b') ∈ rb}
  same_fst P R == {((x', y'), x, y). x' = xP x ∧ (y', y) ∈ R x}
  m1 < n1m1 = n1 ==> m1 < Suc n1

lemma

  [| b = c; c ==> x = u; ¬ c ==> y = v |]
  ==> (if b then x else y) = (if c then u else v)
  [| M = N; !!x. x = N ==> f x = g x |] ==> Let M f = Let N g
  [| M = N; !!x. xN ==> f x = g x |] ==> f ` M = g ` N
  [| A = B; !!x. xB ==> C x = D x |] ==> (INT x:A. C x) = (INT x:B. D x)
  [| A = B; !!x. xB ==> C x = D x |] ==> (UN x:A. C x) = (UN x:B. D x)
  [| A = B; !!x. xB ==> P x = Q x |] ==> (∃xA. P x) = (∃xB. Q x)
  [| A = B; !!x. xB ==> P x = Q x |] ==> (∀xA. P x) = (∀xB. Q x)
  [| P = P'; P' ==> Q = Q' |] ==> (P --> Q) = (P' --> Q')

lemma

  wf r ==> wf (r+)
  wf less_than
  [| wf ra; wf rb |] ==> wf (ra <*lex*> rb)
  wf r ==> wf (inv_image r f)
  wf (measure f)
  wf pred_nat
  (!!x. P x ==> wf (R x)) ==> wf (same_fst P R)
  wf {}