-
Notifications
You must be signed in to change notification settings - Fork 85
/
repl_decs_allowedScript.sml
45 lines (36 loc) · 1.33 KB
/
repl_decs_allowedScript.sml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
(*
The REPL puts some restrictions on what decs are acceptable as user input.
This file defines what those restrictions are.
*)
open preamble
open semanticsPropsTheory evaluateTheory semanticPrimitivesTheory
open candle_prover_invTheory
val _ = Parse.hide "types"
val _ = new_theory "repl_decs_allowed";
val _ = patternMatchesLib.ENABLE_PMATCH_CASES();
(* definition *)
Definition decs_allowed_def:
decs_allowed (decs:ast$dec list) = EVERY candle_prover_inv$safe_dec decs
End
(* pmatch lemmas *)
Triviality safe_exp_pmatch_lemma:
safe_exp =
every_exp $ λx. case x of
| Con opt xs => (dtcase opt of
| SOME id => let n = id_to_n id in n ∉ kernel_ctors
| NONE => T)
| App op xs' => op ≠ FFI kernel_ffi
| _ => T
Proof
CONV_TAC(ONCE_DEPTH_CONV patternMatchesLib.PMATCH_ELIM_CONV)
\\ rw [safe_exp_def,FUN_EQ_THM]
\\ AP_THM_TAC \\ AP_TERM_TAC
\\ rw [safe_exp_def,FUN_EQ_THM]
\\ CASE_TAC \\ fs []
\\ CASE_TAC \\ fs []
QED
Theorem safe_exp_pmatch = safe_exp_pmatch_lemma
|> SIMP_RULE std_ss [candle_kernel_valsTheory.kernel_ctors_def,
candle_kernel_valsTheory.kernel_ffi_def,
IN_UNION,IN_INSERT,NOT_IN_EMPTY,GSYM CONJ_ASSOC]
val _ = export_theory();