reorganized files for parsing and decided libraries
This commit is contained in:
parent
0f39cb7fa3
commit
2dc7624ede
12 changed files with 31 additions and 17 deletions
|
|
@ -7,9 +7,9 @@
|
||||||
(source
|
(source
|
||||||
(github username/reponame))
|
(github username/reponame))
|
||||||
|
|
||||||
(authors "Author Name")
|
(authors "William Ball")
|
||||||
|
|
||||||
(maintainers "Maintainer Name")
|
(maintainers "William Ball")
|
||||||
|
|
||||||
(license LICENSE)
|
(license LICENSE)
|
||||||
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
(name proof_checker)
|
(name proof_checker)
|
||||||
(synopsis "A short synopsis")
|
(synopsis "A short synopsis")
|
||||||
(description "A longer description")
|
(description "A longer description")
|
||||||
(depends ocaml dune)
|
(depends ocaml dune fmlib_parse sedlex)
|
||||||
(tags
|
(tags
|
||||||
(topics "to describe" your project)))
|
(topics "to describe" your project)))
|
||||||
|
|
||||||
|
|
|
||||||
3
lib/dune
3
lib/dune
|
|
@ -1,2 +1,3 @@
|
||||||
(library
|
(library
|
||||||
(name proof_checker))
|
(name proof_checker)
|
||||||
|
(libraries kernel pfparser))
|
||||||
|
|
|
||||||
2
lib/kernel/dune
Normal file
2
lib/kernel/dune
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
(library
|
||||||
|
(name kernel))
|
||||||
|
|
@ -85,11 +85,11 @@ let to_string formula =
|
||||||
match formula with
|
match formula with
|
||||||
| Relation (r, terms) ->
|
| Relation (r, terms) ->
|
||||||
sprintf "%s(%s)" r
|
sprintf "%s(%s)" r
|
||||||
(String.concat ", " (List.map (Term.to_string ~binders) terms))
|
(String.concat ", " (List.map (Term.to_string binders) terms))
|
||||||
| Equal (t1, t2) ->
|
| Equal (t1, t2) ->
|
||||||
sprintf "%s = %s"
|
sprintf "%s = %s"
|
||||||
(Term.to_string ~binders t1)
|
(Term.to_string binders t1)
|
||||||
(Term.to_string ~binders t2)
|
(Term.to_string binders t2)
|
||||||
| Bottom -> "⊥"
|
| Bottom -> "⊥"
|
||||||
| Neg f -> sprintf "¬%s" (aux depth binders Negation f)
|
| Neg f -> sprintf "¬%s" (aux depth binders Negation f)
|
||||||
| Conj (f1, f2) -> sprintf "%s ∧ %s" (step f1) (step f2)
|
| Conj (f1, f2) -> sprintf "%s ∧ %s" (step f1) (step f2)
|
||||||
|
|
@ -10,6 +10,16 @@ type t =
|
||||||
| Forall of t
|
| Forall of t
|
||||||
| Exists of t
|
| Exists of t
|
||||||
|
|
||||||
|
type precedence =
|
||||||
|
| Atomic
|
||||||
|
| Negation
|
||||||
|
| Conjunction
|
||||||
|
| Disjunction
|
||||||
|
| Implication
|
||||||
|
| Biconditional
|
||||||
|
| Quantifier
|
||||||
|
|
||||||
|
val precedence_of : t -> precedence
|
||||||
val match_term : Term.t -> t -> t -> Term.match_result
|
val match_term : Term.t -> t -> t -> Term.match_result
|
||||||
val occurs : Term.t -> t -> bool
|
val occurs : Term.t -> t -> bool
|
||||||
val to_string : t -> string
|
val to_string : t -> string
|
||||||
|
|
@ -41,12 +41,10 @@ let rec occurs t = function
|
||||||
| Function (_, ts) -> List.exists (occurs t) ts
|
| Function (_, ts) -> List.exists (occurs t) ts
|
||||||
| s -> t = s
|
| s -> t = s
|
||||||
|
|
||||||
exception UnboundVariable
|
let to_string binders =
|
||||||
|
|
||||||
let to_string ~binders =
|
|
||||||
let open Format in
|
let open Format in
|
||||||
let rec aux = function
|
let rec aux = function
|
||||||
| Var v -> ( try List.nth binders v with _ -> raise UnboundVariable)
|
| Var v -> List.nth binders v
|
||||||
| Const c -> c
|
| Const c -> c
|
||||||
| Free f -> f
|
| Free f -> f
|
||||||
| Function (f, args) ->
|
| Function (f, args) ->
|
||||||
|
|
@ -12,7 +12,4 @@ val merge_result : match_result -> match_result -> match_result
|
||||||
val match_term : t -> t -> t -> match_result
|
val match_term : t -> t -> t -> match_result
|
||||||
val inc_var : t -> t
|
val inc_var : t -> t
|
||||||
val occurs : t -> t -> bool
|
val occurs : t -> t -> bool
|
||||||
|
val to_string : string list -> t -> string
|
||||||
exception UnboundVariable
|
|
||||||
|
|
||||||
val to_string : binders:string list -> t -> string
|
|
||||||
3
lib/parser/dune
Normal file
3
lib/parser/dune
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
(library
|
||||||
|
(name pfparser)
|
||||||
|
(libraries kernel sedlex fmlib_parse))
|
||||||
1
lib/parser/parser.ml
Normal file
1
lib/parser/parser.ml
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
let x = 3
|
||||||
|
|
@ -2,8 +2,8 @@
|
||||||
opam-version: "2.0"
|
opam-version: "2.0"
|
||||||
synopsis: "A short synopsis"
|
synopsis: "A short synopsis"
|
||||||
description: "A longer description"
|
description: "A longer description"
|
||||||
maintainer: ["Maintainer Name"]
|
maintainer: ["William Ball"]
|
||||||
authors: ["Author Name"]
|
authors: ["William Ball"]
|
||||||
license: "LICENSE"
|
license: "LICENSE"
|
||||||
tags: ["topics" "to describe" "your" "project"]
|
tags: ["topics" "to describe" "your" "project"]
|
||||||
homepage: "https://github.com/username/reponame"
|
homepage: "https://github.com/username/reponame"
|
||||||
|
|
@ -12,6 +12,8 @@ bug-reports: "https://github.com/username/reponame/issues"
|
||||||
depends: [
|
depends: [
|
||||||
"ocaml"
|
"ocaml"
|
||||||
"dune" {>= "3.16"}
|
"dune" {>= "3.16"}
|
||||||
|
"fmlib_parse"
|
||||||
|
"sedlex"
|
||||||
"odoc" {with-doc}
|
"odoc" {with-doc}
|
||||||
]
|
]
|
||||||
build: [
|
build: [
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue