Skip to content

Commit bdb156b

Browse files
committed
Deduplicate prelude theorems
1 parent 111fb4d commit bdb156b

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

src/language/proof/ProofHacks.re

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,3 +556,16 @@ let goal_of_typ = (ty: Typ.t): Exp.t => {
556556
| _ => Exp.fresh(Invalid("Bad_Goal"))
557557
};
558558
};
559+
560+
let strip_theorems = (exp: Exp.t): Exp.t => {
561+
Exp.map_term(
562+
~f_exp=
563+
(cont, exp) => {
564+
switch (exp |> Exp.term_of) {
565+
| Theorem(_, _, e2) => cont(e2)
566+
| _ => cont(exp)
567+
}
568+
},
569+
exp,
570+
);
571+
};

src/web/view/TheoremExerciseMode.re

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,10 +225,13 @@ module Update = {
225225
let stitched_scratch =
226226
Exercise.append_exp(just_prelude_term, just_lemmas_term);
227227
let stitched_theorem =
228-
Exercise.append_exp(
229-
stitched_scratch,
230-
Language.Exp.replace_all_ids(just_prelude_term),
231-
)
228+
stitched_scratch
229+
|> Exercise.append_exp(
230+
_,
231+
just_prelude_term
232+
|> Language.ProofHacks.strip_theorems
233+
|> Language.Exp.replace_all_ids,
234+
)
232235
|> Exercise.append_exp(_, just_theorem_term);
233236

234237
// Worker Setup

0 commit comments

Comments
 (0)