equal
deleted
inserted
replaced
127 #> f |
127 #> f |
128 #> Thm.prop_of |
128 #> Thm.prop_of |
129 #> Logic.dest_equals |
129 #> Logic.dest_equals |
130 #> snd; |
130 #> snd; |
131 |
131 |
|
132 fun same_arity thy thms = |
|
133 let |
|
134 val num_args_of = length o snd o strip_comb o fst o Logic.dest_equals; |
|
135 val k = fold (curry Int.max o num_args_of o Thm.prop_of) thms 0; |
|
136 in map (Code.expand_eta thy k) thms end; |
|
137 |
132 fun preprocess thy c eqns = |
138 fun preprocess thy c eqns = |
133 let |
139 let |
134 val pre = (Simplifier.theory_context thy o #pre o the_thmproc) thy; |
140 val pre = (Simplifier.theory_context thy o #pre o the_thmproc) thy; |
135 val functrans = (map (fn (_, (_, f)) => f thy) o #functrans |
141 val functrans = (map (fn (_, (_, f)) => f thy) o #functrans |
136 o the_thmproc) thy; |
142 o the_thmproc) thy; |
138 eqns |
144 eqns |
139 |> apply_functrans thy c functrans |
145 |> apply_functrans thy c functrans |
140 |> (map o apfst) (rewrite_eqn pre) |
146 |> (map o apfst) (rewrite_eqn pre) |
141 |> (map o apfst) (AxClass.unoverload thy) |
147 |> (map o apfst) (AxClass.unoverload thy) |
142 |> map (Code.assert_eqn thy) |
148 |> map (Code.assert_eqn thy) |
143 |> burrow_fst (Code.norm_args thy) |
149 |> burrow_fst (same_arity thy) |
144 |> burrow_fst (Code.norm_varnames thy) |
150 |> burrow_fst (Code.desymbolize_all_vars thy) |
145 end; |
151 end; |
146 |
152 |
147 fun preprocess_conv thy ct = |
153 fun preprocess_conv thy ct = |
148 let |
154 let |
149 val pre = (Simplifier.theory_context thy o #pre o the_thmproc) thy; |
155 val pre = (Simplifier.theory_context thy o #pre o the_thmproc) thy; |