src/HOL/Predicate_Compile_Examples/Predicate_Compile_Examples.thy
changeset 39275 dd84daec5d3c
parent 39255 432ed333294c
child 39313 41ce0b56d858
equal deleted inserted replaced
39274:b17ffa965223 39275:dd84daec5d3c
  1499 
  1499 
  1500 code_pred is_error .
  1500 code_pred is_error .
  1501 
  1501 
  1502 thm is_error.equation
  1502 thm is_error.equation
  1503 
  1503 
       
  1504 inductive is_error' :: "String.literal \<Rightarrow> bool"
       
  1505 where
       
  1506   "is_error' (STR ''Error1'')"
       
  1507 | "is_error' (STR ''Error2'')"
       
  1508 
       
  1509 code_pred is_error' .
       
  1510 
       
  1511 thm is_error'.equation
       
  1512 
       
  1513 datatype ErrorObject = Error String.literal int
       
  1514 
       
  1515 inductive is_error'' :: "ErrorObject \<Rightarrow> bool"
       
  1516 where
       
  1517   "is_error'' (Error Error_1 3)"
       
  1518 | "is_error'' (Error Error_2 4)"
       
  1519 
       
  1520 code_pred is_error'' .
       
  1521 
       
  1522 thm is_error''.equation
       
  1523 
       
  1524 
  1504 section {* Examples for detecting switches *}
  1525 section {* Examples for detecting switches *}
  1505 
  1526 
  1506 inductive detect_switches1 where
  1527 inductive detect_switches1 where
  1507   "detect_switches1 [] []"
  1528   "detect_switches1 [] []"
  1508 | "detect_switches1 (x # xs) (y # ys)"
  1529 | "detect_switches1 (x # xs) (y # ys)"