tac.dk 2.3 KB
Newer Older
Raphael Cauderlier's avatar
Raphael Cauderlier committed
1 2 3 4 5 6 7 8 9
#NAME tac.

(; Customization of Emacs mode for Dedukti: this file is not linear
   and requires a path extended with "../fol".

   (setq-local dedukti-check-options '("-nc" "-nl" "-I" "../fol"))
   (setq-local dedukti-compile-options '("-nc" "-e" "-nl" "-I" "../fol"))
;)

Raphael Cauderlier's avatar
Typos  
Raphael Cauderlier committed
10
(; This is a Meta Dedukti port of Mtac with the following simpifications:
Raphael Cauderlier's avatar
Raphael Cauderlier committed
11 12 13 14 15 16 17
   - works on first-order logic instead of CIC
      This implies a bit of duplication between terms and proofs.
   - nu and abs are replaced by the less powerful but simpler to implement intro
   - no pattern matching, use rewriting instead
   - no deep manipulation of variables and meta variables
;)

18
def type := fol.type.
Raphael Cauderlier's avatar
Raphael Cauderlier committed
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
def term := fol.term.
def prop := fol.prop.
def proof := fol.proof.
def all := fol.all.
def imp := fol.imp.

exc : Type.
tactic : prop -> Type.

ret : A : prop -> proof A -> tactic A.
raise : A : prop -> exc -> tactic A.


def run : A : prop -> tactic A -> proof A.
[a] run _ (ret _ a) --> a.

def bind : A : prop -> B : prop -> tactic A -> (proof A -> tactic B) -> tactic B.
[a,f,t] bind _ _ (ret _ t) f --> f t
[B,t] bind _ B (raise _ t) _ --> raise B t.

def try : A : prop -> tactic A -> (exc -> tactic A) -> tactic A.
[A,t] try A (ret _ t) _ --> ret A t
[t,f] try _ (raise _ t) f --> f t.

43
def fix_term : A : type ->
Raphael Cauderlier's avatar
Raphael Cauderlier committed
44 45 46 47 48 49 50 51 52 53 54
               B : (term A -> prop) ->
               ((x : term A -> tactic (B x)) -> x : term A -> tactic (B x)) ->
               x : term A -> tactic (B x).
[A,B,f,t] fix_term A B f t --> f (fix_term A B f) t.

def fix_proof : A : prop ->
                B : prop ->
                ((proof A -> tactic B) -> proof A -> tactic B) ->
                proof A -> tactic B.
[A,B,f,t] fix_proof A B f t --> f (fix_proof A B f) t.

55
def intro_term : A : type ->
Raphael Cauderlier's avatar
Raphael Cauderlier committed
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
                 B : (term A -> prop) ->
                 (x : term A -> tactic (B x)) ->
                 tactic (all A B).
def intro_proof : A : prop ->
                  B : prop ->
                  (proof A -> tactic B) ->
                  tactic (imp A B).

[A,B,b] intro_term A B (x => ret (B x) (b x))
      -->
   ret (all A B) (x : term A => b x)
[A,B,e] intro_term A B (x => raise (B x) e)
      -->
   raise (all A B) e.
[A,B,b] intro_proof A B (x => ret B (b x))
      -->
   ret (imp A B) (x : proof A => b x)
[A,B,e] intro_proof A B (x => raise _ e)
      -->
   raise (imp A B) e.