src/Pure/zterm.ML
changeset 79204 64aca92fcd0f
parent 79201 5d27271701a2
child 79205 a159cb82afe7
equal deleted inserted replaced
79203:031ac0ef064d 79204:64aca92fcd0f
   167   val zterm_of: theory -> term -> zterm
   167   val zterm_of: theory -> term -> zterm
   168   val typ_of: ztyp -> typ
   168   val typ_of: ztyp -> typ
   169   val term_of_consts: Consts.T -> zterm -> term
   169   val term_of_consts: Consts.T -> zterm -> term
   170   val term_of: theory -> zterm -> term
   170   val term_of: theory -> zterm -> term
   171   val norm_type: Type.tyenv -> ztyp -> ztyp
   171   val norm_type: Type.tyenv -> ztyp -> ztyp
   172   val norm_term_consts: Consts.T -> Envir.env -> zterm -> zterm
       
   173   val norm_term: theory -> Envir.env -> zterm -> zterm
   172   val norm_term: theory -> Envir.env -> zterm -> zterm
   174   val dummy_proof: 'a -> zproof
   173   val dummy_proof: 'a -> zproof
   175   val todo_proof: 'a -> zproof
   174   val todo_proof: 'a -> zproof
   176   val axiom_proof:  theory -> string -> term -> zproof
   175   val axiom_proof:  theory -> string -> term -> zproof
   177   val oracle_proof:  theory -> string -> term -> zproof
   176   val oracle_proof:  theory -> string -> term -> zproof
   430         | norm (ZType0 _) = raise Same.SAME
   429         | norm (ZType0 _) = raise Same.SAME
   431         | norm (ZType1 (a, T)) = ZType1 (a, norm T)
   430         | norm (ZType1 (a, T)) = ZType1 (a, norm T)
   432         | norm (ZType (a, Ts)) = ZType (a, Same.map norm Ts);
   431         | norm (ZType (a, Ts)) = ZType (a, Same.map norm Ts);
   433     in norm end;
   432     in norm end;
   434 
   433 
   435 fun norm_term_same consts (envir as Envir.Envir {tyenv, tenv, ...}) =
   434 fun norm_term_same thy (envir as Envir.Envir {tyenv, tenv, ...}) =
   436   if Envir.is_empty envir then Same.same
   435   if Envir.is_empty envir then Same.same
   437   else
   436   else
   438     let
   437     let
   439       val {ztyp, zterm} = zterm_cache_consts consts;
   438       val {ztyp, zterm} = zterm_cache_consts (Sign.consts_of thy);
   440       val typ = typ_cache ();
   439       val typ = typ_cache ();
   441 
   440 
   442       val lookup =
   441       val lookup =
   443         if Vartab.is_empty tenv then K NONE
   442         if Vartab.is_empty tenv then K NONE
   444         else ZVars.unsynchronized_cache (apsnd typ #> Envir.lookup envir #> Option.map zterm);
   443         else ZVars.unsynchronized_cache (apsnd typ #> Envir.lookup envir #> Option.map zterm);
   468 in
   467 in
   469 
   468 
   470 fun norm_type tyenv =
   469 fun norm_type tyenv =
   471   Same.commit (norm_type_same (ztyp_cache ()) tyenv);
   470   Same.commit (norm_type_same (ztyp_cache ()) tyenv);
   472 
   471 
   473 fun norm_term_consts consts envir =
   472 fun norm_term thy envir =
   474   Same.commit (norm_term_same consts envir);
   473   Same.commit (norm_term_same thy envir);
   475 
       
   476 val norm_term = norm_term_consts o Sign.consts_of;
       
   477 
   474 
   478 end;
   475 end;
   479 
   476 
   480 
   477 
   481 
   478