src/HOLCF/IOA/meta_theory/Seq.thy
changeset 10835 f4745d77e620
parent 5976 44290b71a85f
child 12218 6597093b77e7
equal deleted inserted replaced
10834:a7897aebbffc 10835:f4745d77e620
    34 syntax
    34 syntax
    35    "@@"		:: "'a seq => 'a seq => 'a seq"	(infixr 65)
    35    "@@"		:: "'a seq => 'a seq => 'a seq"	(infixr 65)
    36    "Finite"     :: "'a seq => bool"
    36    "Finite"     :: "'a seq => bool"
    37 
    37 
    38 translations
    38 translations
    39    "xs @@ ys" == "sconc`xs`ys"
    39    "xs @@ ys" == "sconc$xs$ys"
    40    "Finite x" == "x:sfinite"
    40    "Finite x" == "x:sfinite"
    41    "~(Finite x)" =="x~:sfinite"
    41    "~(Finite x)" =="x~:sfinite"
    42 
    42 
    43 defs 
    43 defs 
    44 
    44 
    45 
    45 
    46 
    46 
    47 (* f not possible at lhs, as "pattern matching" only for % x arguments,
    47 (* f not possible at lhs, as "pattern matching" only for % x arguments,
    48    f cannot be written at rhs in front, as fix_eq3 does not apply later *)
    48    f cannot be written at rhs in front, as fix_eq3 does not apply later *)
    49 smap_def
    49 smap_def
    50   "smap == (fix`(LAM h f tr. case tr of 
    50   "smap == (fix$(LAM h f tr. case tr of 
    51       nil   => nil
    51       nil   => nil
    52     | x##xs => f`x ## h`f`xs))"
    52     | x##xs => f$x ## h$f$xs))"
    53 
    53 
    54 sfilter_def       
    54 sfilter_def       
    55   "sfilter == (fix`(LAM h P t. case t of 
    55   "sfilter == (fix$(LAM h P t. case t of 
    56 	   nil => nil
    56 	   nil => nil
    57 	 | x##xs => If P`x                                 
    57 	 | x##xs => If P$x                                 
    58                     then x##(h`P`xs)
    58                     then x##(h$P$xs)
    59                     else     h`P`xs
    59                     else     h$P$xs
    60                     fi))" 
    60                     fi))" 
    61 sforall_def
    61 sforall_def
    62   "sforall P t == (sforall2`P`t ~=FF)" 
    62   "sforall P t == (sforall2$P$t ~=FF)" 
    63 
    63 
    64 
    64 
    65 sforall2_def
    65 sforall2_def
    66   "sforall2 == (fix`(LAM h P t. case t of 
    66   "sforall2 == (fix$(LAM h P t. case t of 
    67 	   nil => TT
    67 	   nil => TT
    68 	 | x##xs => P`x andalso h`P`xs))"
    68 	 | x##xs => P$x andalso h$P$xs))"
    69   
    69   
    70 sconc_def
    70 sconc_def
    71   "sconc == (fix`(LAM h t1 t2. case t1 of 
    71   "sconc == (fix$(LAM h t1 t2. case t1 of 
    72                nil       => t2
    72                nil       => t2
    73              | x##xs => x##(h`xs`t2)))"
    73              | x##xs => x##(h$xs$t2)))"
    74 
    74 
    75 slast_def
    75 slast_def
    76   "slast == (fix`(LAM h t. case t of 
    76   "slast == (fix$(LAM h t. case t of 
    77 	   nil => UU
    77 	   nil => UU
    78 	 | x##xs => (If is_nil`xs                              
    78 	 | x##xs => (If is_nil$xs                              
    79                           then x
    79                           then x
    80                          else h`xs fi)))"
    80                          else h$xs fi)))"
    81 
    81 
    82 stakewhile_def      
    82 stakewhile_def      
    83   "stakewhile == (fix`(LAM h P t. case t of 
    83   "stakewhile == (fix$(LAM h P t. case t of 
    84 	   nil => nil
    84 	   nil => nil
    85 	 | x##xs => If P`x                                 
    85 	 | x##xs => If P$x                                 
    86                     then x##(h`P`xs)
    86                     then x##(h$P$xs)
    87                     else nil
    87                     else nil
    88                     fi))" 
    88                     fi))" 
    89 sdropwhile_def
    89 sdropwhile_def
    90   "sdropwhile == (fix`(LAM h P t. case t of 
    90   "sdropwhile == (fix$(LAM h P t. case t of 
    91 	   nil => nil
    91 	   nil => nil
    92 	 | x##xs => If P`x                                 
    92 	 | x##xs => If P$x                                 
    93                     then h`P`xs
    93                     then h$P$xs
    94                     else t
    94                     else t
    95                     fi))" 
    95                     fi))" 
    96 sflat_def
    96 sflat_def
    97   "sflat == (fix`(LAM h t. case t of 
    97   "sflat == (fix$(LAM h t. case t of 
    98 	   nil => nil
    98 	   nil => nil
    99 	 | x##xs => x @@ (h`xs)))"
    99 	 | x##xs => x @@ (h$xs)))"
   100 
   100 
   101 szip_def
   101 szip_def
   102   "szip == (fix`(LAM h t1 t2. case t1 of 
   102   "szip == (fix$(LAM h t1 t2. case t1 of 
   103                nil   => nil
   103                nil   => nil
   104              | x##xs => (case t2 of 
   104              | x##xs => (case t2 of 
   105                           nil => UU 
   105                           nil => UU 
   106                         | y##ys => <x,y>##(h`xs`ys))))"
   106                         | y##ys => <x,y>##(h$xs$ys))))"
   107 
   107 
   108 Partial_def
   108 Partial_def
   109   "Partial x  == (seq_finite x) & ~(Finite x)"
   109   "Partial x  == (seq_finite x) & ~(Finite x)"
   110 
   110 
   111 Infinite_def
   111 Infinite_def