126 | @{const True} => True |
126 | @{const True} => True |
127 | Const (@{const_name All}, _) $ Abs (s, T, t') => |
127 | Const (@{const_name All}, _) $ Abs (s, T, t') => |
128 All (decls_for SRep card Ts T, to_F (T :: Ts) t') |
128 All (decls_for SRep card Ts T, to_F (T :: Ts) t') |
129 | (t0 as Const (@{const_name All}, _)) $ t1 => |
129 | (t0 as Const (@{const_name All}, _)) $ t1 => |
130 to_F Ts (t0 $ eta_expand Ts t1 1) |
130 to_F Ts (t0 $ eta_expand Ts t1 1) |
131 | Const (@{const_name Ex}, _) $ Abs (s, T, t') => |
131 | Const (@{const_name Ex}, _) $ Abs (_, T, t') => |
132 Exist (decls_for SRep card Ts T, to_F (T :: Ts) t') |
132 Exist (decls_for SRep card Ts T, to_F (T :: Ts) t') |
133 | (t0 as Const (@{const_name Ex}, _)) $ t1 => |
133 | (t0 as Const (@{const_name Ex}, _)) $ t1 => |
134 to_F Ts (t0 $ eta_expand Ts t1 1) |
134 to_F Ts (t0 $ eta_expand Ts t1 1) |
135 | Const (@{const_name "op ="}, _) $ t1 $ t2 => |
135 | Const (@{const_name "op ="}, _) $ t1 $ t2 => |
136 RelEq (to_R_rep Ts t1, to_R_rep Ts t2) |
136 RelEq (to_R_rep Ts t1, to_R_rep Ts t2) |
232 | Const (@{const_name snd}, _) => raise SAME () |
232 | Const (@{const_name snd}, _) => raise SAME () |
233 | Const (_, @{typ bool}) => atom_from_formula (to_F Ts t) |
233 | Const (_, @{typ bool}) => atom_from_formula (to_F Ts t) |
234 | Free (x as (_, T)) => |
234 | Free (x as (_, T)) => |
235 Rel (arity_of RRep card T, find_index (curry (op =) x) frees) |
235 Rel (arity_of RRep card T, find_index (curry (op =) x) frees) |
236 | Term.Var _ => raise NOT_SUPPORTED "schematic variables" |
236 | Term.Var _ => raise NOT_SUPPORTED "schematic variables" |
237 | Bound j => raise SAME () |
237 | Bound _ => raise SAME () |
238 | Abs (_, T, t') => |
238 | Abs (_, T, t') => |
239 (case fastype_of1 (T :: Ts, t') of |
239 (case fastype_of1 (T :: Ts, t') of |
240 @{typ bool} => Comprehension (decls_for SRep card Ts T, |
240 @{typ bool} => Comprehension (decls_for SRep card Ts T, |
241 to_F (T :: Ts) t') |
241 to_F (T :: Ts) t') |
242 | T' => Comprehension (decls_for SRep card Ts T @ |
242 | T' => Comprehension (decls_for SRep card Ts T @ |
249 @{typ bool} => atom_from_formula (to_F Ts t) |
249 @{typ bool} => atom_from_formula (to_F Ts t) |
250 | T => |
250 | T => |
251 let val T2 = fastype_of1 (Ts, t2) in |
251 let val T2 = fastype_of1 (Ts, t2) in |
252 case arity_of SRep card T2 of |
252 case arity_of SRep card T2 of |
253 1 => Join (to_S_rep Ts t2, to_R_rep Ts t1) |
253 1 => Join (to_S_rep Ts t2, to_R_rep Ts t1) |
254 | n => |
254 | arity2 => |
255 let |
255 let val res_arity = arity_of RRep card T in |
256 val arity2 = arity_of SRep card T2 |
|
257 val res_arity = arity_of RRep card T |
|
258 in |
|
259 Project (Intersect |
256 Project (Intersect |
260 (Product (to_S_rep Ts t2, |
257 (Product (to_S_rep Ts t2, |
261 atom_schema_of RRep card T |
258 atom_schema_of RRep card T |
262 |> map (AtomSeq o rpair 0) |> foldl1 Product), |
259 |> map (AtomSeq o rpair 0) |> foldl1 Product), |
263 to_R_rep Ts t1), |
260 to_R_rep Ts t1), |