src/HOL/HOLCF/Tools/Domain/domain_constructors.ML
changeset 42204 b3277168c1e7
parent 42151 4da4fc77664b
child 42224 578a51fae383
equal deleted inserted replaced
42203:9c9c97a5040d 42204:b3277168c1e7
   462       fun arg1 (n, (con,args)) = List.foldr cabs (expvar n) (argvars n args)
   462       fun arg1 (n, (con,args)) = List.foldr cabs (expvar n) (argvars n args)
   463       fun when1 n (m, c) =
   463       fun when1 n (m, c) =
   464           if n = m then arg1 (n, c) else (Constant @{const_syntax bottom})
   464           if n = m then arg1 (n, c) else (Constant @{const_syntax bottom})
   465       val case_constant = Constant (syntax (case_const dummyT))
   465       val case_constant = Constant (syntax (case_const dummyT))
   466       fun case_trans authentic =
   466       fun case_trans authentic =
   467           (if authentic then ParsePrintRule else ParseRule)
   467           (if authentic then Parse_Print_Rule else Parse_Rule)
   468             (app "_case_syntax"
   468             (app "_case_syntax"
   469               (Variable "x",
   469               (Variable "x",
   470                foldr1 (app "_case2") (map_index (case1 authentic) spec)),
   470                foldr1 (app "_case2") (map_index (case1 authentic) spec)),
   471              capp (capps (case_constant, map_index arg1 spec), Variable "x"))
   471              capp (capps (case_constant, map_index arg1 spec), Variable "x"))
   472       fun one_abscon_trans authentic (n, c) =
   472       fun one_abscon_trans authentic (n, c) =
   473           (if authentic then ParsePrintRule else ParseRule)
   473           (if authentic then Parse_Print_Rule else Parse_Rule)
   474             (cabs (con1 authentic n c, expvar n),
   474             (cabs (con1 authentic n c, expvar n),
   475              capps (case_constant, map_index (when1 n) spec))
   475              capps (case_constant, map_index (when1 n) spec))
   476       fun abscon_trans authentic =
   476       fun abscon_trans authentic =
   477           map_index (one_abscon_trans authentic) spec
   477           map_index (one_abscon_trans authentic) spec
   478       val trans_rules : ast Syntax.trrule list =
   478       val trans_rules : ast Syntax.trrule list =
   479           case_trans false :: case_trans true ::
   479           case_trans false :: case_trans true ::
   480           abscon_trans false @ abscon_trans true
   480           abscon_trans false @ abscon_trans true
   481     in
   481     in
   482       val thy = Sign.add_trrules_i trans_rules thy
   482       val thy = Sign.add_trrules trans_rules thy
   483     end
   483     end
   484 
   484 
   485     (* prove beta reduction rule for case combinator *)
   485     (* prove beta reduction rule for case combinator *)
   486     val case_beta = beta_of_def thy case_def
   486     val case_beta = beta_of_def thy case_def
   487 
   487