Prove.thy
author Christian Urban <urbanc@in.tum.de>
Mon, 28 Sep 2009 23:17:29 +0200
changeset 48 5d32a81cfe49
parent 46 e801b929216b
child 57 13be92f5b638
permissions -rw-r--r--
added name to prove
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6
6a1b4c22a386 added the prove command
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     1
theory Prove
6a1b4c22a386 added the prove command
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     2
imports Main
6a1b4c22a386 added the prove command
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     3
begin
6a1b4c22a386 added the prove command
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
6a1b4c22a386 added the prove command
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
ML {*
6a1b4c22a386 added the prove command
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     6
val r = ref (NONE:(unit -> term) option)
6a1b4c22a386 added the prove command
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
*}
46
e801b929216b some tuning of my code
Christian Urban <urbanc@in.tum.de>
parents: 6
diff changeset
     8
6
6a1b4c22a386 added the prove command
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     9
ML {*
6a1b4c22a386 added the prove command
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    10
let
48
5d32a81cfe49 added name to prove
Christian Urban <urbanc@in.tum.de>
parents: 46
diff changeset
    11
  fun after_qed thm_name thms lthy =
5d32a81cfe49 added name to prove
Christian Urban <urbanc@in.tum.de>
parents: 46
diff changeset
    12
       LocalTheory.note Thm.theoremK (thm_name, (flat thms)) lthy |> snd
5d32a81cfe49 added name to prove
Christian Urban <urbanc@in.tum.de>
parents: 46
diff changeset
    13
    
5d32a81cfe49 added name to prove
Christian Urban <urbanc@in.tum.de>
parents: 46
diff changeset
    14
  fun setup_proof (name_spec, (txt, pos)) lthy =
5d32a81cfe49 added name to prove
Christian Urban <urbanc@in.tum.de>
parents: 46
diff changeset
    15
  let
5d32a81cfe49 added name to prove
Christian Urban <urbanc@in.tum.de>
parents: 46
diff changeset
    16
    val trm = ML_Context.evaluate lthy true ("r", r) txt
5d32a81cfe49 added name to prove
Christian Urban <urbanc@in.tum.de>
parents: 46
diff changeset
    17
  in
5d32a81cfe49 added name to prove
Christian Urban <urbanc@in.tum.de>
parents: 46
diff changeset
    18
    Proof.theorem_i NONE (after_qed name_spec) [[(trm,[])]] lthy
5d32a81cfe49 added name to prove
Christian Urban <urbanc@in.tum.de>
parents: 46
diff changeset
    19
  end;
6
6a1b4c22a386 added the prove command
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    20
48
5d32a81cfe49 added name to prove
Christian Urban <urbanc@in.tum.de>
parents: 46
diff changeset
    21
  val parser = SpecParse.opt_thm_name ":" -- OuterParse.ML_source
5d32a81cfe49 added name to prove
Christian Urban <urbanc@in.tum.de>
parents: 46
diff changeset
    22
6
6a1b4c22a386 added the prove command
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    23
in
46
e801b929216b some tuning of my code
Christian Urban <urbanc@in.tum.de>
parents: 6
diff changeset
    24
  OuterSyntax.local_theory_to_proof "prove" "proving a proposition" 
48
5d32a81cfe49 added name to prove
Christian Urban <urbanc@in.tum.de>
parents: 46
diff changeset
    25
    OuterKeyword.thy_goal (parser >> setup_proof)
6
6a1b4c22a386 added the prove command
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    26
end
6a1b4c22a386 added the prove command
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    27
*}
6a1b4c22a386 added the prove command
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    28
46
e801b929216b some tuning of my code
Christian Urban <urbanc@in.tum.de>
parents: 6
diff changeset
    29
e801b929216b some tuning of my code
Christian Urban <urbanc@in.tum.de>
parents: 6
diff changeset
    30
6
6a1b4c22a386 added the prove command
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    31
end