This commit is contained in:
Adrien Vannson 2022-05-10 13:41:20 +02:00
parent 4ca1a65529
commit 98d525c58a
No known key found for this signature in database
GPG Key ID: FE2E66FD978C1A55
4 changed files with 15 additions and 2 deletions

View File

@ -19,5 +19,6 @@ and token_tactic = parse
| "intro" { INTRO } | "intro" { INTRO }
| "assumption" { ASSUMPTION } | "assumption" { ASSUMPTION }
| "apply" { APPLY } | "apply" { APPLY }
| "elim" { ELIM }
| ['a'-'z']+['0'-'9']* as s { VAR_NAME s } | ['a'-'z']+['0'-'9']* as s { VAR_NAME s }
| '.' { DOT } | '.' { DOT }

10
main.ml
View File

@ -132,6 +132,16 @@ while !subgoals <> [] do
in in
explore hyps; explore hyps;
) )
| Elim var -> (
let rec explore = function
| (var_hyp, ty_hyp) :: _ when var_hyp = var && ty_hyp = TFalse -> (
fill_holes := fun holes -> f ((LExf (LVar var, ty)) :: holes)
)
| [] -> failwith ("Hypothesis " ^ var ^ " not found or unusable")
| _ :: hyps -> explore hyps
in
explore hyps;
)
done; done;
let finalLam = !fill_holes [] in let finalLam = !fill_holes [] in

View File

@ -10,7 +10,7 @@
%token <string> VAR_NAME %token <string> VAR_NAME
%token <string> TYPE_NAME %token <string> TYPE_NAME
%token DOT INTRO ASSUMPTION APPLY %token DOT INTRO ASSUMPTION APPLY ELIM
/* L'ordre de définition définit la priorité */ /* L'ordre de définition définit la priorité */
%right RARROW %right RARROW
@ -40,3 +40,4 @@ tactic:
| INTRO VAR_NAME DOT { Intro $2 } | INTRO VAR_NAME DOT { Intro $2 }
| ASSUMPTION DOT { Assumption } | ASSUMPTION DOT { Assumption }
| APPLY VAR_NAME DOT { Apply $2 } | APPLY VAR_NAME DOT { Apply $2 }
| ELIM VAR_NAME DOT { Elim $2 }

View File

@ -3,4 +3,5 @@ open Structs;;
type tactic = type tactic =
| Intro of var_lambda | Intro of var_lambda
| Assumption | Assumption
| Apply of var_lambda;; | Apply of var_lambda
| Elim of var_lambda;;