src/HOL/Tools/Quotient/quotient_term.ML
changeset 38558 32ad17fe2b9c
parent 37744 3daaf23b9ab4
child 38624 9bb0016f7e60
equal deleted inserted replaced
38557:9926c47ad1a1 38558:32ad17fe2b9c
   488          if resrel <> needrel
   488          if resrel <> needrel
   489          then term_mismatch "regularize (Bex1)" ctxt resrel needrel
   489          then term_mismatch "regularize (Bex1)" ctxt resrel needrel
   490          else mk_bex1_rel $ resrel $ subtrm
   490          else mk_bex1_rel $ resrel $ subtrm
   491        end
   491        end
   492 
   492 
   493   | (Const (@{const_name "Ex1"}, ty) $ t, Const (@{const_name "Ex1"}, ty') $ t') =>
   493   | (Const (@{const_name Ex1}, ty) $ t, Const (@{const_name Ex1}, ty') $ t') =>
   494        let
   494        let
   495          val subtrm = apply_subt (regularize_trm ctxt) (t, t')
   495          val subtrm = apply_subt (regularize_trm ctxt) (t, t')
   496        in
   496        in
   497          if ty = ty' then Const (@{const_name "Ex1"}, ty) $ subtrm
   497          if ty = ty' then Const (@{const_name Ex1}, ty) $ subtrm
   498          else mk_bex1_rel $ (equiv_relation ctxt (qnt_typ ty, qnt_typ ty')) $ subtrm
   498          else mk_bex1_rel $ (equiv_relation ctxt (qnt_typ ty, qnt_typ ty')) $ subtrm
   499        end
   499        end
   500 
   500 
   501   | (Const (@{const_name "Ball"}, ty) $ (Const (@{const_name "Respects"}, _) $ resrel) $ t,
   501   | (Const (@{const_name "Ball"}, ty) $ (Const (@{const_name "Respects"}, _) $ resrel) $ t,
   502      Const (@{const_name "All"}, ty') $ t') =>
   502      Const (@{const_name All}, ty') $ t') =>
   503        let
   503        let
   504          val subtrm = apply_subt (regularize_trm ctxt) (t, t')
   504          val subtrm = apply_subt (regularize_trm ctxt) (t, t')
   505          val needrel = equiv_relation_chk ctxt (qnt_typ ty, qnt_typ ty')
   505          val needrel = equiv_relation_chk ctxt (qnt_typ ty, qnt_typ ty')
   506        in
   506        in
   507          if resrel <> needrel
   507          if resrel <> needrel
   508          then term_mismatch "regularize (Ball)" ctxt resrel needrel
   508          then term_mismatch "regularize (Ball)" ctxt resrel needrel
   509          else mk_ball $ (mk_resp $ resrel) $ subtrm
   509          else mk_ball $ (mk_resp $ resrel) $ subtrm
   510        end
   510        end
   511 
   511 
   512   | (Const (@{const_name "Bex"}, ty) $ (Const (@{const_name "Respects"}, _) $ resrel) $ t,
   512   | (Const (@{const_name "Bex"}, ty) $ (Const (@{const_name "Respects"}, _) $ resrel) $ t,
   513      Const (@{const_name "Ex"}, ty') $ t') =>
   513      Const (@{const_name Ex}, ty') $ t') =>
   514        let
   514        let
   515          val subtrm = apply_subt (regularize_trm ctxt) (t, t')
   515          val subtrm = apply_subt (regularize_trm ctxt) (t, t')
   516          val needrel = equiv_relation_chk ctxt (qnt_typ ty, qnt_typ ty')
   516          val needrel = equiv_relation_chk ctxt (qnt_typ ty, qnt_typ ty')
   517        in
   517        in
   518          if resrel <> needrel
   518          if resrel <> needrel
   519          then term_mismatch "regularize (Bex)" ctxt resrel needrel
   519          then term_mismatch "regularize (Bex)" ctxt resrel needrel
   520          else mk_bex $ (mk_resp $ resrel) $ subtrm
   520          else mk_bex $ (mk_resp $ resrel) $ subtrm
   521        end
   521        end
   522 
   522 
   523   | (Const (@{const_name "Bex1_rel"}, ty) $ resrel $ t, Const (@{const_name "Ex1"}, ty') $ t') =>
   523   | (Const (@{const_name "Bex1_rel"}, ty) $ resrel $ t, Const (@{const_name Ex1}, ty') $ t') =>
   524        let
   524        let
   525          val subtrm = apply_subt (regularize_trm ctxt) (t, t')
   525          val subtrm = apply_subt (regularize_trm ctxt) (t, t')
   526          val needrel = equiv_relation_chk ctxt (qnt_typ ty, qnt_typ ty')
   526          val needrel = equiv_relation_chk ctxt (qnt_typ ty, qnt_typ ty')
   527        in
   527        in
   528          if resrel <> needrel
   528          if resrel <> needrel
   636 
   636 
   637 (* bound variables need to be treated properly,
   637 (* bound variables need to be treated properly,
   638    as the type of subterms needs to be calculated   *)
   638    as the type of subterms needs to be calculated   *)
   639 fun inj_repabs_trm ctxt (rtrm, qtrm) =
   639 fun inj_repabs_trm ctxt (rtrm, qtrm) =
   640  case (rtrm, qtrm) of
   640  case (rtrm, qtrm) of
   641     (Const (@{const_name "Ball"}, T) $ r $ t, Const (@{const_name "All"}, _) $ t') =>
   641     (Const (@{const_name "Ball"}, T) $ r $ t, Const (@{const_name All}, _) $ t') =>
   642        Const (@{const_name "Ball"}, T) $ r $ (inj_repabs_trm ctxt (t, t'))
   642        Const (@{const_name "Ball"}, T) $ r $ (inj_repabs_trm ctxt (t, t'))
   643 
   643 
   644   | (Const (@{const_name "Bex"}, T) $ r $ t, Const (@{const_name "Ex"}, _) $ t') =>
   644   | (Const (@{const_name "Bex"}, T) $ r $ t, Const (@{const_name Ex}, _) $ t') =>
   645        Const (@{const_name "Bex"}, T) $ r $ (inj_repabs_trm ctxt (t, t'))
   645        Const (@{const_name "Bex"}, T) $ r $ (inj_repabs_trm ctxt (t, t'))
   646 
   646 
   647   | (Const (@{const_name "Babs"}, T) $ r $ t, t' as (Abs _)) =>
   647   | (Const (@{const_name "Babs"}, T) $ r $ t, t' as (Abs _)) =>
   648       let
   648       let
   649         val rty = fastype_of rtrm
   649         val rty = fastype_of rtrm