src/HOL/Predicate_Compile_Examples/Predicate_Compile_Examples.thy
changeset 36257 3f3e9f18f302
parent 36253 6e969ce3dfcc
child 36260 c0ab79a100e4
equal deleted inserted replaced
36256:d1d9dee7a4bf 36257:3f3e9f18f302
   787 definition
   787 definition
   788   "case_f xs ys = (case (xs @ ys) of [] => [] | (x # xs) => xs)"
   788   "case_f xs ys = (case (xs @ ys) of [] => [] | (x # xs) => xs)"
   789 
   789 
   790 code_pred [inductify, skip_proof] case_f .
   790 code_pred [inductify, skip_proof] case_f .
   791 thm case_fP.equation
   791 thm case_fP.equation
   792 thm case_fP.intros
       
   793 
   792 
   794 fun fold_map_idx where
   793 fun fold_map_idx where
   795   "fold_map_idx f i y [] = (y, [])"
   794   "fold_map_idx f i y [] = (y, [])"
   796 | "fold_map_idx f i y (x # xs) =
   795 | "fold_map_idx f i y (x # xs) =
   797  (let (y', x') = f i y x; (y'', xs') = fold_map_idx f (Suc i) y' xs
   796  (let (y', x') = f i y x; (y'', xs') = fold_map_idx f (Suc i) y' xs
   933   h = max (height l) (height r) + 1 \<and> avl l \<and> avl r)"
   932   h = max (height l) (height r) + 1 \<and> avl l \<and> avl r)"
   934 (*
   933 (*
   935 code_pred [inductify] avl .
   934 code_pred [inductify] avl .
   936 thm avl.equation*)
   935 thm avl.equation*)
   937 
   936 
   938 code_pred [random_dseq inductify] avl .
   937 code_pred [new_random_dseq inductify] avl .
   939 thm avl.random_dseq_equation
   938 thm avl.new_random_dseq_equation
   940 
   939 
   941 values [random_dseq 2, 1, 7] 5 "{t:: int tree. avl t}"
   940 values [new_random_dseq 2, 1, 7] 5 "{t:: int tree. avl t}"
   942 
   941 
   943 fun set_of
   942 fun set_of
   944 where
   943 where
   945 "set_of ET = {}"
   944 "set_of ET = {}"
   946 | "set_of (MKT n l r h) = insert n (set_of l \<union> set_of r)"
   945 | "set_of (MKT n l r h) = insert n (set_of l \<union> set_of r)"