mirror of
				https://github.com/Brandon-Rozek/matmod.git
				synced 2025-11-03 03:11:12 +00:00 
			
		
		
		
	Compare commits
	
		
			3 commits
		
	
	
		
			43bb036008
			...
			d14ad52798
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| d14ad52798 | |||
| 960fa82237 | |||
| d1c56fa6a5 | 
					 2 changed files with 13 additions and 10 deletions
				
			
		
							
								
								
									
										14
									
								
								README.md
									
										
									
									
									
								
							
							
						
						
									
										14
									
								
								README.md
									
										
									
									
									
								
							| 
						 | 
					@ -1,12 +1,16 @@
 | 
				
			||||||
# Matmod: Matrix Model Generator for Implicative Connectives
 | 
					# Matmod: Verify Relevance Properties for Matrix Models with Implicative Connectives
 | 
				
			||||||
 | 
					
 | 
				
			||||||
This repository is mostly an experiment to help
 | 
					Interested in seeing which satisfiable models from [arranstewart/magic](https://github.com/arranstewart/magic) have the variable sharing property?
 | 
				
			||||||
me better understand matrix models.
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
You're likely better off using [arranstewart/magic](https://github.com/arranstewart/magic).
 | 
					(1) Generate satisfiable matrix models using `magic`.
 | 
				
			||||||
 | 
					 - Use the `ugly` data format as the output
 | 
				
			||||||
 | 
					 - Keep in mind not all logic features in magic are supported, check out the [GitHub issue tracker](https://github.com/Brandon-Rozek/matmod/issues) to see upcoming features or make your own requests
 | 
				
			||||||
 | 
					
 | 
				
			||||||
We support output from magic using the ugly data format.
 | 
					(2) Run our tool! It will first attempt to parse all the matrices in the output file and then check for the variable sharing property one-by-one.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
python3 parse_magic.py < UGLY_FILE_FROM_MAGIC
 | 
					python3 parse_magic.py < UGLY_FILE_FROM_MAGIC
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					If you face any troubles, feel free to reach out. This tool also has capabilities to generate satisfiable models given a specification (see: R.py), however, it is much slower than magic so you're better off using that.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -80,9 +80,8 @@ def carrier_set_from_size(size: int):
 | 
				
			||||||
def parse_size(infile: TextIO) -> Optional[int]:
 | 
					def parse_size(infile: TextIO) -> Optional[int]:
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
    Parse the line representing the matrix size.
 | 
					    Parse the line representing the matrix size.
 | 
				
			||||||
    NOTE: Elements are represented in hexidecimal.
 | 
					 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
    size = int(next(infile), 16)
 | 
					    size = int(next(infile))
 | 
				
			||||||
    if size == -1:
 | 
					    if size == -1:
 | 
				
			||||||
        return None
 | 
					        return None
 | 
				
			||||||
    assert size > 0, "Unexpected size"
 | 
					    assert size > 0, "Unexpected size"
 | 
				
			||||||
| 
						 | 
					@ -110,16 +109,16 @@ def parse_negation(infile: TextIO, size: int) -> Optional[ModelFunction]:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def mvalue_from_index(i: int):
 | 
					def mvalue_from_index(i: int):
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
    Given an index, return the hexidecimal
 | 
					    Given an index, return the
 | 
				
			||||||
    representation of the model value.
 | 
					    representation of the model value.
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
    return ModelValue(f"a{hex(i)[-1]}")
 | 
					    return ModelValue(f"a{i}")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def parse_mvalue(x: str) -> ModelValue:
 | 
					def parse_mvalue(x: str) -> ModelValue:
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
    Parse an element and return the model value.
 | 
					    Parse an element and return the model value.
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
    return mvalue_from_index(int(x, 16))
 | 
					    return mvalue_from_index(int(x))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def determine_cresult(size: int, ordering: Dict[ModelValue, ModelValue], a: ModelValue, b: ModelValue) -> ModelValue:
 | 
					def determine_cresult(size: int, ordering: Dict[ModelValue, ModelValue], a: ModelValue, b: ModelValue) -> ModelValue:
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue