@@ -75,6 +75,22 @@ let simpl : (ctxt -> term -> term) -> goal -> goal = fun f g ->
75
75
Typ {gt with goal_type = f (Env. to_ctxt gt.goal_hyps) gt.goal_type}
76
76
| Unif (c ,t ,u ) -> Unif (c, f c t, f c u)
77
77
78
+ (* * [typ_or_def idmap ppf (_,ty,def)] prints in [ppf] the type [ty] or the
79
+ definition [def] if there is one. *)
80
+ let typ_or_def idmap ppf (ty ,def ) =
81
+ let term = term_in idmap in
82
+ match def with
83
+ | None -> out ppf " %a" term (Eval. snf_beta ty)
84
+ | Some u -> out ppf " ≔ %a" term u
85
+
86
+ (* * [ctxt_elt idmap ppf x] prints in [ppf] the conttext element [x]. *)
87
+ let ctxt_elt idmap ppf (v ,ty ,def ) =
88
+ out ppf " %a%a" var v (typ_or_def idmap) (ty,def)
89
+
90
+ (* * [env_elt idmap ppf x] prints in [ppf] the environment element [x]. *)
91
+ let env_elt idmap ppf (s ,(_ ,ty ,def )) =
92
+ out ppf " %a%a" uid s (typ_or_def idmap) (ty,def)
93
+
78
94
(* * [hyps ppf g] prints on [ppf] the beta-normal forms of the hypotheses of
79
95
the goal [g]. *)
80
96
let hyps : int StrMap.t -> goal pp =
@@ -85,23 +101,9 @@ let hyps : int StrMap.t -> goal pp =
85
101
(List. pp (fun ppf -> out ppf " %a\n " elt) " " ) (List. rev l)
86
102
in
87
103
fun idmap ppf g ->
88
- let term = term_in idmap in
89
104
match g with
90
- | Typ gt ->
91
- let elt ppf (s ,(_ ,ty ,def )) =
92
- match def with
93
- | None -> out ppf " %a: %a" uid s term (Eval. snf_beta ty)
94
- | Some u -> out ppf " %a ≔ %a" uid s term u
95
- in
96
- hyps elt ppf gt.goal_hyps
97
- | Unif (c ,_ ,_ ) ->
98
- let elt ppf (x ,a ,t ) =
99
- out ppf " %a: %a" var x term a;
100
- match t with
101
- | None -> ()
102
- | Some t -> out ppf " ≔ %a" term t
103
- in
104
- hyps elt ppf c
105
+ | Typ gt -> hyps (env_elt idmap) ppf gt.goal_hyps
106
+ | Unif (c ,_ ,_ ) -> hyps (ctxt_elt idmap) ppf c
105
107
106
108
(* * [concl ppf g] prints on [ppf] the beta-normal form of the conclusion of
107
109
the goal [g]. *)
@@ -111,7 +113,8 @@ let concl : int StrMap.t -> goal pp = fun idmap ppf g ->
111
113
| Typ gt ->
112
114
out ppf " ?%d: %a" gt.goal_meta.meta_key
113
115
term (Eval. snf_beta gt.goal_type)
114
- | Unif (_ , t , u ) -> out ppf " %a ≡ %a" term t term u
116
+ | Unif (_ , t , u ) ->
117
+ out ppf " %a ≡ %a" term (Eval. snf_beta t) term (Eval. snf_beta u)
115
118
116
119
(* * [pp ppf g] prints on [ppf] the beta-normal form of the goal [g] with its
117
120
hypotheses. *)
@@ -133,26 +136,18 @@ let to_info : goal -> info =
133
136
res
134
137
in
135
138
fun g ->
136
- let term = term_in (get_names g) in
139
+ let idmap = get_names g in
140
+ let term = term_in idmap in
137
141
match g with
138
142
| Typ gt ->
139
- let env_elt (s ,(_ ,ty ,def )) =
140
- s,
141
- match def with
142
- | None -> to_string term (Eval. snf_beta ty)
143
- | Some d -> " ≔ " ^ to_string term d
144
- in
145
- List. rev_map env_elt gt.goal_hyps,
143
+ let f (s ,(_ ,ty ,def )) = s, to_string (typ_or_def idmap) (ty,def) in
144
+ List. rev_map f gt.goal_hyps,
146
145
Typ (" ?" ^ to_string int gt.goal_meta.meta_key,
147
146
to_string term gt.goal_type)
148
147
| Unif (c ,t ,u ) ->
149
- let ctx_elt (v ,ty ,def ) =
150
- to_string var v,
151
- match def with
152
- | None -> to_string term (Eval. snf_beta ty)
153
- | Some d -> " ≔ " ^ to_string term d
154
- in
155
- List. rev_map ctx_elt c,
148
+ let f (v ,ty ,def ) =
149
+ to_string var v, to_string (typ_or_def idmap) (ty,def) in
150
+ List. rev_map f c,
156
151
Unif (to_string term t^ " ≡ " ^ to_string term u)
157
152
158
153
(* * [add_goals_of_problem p gs] extends the list of goals [gs] with the
0 commit comments