
This directory contains an implementation of first-order 
arithmetic used for demonstrating the tactic tree package.  
The implementation is not complete. Nor is it bug-free. 


                   The logic 
                   ----------

    Propositional Part 


    |- A
    -----------     weaken   (this is needed for the lemma tactic)
    H |- A 
    
    
    --------------  hyp   (provided h:A in H)
    H |- A 


    H |- A      H |- B 
    ------------------  &-introduction 
        H |- A & B 


    H |- A & B,    H,a:A,b:B |- C  
    ------------------------------ &-elimination
               H |- C 

    H |- A 
    ----------  or-introduction, left 
    H |- A | B


    H |- B
    ----------- or-introduction, right
    H |- A | B


    H |- A | B,  H,a:A |- C,  H,b:B |- C 
    ------------------------------------ or-elimination 
                      H |- C

    
    H |- B 
    -----------  implies-introduction (H' = H - (x,A))
    H'|- A -> B


  
    H |- A -> B    H |- A 
    ---------------------- implies-elimination 
               H |- B 


    H,a:A |- False 
    -------------- not-introduction 
    H |-  ~A

    H|- ~A,   H |- A 
    ---------------------- not-elimination
    H |-  B 


    H |-  ~~A 
    -------------------- dn-elimination 
    H |- A 


   Quantifiers 

    H [x:t] H' |- A 
    -------------------------- all-introduction  (x not free in H H')
    H H' |- all x:t.e


    H |- all x:t.A 
    -----------------------   all-elimination  (e has type t under H)
    H |- A[x := e]


    H |- A[x:=e] 
    ----------------------  some-introduction (e has type t under H)
    H |- some x:t.A


    H |- some x:t.A,    H,[x:t],h:A |- C  
    ------------------------------------------  some-elimination 
    		H |- C 

    
    Equality 

    -----------  reflexivity 
    H |- t = t


    H |-  a = b
    ------------- symmetry 
    H |-  b = a


    H |-  a = b,  H |-  b = c
    ------------------------- transitivity 
           H |-  a = c 


Substitution              

   H |- a = b,    H |- A[x:=a]
   ----------------------------  substitution 
            H |- A[x:=b]


Arithmetic (Peano's rules)

    --------------------------  peano 1
    H |- ~(0 = t + 1)


    H |- x + 1 = y + 1 
    -------------------------- peano 2
    H |- x = y 


    --------------------------  peano 3
    H |- x + 0 = x


    ---------------------------------------  peano 4
    H |- x + (y + 1) = (x + y) + 1


    --------------------------  peano 5
    H |- x * 0 = 0


    ---------------------------------------  peano 6 
    H |- x * (y + 1) = (x * y) + x


    
    H |- A[x:=0], H,[u:int],h:A[x:=u] |- A[x:= u+1]
    ----------------------------------------------- integer induction 
                       H |- all x.A                    (x,u not free in H)






   Goals are sequents Sequent(H,A)
 
   Events are theorems. 

The Tactics 
-----------------
   The "refinement logic" contains the 
   following rules (so far): 


Propositional logic 

   H >> A                   (a:A in H)
    by hyp 

   H >> A & B 
     by and_intro 
     H >> A
     H >> B 

   H >> C                   (p:A & B in H)
     by and_elim with p 
     H,a:A,b:B >> C 

   H >> A | B 
     by or_intro_left
     H >> A 

   H >> A | B 
     by or_intro_right
     H >> B

   H >> C                   (d:A | B in H) 
     by or_elim with d 
     H, a:A >> C
     H, b:B >> C 

   H >> A -> B 
     by implies_intro
     H,a:A >> B 

   H >> C                  (f:A->B in H)
     by implies_elim with f 
     H >> A    
     H,b:B >> C

   H >> B
     by cut with A
     H >> A
     H a:A >> B 

   H >> ~A 
     by not_intro
     H a:A >> false

   H >> B                    (f:~A in H)
     by not_elim with f 
     H >> A    

   H >> A 
     by dn_elim 
     H >> ~~A 

Quntifiers

   H >> all x.A
     by all_intro
     H >> A 

   H >> C                         (a:all x.A in H) 
     by all_elim with a,t 
     H,b:A[x:=t] >> C 


   H >> exists x.A 
     by exists_intro with t 
     H >> A[x:=t]

   H >> C              (a:exists x.A in H)
     by exists_elim with a 
     H,b:A |- C 

Equality 

   H >> a = a 
     by reflexivity 

   H >> a = b 
     by symmetry 
     H >> b = a 


   H >> a = c 
     by transitivity with b 
     H >> a = b
     H >> b = c 

Substitution 

   H >> A[x:= b]
     by substitution with A,x,a,b
     H >> a = b
     H >> A[x:=a]

Arithmetic 

  H >> A 	(works when A is application of peano1,peano3,...peano6)
    by axiom 

  H >> All x.A 
    by induction 
    H >> A[x:=0]
    H,a:A >> A[x:=x+1]

Lemma 	

    H >> A 
      by lemma with name    ("name" should be the name of a a tactic tree in the 
      H,b:B >> A              library with conclusion B.) 



Here is a sample tactic tree:


 |- (A' | B' -> C') -> (A' -> C') & (B' -> C')
 by intro
  h0: A' | B' -> C'
  |- (A' -> C') & (B' -> C')
  by intro
   h0: A' | B' -> C'
   |- A' -> C'
   by intro
    h0: A' | B' -> C'
    h1: A'
    |- C'
    by elim "h0"
     h0: A' | B' -> C'
     h1: A'
     |- A' | B'
     by or_intro_left
      h0: A' | B' -> C'
      h1: A'
      |- A'
      by hypothesis
     h0: A' | B' -> C'
     h1: A'
     h2: C'
     |- C'
     by hypothesis
   h0: A' | B' -> C'
   |- B' -> C'
   by intro
    h0: A' | B' -> C'
    h1: B'
    |- C'
    by elim "h0"
     h0: A' | B' -> C'
     h1: B'
     |- A' | B'
     by or_intro_right
      h0: A' | B' -> C'
      h1: B'
      |- B'
      by hypothesis
     h0: A' | B' -> C'
     h1: B'
     h2: C'
     |- C'
     by hypothesis




